#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int genhdr(int, char **);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char *usage = "genhdr generate [args]";
  if (argc < 2) {
    goto usage;
  } else if (!strcmp(argv[1], "generate")) {
    return genhdr(argc - 1, &argv[1]);
  }
usage:
  fprintf(stderr, "usage: %s\n", usage);
  return 1;
}


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)
lea    0xeb3(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1160 <main+0x30>
jmp    11a2 <main+0x72>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1198 <main+0x68>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1050 <genhdr@plt>
mov    %eax,-0x4(%rbp)
jmp    11c2 <main+0x92>
jmp    119d <main+0x6d>
jmp    11a2 <main+0x72>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe6a(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     1151 <main+0x21>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
lea    0xecf(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1179 <main+0x49>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
lea    0xe98(%rip),%rdx
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
add    $0x8,%rbx
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <genhdr@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"genhdr generate [args]\00"
@.str.1 = [9 x i8] c"generate\00"
@stderr = global i32 0
@.str.2 = [11 x i8] c"usage: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %2
br label %24
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %10
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = call i32 @genhdr(i32 %18, i8** %20)
store i32 %21, i32* %3
br label %28
22: ; preds = %10
br label %23
23: ; preds = %22
br label %24
24: ; preds = %23, %9
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %6
%27 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %26)
store i32 1, i32* %3
br label %28
28: ; preds = %24, %16
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [23 x i8] c"genhdr generate [args]\00"
@.str.1 = [9 x i8] c"generate\00"
@stderr = global i32 0
@.str.2 = [11 x i8] c"usage: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = add nsw i32 %0, -1
%11 = tail call i32 @genhdr(i32 %10, i8** %5)
br label %15
12: ; preds = %4, %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %12, %9
%16 = phi i32 [ 1, %12 ], [ %11, %9 ]
ret i32 %16
}