#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 fgetc(int /*<<< orphan*/ *);
scalar_t__ isspace(char);
char nextchar(FILE *f) {
  int ch;
  char c;
  do {
    ch = fgetc(f);
    if (ch == EOF)
      return 0;
    c = (char)ch;
    if (c == ';') {
      do {
        ch = fgetc(f);
        if (ch == EOF)
          return 0;
      } while ((char)ch != '\n');
      c = (char)ch;
    }
  } while (isspace(c));
  return c;
}


x86 assembly (clang, -O0):
<nextchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2ea6(%rip),%rcx
cmp    (%rcx),%eax
jne    1153 <nextchar+0x33>
movb   $0x0,-0x1(%rbp)
jmp    11ca <nextchar+0xaa>
mov    -0x14(%rbp),%eax
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x3b,%eax
jne    11ac <nextchar+0x8c>
jmp    116b <nextchar+0x4b>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e67(%rip),%rcx
cmp    (%rcx),%eax
jne    1192 <nextchar+0x72>
movb   $0x0,-0x1(%rbp)
jmp    11ca <nextchar+0xaa>
jmp    1197 <nextchar+0x77>
mov    -0x14(%rbp),%eax
movsbl %al,%eax
cmp    $0xa,%eax
jne    116b <nextchar+0x4b>
mov    -0x14(%rbp),%eax
mov    %al,-0x15(%rbp)
jmp    11b1 <nextchar+0x91>
movsbl -0x15(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
jne    112c <nextchar+0xc>
mov    -0x15(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextchar>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2eba(%rip),%r14
jmp    113e <nextchar+0x1e>
movsbl %bpl,%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1179 <nextchar+0x59>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    (%r14),%eax
je     1177 <nextchar+0x57>
mov    %eax,%ebp
cmp    $0x3b,%bpl
jne    1130 <nextchar+0x10>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    (%r14),%eax
je     1177 <nextchar+0x57>
mov    %eax,%ebp
cmp    $0xa,%bpl
jne    1160 <nextchar+0x40>
jmp    1130 <nextchar+0x10>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define signext i8 @nextchar(i32* %0) {
%2 = alloca i8
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8
store i32* %0, i32** %3
br label %6
6: ; preds = %37, %1
%7 = load i32*, i32** %3
%8 = call i32 @fgetc(i32* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %6
store i8 0, i8* %2
br label %43
13: ; preds = %6
%14 = load i32, i32* %4
%15 = trunc i32 %14 to i8
store i8 %15, i8* %5
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 59
br i1 %18, label %19, label %36
19: ; preds = %13
br label %20
20: ; preds = %28, %19
%21 = load i32*, i32** %3
%22 = call i32 @fgetc(i32* %21)
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %20
store i8 0, i8* %2
br label %43
27: ; preds = %20
br label %28
28: ; preds = %27
%29 = load i32, i32* %4
%30 = trunc i32 %29 to i8
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 10
br i1 %32, label %20, label %33
33: ; preds = %28
%34 = load i32, i32* %4
%35 = trunc i32 %34 to i8
store i8 %35, i8* %5
br label %36
36: ; preds = %33, %13
br label %37
37: ; preds = %36
%38 = load i8, i8* %5
%39 = call i64 @isspace(i8 signext %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %6, label %41
41: ; preds = %37
%42 = load i8, i8* %5
store i8 %42, i8* %2
br label %43
43: ; preds = %41, %26, %12
%44 = load i8, i8* %2
ret i8 %44
}

LLVM IR (-O2):
@EOF = global i32 0
define signext i8 @nextchar(i32* nocapture %0) {
br label %2
2: ; preds = %16, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %23, label %6
6: ; preds = %2
%7 = and i32 %3, 255
%8 = icmp eq i32 %7, 59
br i1 %8, label %9, label %16
9: ; preds = %6, %13
%10 = tail call i32 @fgetc(i32* %0)
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %23, label %13
13: ; preds = %9
%14 = and i32 %10, 255
%15 = icmp eq i32 %14, 10
br i1 %15, label %16, label %9
16: ; preds = %13, %6
%17 = phi i32 [ %3, %6 ], [ %10, %13 ]
%18 = trunc i32 %17 to i8
%19 = tail call i64 @isspace(i8 signext %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %2
21: ; preds = %16
%22 = trunc i32 %17 to i8
br label %23
23: ; preds = %2, %9, %21
%24 = phi i8 [ %22, %21 ], [ 0, %9 ], [ 0, %2 ]
ret i8 %24
}