#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 */
int EOF;
int getc(int /*<<< orphan*/ *);
int ungetc(int, int /*<<< orphan*/ *);
int skipcomment(FILE *fp) {
  int i;
  if ((i = getc(fp)) == '#') {
    while ((i = getc(fp)) != '\n' && i != EOF)
      ;
  }
  return (ungetc(i, fp));
}


x86 assembly (clang, -O0):
<skipcomment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x23,%eax
jne    118e <skipcomment+0x6e>
jmp    1146 <skipcomment+0x26>
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xd(%rbp)
je     1174 <skipcomment+0x54>
mov    -0xc(%rbp),%eax
mov    0x2e7c(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1184 <skipcomment+0x64>
jmp    1189 <skipcomment+0x69>
jmp    1146 <skipcomment+0x26>
jmp    118e <skipcomment+0x6e>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <ungetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipcomment>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <getc@plt>
cmp    $0x23,%eax
jne    1152 <skipcomment+0x32>
mov    0x2eb0(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    $0xa,%eax
je     1152 <skipcomment+0x32>
cmp    (%r14),%eax
jne    1140 <skipcomment+0x20>
mov    %eax,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <ungetc@plt>

LLVM IR (-O0):
@EOF = global i32 0
define i32 @skipcomment(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @getc(i32* %4)
store i32 %5, i32* %3
%6 = icmp eq i32 %5, 35
br i1 %6, label %7, label %20
7: ; preds = %1
br label %8
8: ; preds = %18, %7
%9 = load i32*, i32** %2
%10 = call i32 @getc(i32* %9)
store i32 %10, i32* %3
%11 = icmp ne i32 %10, 10
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i32, i32* %3
%14 = load i32, i32* @EOF
%15 = icmp ne i32 %13, %14
br label %16
16: ; preds = %12, %8
%17 = phi i1 [ false, %8 ], [ %15, %12 ]
br i1 %17, label %18, label %19
18: ; preds = %16
br label %8
19: ; preds = %16
br label %20
20: ; preds = %19, %1
%21 = load i32, i32* %3
%22 = load i32*, i32** %2
%23 = call i32 @ungetc(i32 %21, i32* %22)
ret i32 %23
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @skipcomment(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = icmp eq i32 %2, 35
br i1 %3, label %4, label %10
4: ; preds = %1, %4
%5 = tail call i32 @getc(i32* %0)
%6 = icmp ne i32 %5, 10
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %5, %7
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %4, label %10
10: ; preds = %4, %1
%11 = phi i32 [ %2, %1 ], [ %5, %4 ]
%12 = tail call i32 @ungetc(i32 %11, i32* %0)
ret i32 %12
}