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

/* Variables and functions */
int /*<<< orphan*/ create_info(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ generate_hex_file(char *, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ print_usage(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  if (argc != 2 || strcmp(argv[1], "-h") == 0 ||
      strcmp(argv[1], "--help") == 0) {
    print_usage(argv[0]);
    exit(1);
  }
  uint8_t data_buf[(1024)];
  generate_hex_file(argv[1], data_buf, create_info(argv[1], data_buf));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    11a8 <main+0x58>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe85(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11a8 <main+0x58>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11be <main+0x6e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <print_usage@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x1020(%rbp)
lea    -0x1010(%rbp),%rax
mov    %rax,-0x1018(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x1010(%rbp),%rsi
call   1040 <create_info@plt>
mov    -0x1020(%rbp),%rdi
mov    -0x1018(%rbp),%rsi
mov    %eax,%edx
call   1050 <generate_hex_file@plt>
xor    %eax,%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1008,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    11b8 <main+0x68>
mov    0x8(%rbx),%rdi
lea    0xe93(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b8 <main+0x68>
mov    0x8(%rbx),%rdi
lea    0xe81(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b8 <main+0x68>
mov    0x8(%rbx),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <create_info@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1050 <generate_hex_file@plt>
xor    %eax,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r14
ret
mov    (%rbx),%rdi
call   1070 <print_usage@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [1024 x i32]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 2
br i1 %7, label %20, label %8
8: ; preds = %2
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %8
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %14, %8, %2
%21 = load i8**, i8*** %4
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @print_usage(i8* %23)
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %14
%27 = load i8**, i8*** %4
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = getelementptr inbounds [1024 x i32], [1024 x i32]* %5, i64 0, i64 0
%31 = load i8**, i8*** %4
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = getelementptr inbounds [1024 x i32], [1024 x i32]* %5, i64 0, i64 0
%35 = call i32 @create_info(i8* %33, i32* %34)
%36 = call i32 @generate_hex_file(i8* %29, i32* %30, i32 %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i32]
%4 = icmp eq i32 %0, 2
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = load i8*, i8** %6
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10, %5, %2
%15 = load i8*, i8** %1
%16 = tail call i32 @print_usage(i8* %15)
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %10
%19 = bitcast [1024 x i32]* %3 to i8*
%20 = load i8*, i8** %6
%21 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 0
%22 = call i32 @create_info(i8* %20, i32* %21)
%23 = call i32 @generate_hex_file(i8* %20, i32* %21, i32 %22)
ret i32 0
}