diff --git a/script/add_noinline_annotation.sh b/script/add_noinline_annotation.sh
index fbbb0d0fbfb3f1a88192799ec255c62e46e61f05..ba684b6f6596784b68561f85e55918e1e915ea41 100755
--- a/script/add_noinline_annotation.sh
+++ b/script/add_noinline_annotation.sh
@@ -9,18 +9,26 @@ TACLE_ROOT=$1
 
 for i in $(grep -r "entrypoint" `find $TACLE_ROOT -name "*.c"` | cut -d: -f1) ;
 do
+
+  #TODO
   # ugly workaround: run clang-format prior to the annotiation
   # to have { at the end of the line
   temp=$(tempfile)
+  # 1.) remove all comments
+  # to avoid main() /* long multi-line comment... */ {
+  # since clang-format will not move the '{' directly after the signature
+  sed -r ':a; s%(.*)/\*.*\*/%\1%; ta; /\/\*/ !b; N; ba' $i > $temp
+  mv $temp $i
+
+  # 2. format
   clang-format $i > $temp
   mv $temp $i
 
   exists=$(grep -c '__attribute__((noinline))' $i )
   if [ $exists -eq 0 ]; then
-    echo "annotating $i"
     # get the line number:
     line=$(grep -n "entrypoint" $i |cut -d: -f1)
-    echo "found in line $line"
+    echo "Annotated $i in line $line"
     sed -i "${line}s/{/__attribute__((noinline)){/g" $i
   fi
 done