#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 getc(int /*<<< orphan*/ *);
scalar_t__ isspace(int);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
int skipjunk(FILE *fp) {
  int c;
  for (;;) {
    do
      c = getc(fp);
    while (isspace(c));
    if (c == '#')
      while ((c = getc(fp)) != '\n')
        ;
    else {
      ungetc(c, fp);
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<skipjunk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
jmp    1141 <skipjunk+0x11>
mov    -0x8(%rbp),%rdi
call   1050 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
jne    1141 <skipjunk+0x11>
cmpl   $0x23,-0xc(%rbp)
jne    118d <skipjunk+0x5d>
jmp    116e <skipjunk+0x3e>
mov    -0x8(%rbp),%rdi
call   1050 <getc@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xa,%eax
je     1188 <skipjunk+0x58>
jmp    116e <skipjunk+0x3e>
jmp    119e <skipjunk+0x6e>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1040 <ungetc@plt>
jmp    11a3 <skipjunk+0x73>
jmp    113c <skipjunk+0xc>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipjunk>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <getc@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1140 <skipjunk+0x10>
cmp    $0x23,%ebp
jne    116f <skipjunk+0x3f>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <getc@plt>
cmp    $0xa,%eax
jne    1160 <skipjunk+0x30>
jmp    1140 <skipjunk+0x10>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <ungetc@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @skipjunk(i32* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = tail call i32 @getc(i32* %0)
%4 = tail call i64 @isspace(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %9, %2
br label %2
7: ; preds = %2
%8 = icmp eq i32 %3, 35
br i1 %8, label %9, label %12
9: ; preds = %7, %9
%10 = tail call i32 @getc(i32* %0)
%11 = icmp eq i32 %10, 10
br i1 %11, label %6, label %9
12: ; preds = %7
%13 = tail call i32 @ungetc(i32 %3, i32* %0)
ret i32 0
}