#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*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ section(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
main(int argc, char *argv[]) {
  FILE *in;
  char buf[510 + 2];
  if (argc != 2)
    return 1;
  in = fopen(argv[1], "rt");
  while (fgets(buf, 510, in))
    while (!strncmp(buf, "@section", 8))
      section(in, buf);
  fclose(in);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117f <main+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1212 <main+0xc2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe72(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x1fe,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1202 <main+0xb2>
jmp    11bb <main+0x6b>
lea    -0x220(%rbp),%rdi
lea    0xe3a(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e8 <main+0x98>
jmp    11fd <main+0xad>
mov    -0x18(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1060 <section@plt>
jmp    11bb <main+0x6b>
jmp    1197 <main+0x47>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x2,%edi
jne    11ea <main+0x9a>
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    0x8(%rsi),%rdi
lea    0xe8b(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0x1fe,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11d4 <main+0x84>
lea    0xe6a(%rip),%r14
mov    %rsp,%rbx
jmp    11ab <main+0x5b>
xchg   %ax,%ax
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <section@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11a0 <main+0x50>
mov    %rbx,%rdi
mov    $0x1fe,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
jne    11ab <main+0x5b>
mov    %r15,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rt\00"
@.str.1 = [9 x i8] c"@section\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [512 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %3
br label %35
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %6
br label %16
16: ; preds = %31, %11
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%18 = load i32*, i32** %6
%19 = call i64 @fgets(i8* %17, i32 510, i32* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %32
21: ; preds = %16
br label %22
22: ; preds = %27, %21
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%24 = call i32 @strncmp(i8* %23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%25 = icmp ne i32 %24, 0
%26 = xor i1 %25, true
br i1 %26, label %27, label %31
27: ; preds = %22
%28 = load i32*, i32** %6
%29 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%30 = call i32 @section(i32* %28, i8* %29)
br label %22
31: ; preds = %22
br label %16
32: ; preds = %16
%33 = load i32*, i32** %6
%34 = call i32 @fclose(i32* %33)
store i32 0, i32* %3
br label %35
35: ; preds = %32, %10
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@.str = [3 x i8] c"rt\00"
@.str.1 = [9 x i8] c"@section\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %6, label %24
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = call i64 @fgets(i8* %4, i32 510, i32* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %22, label %15
12: ; preds = %18, %15
%13 = call i64 @fgets(i8* %4, i32 510, i32* %9)
%14 = icmp eq i64 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %6, %12
%16 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %12
18: ; preds = %15, %18
%19 = call i32 @section(i32* %9, i8* %4)
%20 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%21 = icmp eq i32 %20, 0
br i1 %21, label %18, label %12
22: ; preds = %12, %6
%23 = call i32 @fclose(i32* %9)
br label %24
24: ; preds = %2, %22
%25 = phi i32 [ 0, %22 ], [ 1, %2 ]
ret i32 %25
}