#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 /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           unsigned int, char const *);
scalar_t__ isspace(char);
char *parse_line(char *);
int /*<<< orphan*/ stderr;
int parse_file(FILE *f, const char *filename) {
  char buf[256];
  char *s;
  unsigned i;
  unsigned line = 0;
  const char *reason;
  int ret = 1;
  while (line++, fgets(buf, sizeof buf, f)) {
    for (s = buf; isspace(*s); s++)
      ;
    for (i = 0; s[i]; i++) {
      if (s[i] == ';')
        s[i] = 0;
    }
    if (!*s)
      continue;
    reason = parse_line(s);
    if (reason) {
      fprintf(stderr, "%s:%u:parse error:%s\n", filename, line, reason);
      ret = 0;
      break;
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<parse_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x120(%rbp)
movl   $0x1,-0x12c(%rbp)
mov    -0x120(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x120(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
cmp    $0x0,%eax
je     12ac <parse_file+0x16c>
lea    -0x110(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    -0x118(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     11d7 <parse_file+0x97>
jmp    11c0 <parse_file+0x80>
mov    -0x118(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x118(%rbp)
jmp    11a2 <parse_file+0x62>
movl   $0x0,-0x11c(%rbp)
mov    -0x118(%rbp),%rax
mov    -0x11c(%rbp),%ecx
cmpb   $0x0,(%rax,%rcx,1)
je     123c <parse_file+0xfc>
mov    -0x118(%rbp),%rax
mov    -0x11c(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
jne    1223 <parse_file+0xe3>
mov    -0x118(%rbp),%rax
mov    -0x11c(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
jmp    1228 <parse_file+0xe8>
mov    -0x11c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x11c(%rbp)
jmp    11e1 <parse_file+0xa1>
mov    -0x118(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1251 <parse_file+0x111>
jmp    1167 <parse_file+0x27>
mov    -0x118(%rbp),%rdi
call   1060 <parse_line@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
je     12a7 <parse_file+0x167>
mov    0x2d67(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x120(%rbp),%ecx
mov    -0x128(%rbp),%r8
lea    0xd6d(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x0,-0x12c(%rbp)
jmp    12ac <parse_file+0x16c>
jmp    1167 <parse_file+0x27>
mov    -0x12c(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
mov    %rsp,%rdi
mov    $0x100,%esi
mov    %r12,%rdx
call   1040 <fgets@plt>
test   %eax,%eax
je     1209 <parse_file+0xc9>
mov    $0x1,%ebp
lea    -0x1(%rsp),%r13
mov    %rsp,%r15
jmp    1197 <parse_file+0x57>
xchg   %ax,%ax
add    $0x1,%ebp
mov    %r15,%rdi
mov    $0x100,%esi
mov    %r12,%rdx
call   1040 <fgets@plt>
test   %eax,%eax
je     1209 <parse_file+0xc9>
mov    %r13,%rbx
nopw   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    11a0 <parse_file+0x60>
xor    %eax,%eax
jmp    11c7 <parse_file+0x87>
cs nopw 0x0(%rax,%rax,1)
movb   $0x0,(%rbx,%rax,1)
add    $0x1,%eax
mov    %eax,%eax
movzbl (%rbx,%rax,1),%ecx
cmp    $0x3b,%cl
je     11c0 <parse_file+0x80>
test   %cl,%cl
jne    11c4 <parse_file+0x84>
cmpb   $0x0,(%rbx)
je     1180 <parse_file+0x40>
mov    %rbx,%rdi
call   1060 <parse_line@plt>
test   %rax,%rax
je     1180 <parse_file+0x40>
mov    0x2df1(%rip),%rcx
mov    (%rcx),%edi
lea    0xe08(%rip),%rsi
mov    %r14,%rdx
mov    %ebp,%ecx
mov    %rax,%r8
call   1050 <fprintf@plt>
xor    %eax,%eax
jmp    120e <parse_file+0xce>
mov    $0x1,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"%s:%u:parse error:%s\0A\00"
define i32 @parse_file(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [256 x i8]
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32 0, i32* %8
store i32 1, i32* %10
br label %11
11: ; preds = %70, %58, %2
%12 = load i32, i32* %8
%13 = add i32 %12, 1
store i32 %13, i32* %8
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%15 = load i32*, i32** %3
%16 = call i32 @fgets(i8* %14, i32 256, i32* %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %71
18: ; preds = %11
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
store i8* %19, i8** %6
br label %20
20: ; preds = %26, %18
%21 = load i8*, i8** %6
%22 = load i8, i8* %21
%23 = call i64 @isspace(i8 signext %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %20
br label %26
26: ; preds = %25
%27 = load i8*, i8** %6
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %6
br label %20
29: ; preds = %20
store i32 0, i32* %7
br label %30
30: ; preds = %51, %29
%31 = load i8*, i8** %6
%32 = load i32, i32* %7
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = icmp ne i8 %35, 0
br i1 %36, label %37, label %54
37: ; preds = %30
%38 = load i8*, i8** %6
%39 = load i32, i32* %7
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 59
br i1 %44, label %45, label %50
45: ; preds = %37
%46 = load i8*, i8** %6
%47 = load i32, i32* %7
%48 = zext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
store i8 0, i8* %49
br label %50
50: ; preds = %45, %37
br label %51
51: ; preds = %50
%52 = load i32, i32* %7
%53 = add i32 %52, 1
store i32 %53, i32* %7
br label %30
54: ; preds = %30
%55 = load i8*, i8** %6
%56 = load i8, i8* %55
%57 = icmp ne i8 %56, 0
br i1 %57, label %59, label %58
58: ; preds = %54
br label %11
59: ; preds = %54
%60 = load i8*, i8** %6
%61 = call i8* @parse_line(i8* %60)
store i8* %61, i8** %9
%62 = load i8*, i8** %9
%63 = icmp ne i8* %62, null
br i1 %63, label %64, label %70
64: ; preds = %59
%65 = load i32, i32* @stderr
%66 = load i8*, i8** %4
%67 = load i32, i32* %8
%68 = load i8*, i8** %9
%69 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %66, i32 %67, i8* %68)
store i32 0, i32* %10
br label %71
70: ; preds = %59
br label %11
71: ; preds = %64, %11
%72 = load i32, i32* %10
ret i32 %72
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"%s:%u:parse error:%s\0A\00"
define i32 @parse_file(i32* nocapture %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @fgets(i8* %4, i32 256, i32* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %36, label %7
7: ; preds = %2, %26
%8 = phi i32 [ %27, %26 ], [ 1, %2 ]
br label %9
9: ; preds = %9, %7
%10 = phi i8* [ %14, %9 ], [ %4, %7 ]
%11 = load i8, i8* %10
%12 = call i64 @isspace(i8 signext %11)
%13 = icmp eq i64 %12, 0
%14 = getelementptr inbounds i8, i8* %10, i64 1
br i1 %13, label %15, label %9
15: ; preds = %9, %21
%16 = phi i32 [ %22, %21 ], [ 0, %9 ]
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %10, i64 %17
%19 = load i8, i8* %18
switch i8 %19, label %21 [
i8 0, label %23
i8 59, label %20
]
20: ; preds = %15
store i8 0, i8* %18
br label %21
21: ; preds = %15, %20
%22 = add i32 %16, 1
br label %15
23: ; preds = %15
%24 = load i8, i8* %10
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %23, %30
%27 = add i32 %8, 1
%28 = call i32 @fgets(i8* %4, i32 256, i32* %0)
%29 = icmp eq i32 %28, 0
br i1 %29, label %36, label %7
30: ; preds = %23
%31 = call i8* @parse_line(i8* %10)
%32 = icmp eq i8* %31, null
br i1 %32, label %26, label %33
33: ; preds = %30
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %8, i8* %31)
br label %36
36: ; preds = %26, %2, %33
%37 = phi i32 [ 0, %33 ], [ 1, %2 ], [ 1, %26 ]
ret i32 %37
}