#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
void remove_comment_from_file(FILE *file) {
  int c;
  c = getc(file);
  if (c == '\n')
    c = getc(file);
  while (c == '#') {
    while (getc(file) != '\n')
      ;
    c = getc(file);
  }
  ungetc(c, file);
}


x86 assembly (clang, -O0):
<remove_comment_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
movsbl %al,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jne    1154 <remove_comment_from_file+0x34>
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
movsbl %al,%eax
mov    %eax,-0xc(%rbp)
jmp    1159 <remove_comment_from_file+0x39>
cmpl   $0x23,-0xc(%rbp)
jne    1196 <remove_comment_from_file+0x76>
jmp    1168 <remove_comment_from_file+0x48>
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1182 <remove_comment_from_file+0x62>
jmp    1168 <remove_comment_from_file+0x48>
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
movsbl %al,%eax
mov    %eax,-0xc(%rbp)
jmp    1159 <remove_comment_from_file+0x39>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <ungetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_comment_from_file>:
push   %rbx
mov    %rdi,%rbx
call   1040 <getc@plt>
cmp    $0xa,%al
jne    1135 <remove_comment_from_file+0x15>
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    $0x23,%al
jne    1147 <remove_comment_from_file+0x27>
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    $0xa,%al
jne    1139 <remove_comment_from_file+0x19>
jmp    112d <remove_comment_from_file+0xd>
movsbl %al,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <ungetc@plt>

LLVM IR (-O0):
define void @remove_comment_from_file(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call signext i8 @getc(i32* %4)
%6 = sext i8 %5 to i32
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 10
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32*, i32** %2
%11 = call signext i8 @getc(i32* %10)
%12 = sext i8 %11 to i32
store i32 %12, i32* %3
br label %13
13: ; preds = %9, %1
br label %14
14: ; preds = %24, %13
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 35
br i1 %16, label %17, label %28
17: ; preds = %14
br label %18
18: ; preds = %23, %17
%19 = load i32*, i32** %2
%20 = call signext i8 @getc(i32* %19)
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 10
br i1 %22, label %23, label %24
23: ; preds = %18
br label %18
24: ; preds = %18
%25 = load i32*, i32** %2
%26 = call signext i8 @getc(i32* %25)
%27 = sext i8 %26 to i32
store i32 %27, i32* %3
br label %14
28: ; preds = %14
%29 = load i32, i32* %3
%30 = load i32*, i32** %2
%31 = call i32 @ungetc(i32 %29, i32* %30)
ret void
}

LLVM IR (-O2):
define void @remove_comment_from_file(i32* nocapture %0) {
%2 = tail call signext i8 @getc(i32* %0)
%3 = icmp eq i8 %2, 10
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call signext i8 @getc(i32* %0)
br label %6
6: ; preds = %4, %1
%7 = phi i8 [ %5, %4 ], [ %2, %1 ]
%8 = icmp eq i8 %7, 35
br i1 %8, label %9, label %16
9: ; preds = %6, %12
%10 = tail call signext i8 @getc(i32* %0)
%11 = icmp eq i8 %10, 10
br i1 %11, label %13, label %12
12: ; preds = %9, %13
br label %9
13: ; preds = %9
%14 = tail call signext i8 @getc(i32* %0)
%15 = icmp eq i8 %14, 35
br i1 %15, label %12, label %16
16: ; preds = %13, %6
%17 = phi i8 [ %7, %6 ], [ %14, %13 ]
%18 = sext i8 %17 to i32
%19 = tail call i32 @ungetc(i32 %18, i32* %0)
ret void
}