#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ located_function(char *, int);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ perror(char const *);
char *strtok(char *, char *);
int scan_c_file(const char *name, int code) {
  char buf[256];
  char *t;
  FILE *f = fopen(name, "r");
  if (!f) {
    perror(name);
    exit(1);
  }
  while (fgets(buf, 256, f)) {
    if (memcmp(buf, "arg_t _", 7))
      continue;
    t = strtok(buf + 6, " (\t\n");
    if (t == NULL)
      continue;
    located_function(t, code);
  }
  fclose(f);
}


x86 assembly (clang, -O0):
<scan_c_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x130(%rbp)
cmpq   $0x0,-0x130(%rbp)
jne    11ca <scan_c_file+0x4a>
mov    -0x10(%rbp),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    11cf <scan_c_file+0x4f>
lea    -0x120(%rbp),%rdi
mov    -0x130(%rbp),%rdx
mov    $0x100,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     125d <scan_c_file+0xdd>
lea    -0x120(%rbp),%rdi
lea    0xe03(%rip),%rsi
mov    $0x7,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     1218 <scan_c_file+0x98>
jmp    11cf <scan_c_file+0x4f>
lea    -0x120(%rbp),%rdi
add    $0x6,%rdi
lea    0xde0(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
jne    1249 <scan_c_file+0xc9>
jmp    11cf <scan_c_file+0x4f>
mov    -0x128(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <located_function@plt>
jmp    11cf <scan_c_file+0x4f>
mov    -0x130(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_c_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %esi,%r15d
mov    %rdi,%rbp
lea    0xe62(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1241 <scan_c_file+0xc1>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x100,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1227 <scan_c_file+0xa7>
lea    0x6(%rsp),%r14
lea    0xe32(%rip),%r12
mov    %rsp,%rbp
lea    0xe30(%rip),%r13
jmp    11f5 <scan_c_file+0x75>
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1227 <scan_c_file+0xa7>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    $0x7,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
jne    11e0 <scan_c_file+0x60>
mov    %r14,%rdi
mov    %r13,%rsi
call   1090 <strtok@plt>
test   %rax,%rax
je     11e0 <scan_c_file+0x60>
mov    %rax,%rdi
mov    %r15d,%esi
call   1040 <located_function@plt>
jmp    11e0 <scan_c_file+0x60>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbp,%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [8 x i8] c"arg_t _\00"
@.str.2 = [5 x i8] c" (\09\0A\00"
define i32 @scan_c_file(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [256 x i8]
%7 = alloca i8*
%8 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
%9 = load i8*, i8** %4
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %8
%11 = load i32*, i32** %8
%12 = icmp ne i32* %11, null
br i1 %12, label %17, label %13
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = call i32 @perror(i8* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
br label %18
18: ; preds = %35, %34, %27, %17
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%20 = load i32*, i32** %8
%21 = call i64 @fgets(i8* %19, i32 256, i32* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %39
23: ; preds = %18
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%25 = call i64 @memcmp(i8* %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
br label %18
28: ; preds = %23
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%30 = getelementptr inbounds i8, i8* %29, i64 6
%31 = call i8* @strtok(i8* %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i8* %31, i8** %7
%32 = load i8*, i8** %7
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %35
34: ; preds = %28
br label %18
35: ; preds = %28
%36 = load i8*, i8** %7
%37 = load i32, i32* %5
%38 = call i32 @located_function(i8* %36, i32 %37)
br label %18
39: ; preds = %18
%40 = load i32*, i32** %8
%41 = call i32 @fclose(i32* %40)
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [8 x i8] c"arg_t _\00"
@.str.2 = [5 x i8] c" (\09\0A\00"
define i32 @scan_c_file(i8* nocapture %0, i32 %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = call i64 @fgets(i8* %4, i32 256, i32* %5)
%9 = icmp eq i64 %8, 0
br i1 %9, label %26, label %10
10: ; preds = %7
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 6
br label %15
12: ; preds = %2
%13 = tail call i32 @perror(i8* %0)
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %10, %23
%16 = call i64 @memcmp(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = call i8* @strtok(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i8* %19, null
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = call i32 @located_function(i8* %19, i32 %1)
br label %23
23: ; preds = %21, %15, %18
%24 = call i64 @fgets(i8* %4, i32 256, i32* %5)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %15
26: ; preds = %23, %7
%27 = call i32 @fclose(i32* %5)
ret i32 undef
}