#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 /*<<< orphan*/ generate_file(char *, char *, char);
int /*<<< orphan*/ print_usage(char *);
int main(int argc, char **argv) {
  char *output = argv[1];
  char use_define = 1;
  if (argc < 2) {
    print_usage(argv[0]);
    return 1;
  } else if (argc == 3) {
    output = argv[2];
  }
  generate_file(argv[1], output, use_define);
  return 0;
}


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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
movb   $0x1,-0x19(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1168 <main+0x48>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <print_usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    119f <main+0x7f>
cmpl   $0x3,-0x8(%rbp)
jne    117e <main+0x5e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1183 <main+0x63>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%rsi
movsbl -0x19(%rbp),%edx
call   1030 <generate_file@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jg     1135 <main+0x15>
mov    (%rsi),%rdi
call   1040 <print_usage@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
cmp    $0x3,%edi
sete   %al
mov    0x8(%rsi,%rax,8),%rax
mov    0x8(%rsi),%rdi
mov    %rax,%rsi
mov    $0x1,%edx
call   1030 <generate_file@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
store i8* %10, i8** %6
store i8 1, i8* %7
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @print_usage(i8* %16)
store i32 1, i32* %3
br label %33
18: ; preds = %2
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 3
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
store i8* %24, i8** %6
br label %25
25: ; preds = %21, %18
br label %26
26: ; preds = %25
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = load i8*, i8** %6
%31 = load i8, i8* %7
%32 = call i32 @generate_file(i8* %29, i8* %30, i8 signext %31)
store i32 0, i32* %3
br label %33
33: ; preds = %26, %13
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 @print_usage(i8* %6)
br label %15
8: ; preds = %2
%9 = icmp eq i32 %0, 3
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = select i1 %9, i8** %10, i8** %3
%12 = load i8*, i8** %11
%13 = load i8*, i8** %3
%14 = tail call i32 @generate_file(i8* %13, i8* %12, i8 signext 1)
br label %15
15: ; preds = %8, %5
%16 = phi i32 [ 1, %5 ], [ 0, %8 ]
ret i32 %16
}