#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 */

/* Variables and functions */
int ProcessOneFile(char *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  bool debugmode = false;
  if (argc == 3) {
    if (!((strcmp(argv[1], "--debug=ON") == 0) ||
          (strcmp(argv[1], "-d") == 0))) {
      fprintf(stderr,
              "Error! Correct usage: middlesplit [--debug=ON] argsfile\n");
      return 1;
    } else {
      debugmode = true;
    }
  } else if (argc != 2) {
    fprintf(stderr,
            "Error! Correct usage: middlesplit [--debug=ON] argsfile\n");
    return 1;
  }
  return ProcessOneFile(argv[2], debugmode);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11c0 <main+0x90>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11b4 <main+0x84>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe87(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11b4 <main+0x84>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xe6b(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1203 <main+0xd3>
movl   $0x1,-0x14(%rbp)
jmp    11f0 <main+0xc0>
cmpl   $0x2,-0x8(%rbp)
je     11eb <main+0xbb>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
lea    0xe34(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1203 <main+0xd3>
jmp    11f0 <main+0xc0>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1050 <ProcessOneFile@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1190 <main+0x60>
cmp    $0x3,%edi
jne    116f <main+0x3f>
mov    0x8(%rbx),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     1192 <main+0x62>
mov    0x8(%rbx),%rdi
lea    0xea6(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1192 <main+0x62>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %ebp,%ebp
mov    0x10(%rbx),%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <ProcessOneFile@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"--debug=ON\00"
@.str.1 = [3 x i8] c"-d\00"
@stderr = global i32 0
@.str.2 = [57 x i8] c"Error! Correct usage: middlesplit [--debug=ON] argsfile\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 3
br i1 %8, label %9, label %26
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %24, label %15
15: ; preds = %9
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %15
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %39
24: ; preds = %15, %9
store i32 1, i32* %6
br label %25
25: ; preds = %24
br label %33
26: ; preds = %2
%27 = load i32, i32* %4
%28 = icmp ne i32 %27, 2
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %39
32: ; preds = %26
br label %33
33: ; preds = %32, %25
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = load i32, i32* %6
%38 = call i32 @ProcessOneFile(i8* %36, i32 %37)
store i32 %38, i32* %3
br label %39
39: ; preds = %33, %29, %21
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str = [11 x i8] c"--debug=ON\00"
@.str.1 = [3 x i8] c"-d\00"
@stderr = global i32 0
@.str.2 = [57 x i8] c"Error! Correct usage: middlesplit [--debug=ON] argsfile\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %15 [
i32 3, label %3
i32 2, label %18
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %3
%9 = load i8*, i8** %4
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %8
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
br label %23
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
br label %23
18: ; preds = %2, %3, %8
%19 = phi i32 [ 1, %8 ], [ 1, %3 ], [ 0, %2 ]
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32 @ProcessOneFile(i8* %21, i32 %19)
br label %23
23: ; preds = %18, %15, %12
%24 = phi i32 [ %22, %18 ], [ 1, %12 ], [ 1, %15 ]
ret i32 %24
}