#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 */
struct device_info {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ build_image(char const *, char const *, char const *,
                               unsigned int, int, int,
                               struct device_info const *);
int /*<<< orphan*/ exit(int);
struct device_info *find_board(char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int getopt(int, char **, char *);
char *optarg;
int /*<<< orphan*/ set_source_date_epoch();
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  const char *board = NULL, *kernel_image = NULL, *rootfs_image = NULL,
             *output = NULL;
  bool add_jffs2_eof = false, sysupgrade = false;
  unsigned rev = 0;
  const struct device_info *info;
  set_source_date_epoch();
  while (true) {
    int c;
    c = getopt(argc, argv, "B:k:r:o:V:jSh");
    if (c == -1)
      break;
    switch (c) {
    case 'B':
      board = optarg;
      break;
    case 'k':
      kernel_image = optarg;
      break;
    case 'r':
      rootfs_image = optarg;
      break;
    case 'o':
      output = optarg;
      break;
    case 'V':
      sscanf(optarg, "r%u", &rev);
      break;
    case 'j':
      add_jffs2_eof = true;
      break;
    case 'S':
      sysupgrade = true;
      break;
    case 'h':
      usage(argv[0]);
      return 0;
    default:
      usage(argv[0]);
      return 1;
    }
  }
  if (!board)
    do {
      fprintf(stderr,
              "no board has been specified"
              ": %s\n",
              strerror(0));
      if (1)
        exit(1);
    } while (0);
  if (!kernel_image)
    do {
      fprintf(stderr,
              "no kernel image has been specified"
              ": %s\n",
              strerror(0));
      if (1)
        exit(1);
    } while (0);
  if (!rootfs_image)
    do {
      fprintf(stderr,
              "no rootfs image has been specified"
              ": %s\n",
              strerror(0));
      if (1)
        exit(1);
    } while (0);
  if (!output)
    do {
      fprintf(stderr,
              "no output filename has been specified"
              ": %s\n",
              strerror(0));
      if (1)
        exit(1);
    } while (0);
  info = find_board(board);
  if (info == NULL)
    do {
      fprintf(stderr,
              "unsupported board %s"
              ": %s\n",
              board, strerror(0));
      if (1)
        exit(1);
    } while (0);
  build_image(output, kernel_image, rootfs_image, rev, add_jffs2_eof,
              sysupgrade, info);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    $0x0,%al
call   10b0 <set_source_date_epoch@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xed1(%rip),%rdx
call   1080 <getopt@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0xffffffff,-0x4c(%rbp)
jne    120a <main+0x7a>
jmp    12eb <main+0x15b>
mov    -0x4c(%rbp),%eax
add    $0xffffffbe,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0x30,%eax
ja     12ce <main+0x13e>
mov    -0x58(%rbp),%rax
lea    0xdd6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2dbe(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    12e6 <main+0x156>
mov    0x2dab(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    12e6 <main+0x156>
mov    0x2d98(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    12e6 <main+0x156>
mov    0x2d85(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    12e6 <main+0x156>
mov    0x2d72(%rip),%rax
mov    (%rax),%rdi
lea    0xe42(%rip),%rsi
lea    -0x3c(%rbp),%rdx
call   1050 <sscanf@plt>
jmp    12e6 <main+0x156>
movl   $0x1,-0x34(%rbp)
jmp    12e6 <main+0x156>
movl   $0x1,-0x38(%rbp)
jmp    12e6 <main+0x156>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1474 <main+0x2e4>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    1474 <main+0x2e4>
jmp    11e5 <main+0x55>
cmpq   $0x0,-0x18(%rbp)
jne    132c <main+0x19c>
jmp    12fb <main+0x16b>
mov    0x2cd6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
xor    %edi,%edi
call   10a0 <strerror@plt>
mov    -0x5c(%rbp),%edi
mov    %rax,%rdx
lea    0xdbb(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
cmpq   $0x0,-0x20(%rbp)
jne    136d <main+0x1dd>
jmp    133c <main+0x1ac>
mov    0x2c95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
xor    %edi,%edi
call   10a0 <strerror@plt>
mov    -0x60(%rbp),%edi
mov    %rax,%rdx
lea    0xd9b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
cmpq   $0x0,-0x28(%rbp)
jne    13ae <main+0x21e>
jmp    137d <main+0x1ed>
mov    0x2c54(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
xor    %edi,%edi
call   10a0 <strerror@plt>
mov    -0x64(%rbp),%edi
mov    %rax,%rdx
lea    0xd82(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
cmpq   $0x0,-0x30(%rbp)
jne    13ef <main+0x25f>
jmp    13be <main+0x22e>
mov    0x2c13(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
xor    %edi,%edi
call   10a0 <strerror@plt>
mov    -0x68(%rbp),%edi
mov    %rax,%rdx
lea    0xd69(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1060 <find_board@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1449 <main+0x2b9>
jmp    140c <main+0x27c>
mov    0x2bc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x70(%rbp)
xor    %edi,%edi
call   10a0 <strerror@plt>
mov    -0x74(%rbp),%edi
mov    -0x70(%rbp),%rdx
mov    %rax,%rcx
lea    0xd3a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x38(%rbp),%r9d
mov    -0x48(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <build_image@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r15
mov    %edi,%r12d
movl   $0x0,0x14(%rsp)
xor    %eax,%eax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
call   10b0 <set_source_date_epoch@plt>
lea    0xf03(%rip),%r14
mov    0x2e30(%rip),%rbx
lea    0xf03(%rip),%r13
lea    0x14(%rsp),%rbp
xor    %eax,%eax
mov    %rax,0x20(%rsp)
movl   $0x0,0x10(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
mov    %rax,0x30(%rsp)
jmp    120e <main+0x7e>
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
call   1050 <sscanf@plt>
mov    %r12d,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1080 <getopt@plt>
cmp    $0x56,%eax
je     1200 <main+0x70>
lea    -0x42(%rax),%ecx
cmp    $0x30,%ecx
ja     1275 <main+0xe5>
lea    0xdd0(%rip),%rdx
movslq (%rdx,%rcx,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    (%rbx),%rax
mov    %rax,0x30(%rsp)
jmp    120e <main+0x7e>
movl   $0x1,0xc(%rsp)
jmp    120e <main+0x7e>
movl   $0x1,0x10(%rsp)
jmp    120e <main+0x7e>
mov    (%rbx),%rax
mov    %rax,0x28(%rsp)
jmp    120e <main+0x7e>
mov    (%rbx),%rax
mov    %rax,0x18(%rsp)
jmp    120e <main+0x7e>
mov    (%rbx),%rax
mov    %rax,0x20(%rsp)
jmp    120e <main+0x7e>
cmp    $0xffffffff,%eax
jne    12e5 <main+0x155>
mov    0x30(%rsp),%r14
test   %r14,%r14
je     130d <main+0x17d>
mov    0x28(%rsp),%rbx
test   %rbx,%rbx
mov    0x20(%rsp),%r15
mov    0x18(%rsp),%rbp
je     1326 <main+0x196>
test   %r15,%r15
je     133f <main+0x1af>
test   %rbp,%rbp
je     1358 <main+0x1c8>
mov    %r14,%rdi
call   1060 <find_board@plt>
test   %rax,%rax
je     1385 <main+0x1f5>
mov    0x14(%rsp),%ecx
mov    %rax,(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    0x10(%rsp),%r8d
mov    0xc(%rsp),%r9d
call   1030 <build_image@plt>
jmp    12fc <main+0x16c>
mov    (%r15),%rdi
call   1070 <usage@plt>
mov    $0x1,%eax
jmp    12fe <main+0x16e>
mov    (%r15),%rdi
call   1070 <usage@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cc4(%rip),%rax
mov    (%rax),%ebx
xor    %edi,%edi
call   10a0 <strerror@plt>
lea    0xdb2(%rip),%rsi
jmp    136f <main+0x1df>
mov    0x2cab(%rip),%rax
mov    (%rax),%ebx
xor    %edi,%edi
call   10a0 <strerror@plt>
lea    0xdba(%rip),%rsi
jmp    136f <main+0x1df>
mov    0x2c92(%rip),%rax
mov    (%rax),%ebx
xor    %edi,%edi
call   10a0 <strerror@plt>
lea    0xdc9(%rip),%rsi
jmp    136f <main+0x1df>
mov    0x2c79(%rip),%rax
mov    (%rax),%ebx
xor    %edi,%edi
call   10a0 <strerror@plt>
lea    0xdd8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2c4c(%rip),%rax
mov    (%rax),%ebx
xor    %edi,%edi
call   10a0 <strerror@plt>
lea    0xdd6(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.device_info = type { i32 }
@.str = [14 x i8] c"B:k:r:o:V:jSh\00"
@optarg = global i8* null
@.str.1 = [4 x i8] c"r%u\00"
@stderr = global i32 0
@.str.2 = [33 x i8] c"no board has been specified: %s\0A\00"
@.str.3 = [40 x i8] c"no kernel image has been specified: %s\0A\00"
@.str.4 = [40 x i8] c"no rootfs image has been specified: %s\0A\00"
@.str.5 = [43 x i8] c"no output filename has been specified: %s\0A\00"
@.str.6 = [26 x i8] c"unsupported board %s: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.device_info*
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
%15 = call i32 (...) @set_source_date_epoch()
br label %16
16: ; preds = %2, %48
%17 = load i32, i32* %4
%18 = load i8**, i8*** %5
%19 = call i32 @getopt(i32 %17, i8** %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 %19, i32* %14
%20 = load i32, i32* %14
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %23
22: ; preds = %16
br label %49
23: ; preds = %16
%24 = load i32, i32* %14
switch i32 %24, label %43 [
i32 66, label %25
i32 107, label %27
i32 114, label %29
i32 111, label %31
i32 86, label %33
i32 106, label %36
i32 83, label %37
i32 104, label %38
]
25: ; preds = %23
%26 = load i8*, i8** @optarg
store i8* %26, i8** %6
br label %48
27: ; preds = %23
%28 = load i8*, i8** @optarg
store i8* %28, i8** %7
br label %48
29: ; preds = %23
%30 = load i8*, i8** @optarg
store i8* %30, i8** %8
br label %48
31: ; preds = %23
%32 = load i8*, i8** @optarg
store i8* %32, i8** %9
br label %48
33: ; preds = %23
%34 = load i8*, i8** @optarg
%35 = call i32 @sscanf(i8* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %12)
br label %48
36: ; preds = %23
store i32 1, i32* %10
br label %48
37: ; preds = %23
store i32 1, i32* %11
br label %48
38: ; preds = %23
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = call i32 @usage(i8* %41)
store i32 0, i32* %3
br label %111
43: ; preds = %23
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = call i32 @usage(i8* %46)
store i32 1, i32* %3
br label %111
48: ; preds = %37, %36, %33, %31, %29, %27, %25
br label %16
49: ; preds = %22
%50 = load i8*, i8** %6
%51 = icmp ne i8* %50, null
br i1 %51, label %59, label %52
52: ; preds = %49
br label %53
53: ; preds = %52
%54 = load i32, i32* @stderr
%55 = call i8* @strerror(i32 0)
%56 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %55)
%57 = call i32 @exit(i32 1)
unreachable
58: ; No predecessors!
br label %59
59: ; preds = %58, %49
%60 = load i8*, i8** %7
%61 = icmp ne i8* %60, null
br i1 %61, label %69, label %62
62: ; preds = %59
br label %63
63: ; preds = %62
%64 = load i32, i32* @stderr
%65 = call i8* @strerror(i32 0)
%66 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %65)
%67 = call i32 @exit(i32 1)
unreachable
68: ; No predecessors!
br label %69
69: ; preds = %68, %59
%70 = load i8*, i8** %8
%71 = icmp ne i8* %70, null
br i1 %71, label %79, label %72
72: ; preds = %69
br label %73
73: ; preds = %72
%74 = load i32, i32* @stderr
%75 = call i8* @strerror(i32 0)
%76 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %75)
%77 = call i32 @exit(i32 1)
unreachable
78: ; No predecessors!
br label %79
79: ; preds = %78, %69
%80 = load i8*, i8** %9
%81 = icmp ne i8* %80, null
br i1 %81, label %89, label %82
82: ; preds = %79
br label %83
83: ; preds = %82
%84 = load i32, i32* @stderr
%85 = call i8* @strerror(i32 0)
%86 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i8* %85)
%87 = call i32 @exit(i32 1)
unreachable
88: ; No predecessors!
br label %89
89: ; preds = %88, %79
%90 = load i8*, i8** %6
%91 = call %struct.device_info* @find_board(i8* %90)
store %struct.device_info* %91, %struct.device_info** %13
%92 = load %struct.device_info*, %struct.device_info** %13
%93 = icmp eq %struct.device_info* %92, null
br i1 %93, label %94, label %102
94: ; preds = %89
br label %95
95: ; preds = %94
%96 = load i32, i32* @stderr
%97 = load i8*, i8** %6
%98 = call i8* @strerror(i32 0)
%99 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %97, i8* %98)
%100 = call i32 @exit(i32 1)
unreachable
101: ; No predecessors!
br label %102
102: ; preds = %101, %89
%103 = load i8*, i8** %9
%104 = load i8*, i8** %7
%105 = load i8*, i8** %8
%106 = load i32, i32* %12
%107 = load i32, i32* %10
%108 = load i32, i32* %11
%109 = load %struct.device_info*, %struct.device_info** %13
%110 = call i32 @build_image(i8* %103, i8* %104, i8* %105, i32 %106, i32 %107, i32 %108, %struct.device_info* %109)
store i32 0, i32* %3
br label %111
111: ; preds = %102, %43, %38
%112 = load i32, i32* %3
ret i32 %112
}

LLVM IR (-O2):
%struct.device_info = type { i32 }
@.str = [14 x i8] c"B:k:r:o:V:jSh\00"
@optarg = global i8* null
@.str.1 = [4 x i8] c"r%u\00"
@stderr = global i32 0
@.str.2 = [33 x i8] c"no board has been specified: %s\0A\00"
@.str.3 = [40 x i8] c"no kernel image has been specified: %s\0A\00"
@.str.4 = [40 x i8] c"no rootfs image has been specified: %s\0A\00"
@.str.5 = [43 x i8] c"no output filename has been specified: %s\0A\00"
@.str.6 = [26 x i8] c"unsupported board %s: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = tail call i32 (...) @set_source_date_epoch()
br label %6
6: ; preds = %37, %2
%7 = phi i8* [ %38, %37 ], [ null, %2 ]
%8 = phi i8* [ %14, %37 ], [ null, %2 ]
%9 = phi i8* [ %20, %37 ], [ null, %2 ]
%10 = phi i32 [ %25, %37 ], [ 0, %2 ]
%11 = phi i32 [ %29, %37 ], [ 0, %2 ]
%12 = phi i8* [ %32, %37 ], [ null, %2 ]
br label %13
13: ; preds = %6, %39
%14 = phi i8* [ %8, %6 ], [ %40, %39 ]
%15 = phi i8* [ %9, %6 ], [ %20, %39 ]
%16 = phi i32 [ %10, %6 ], [ %25, %39 ]
%17 = phi i32 [ %11, %6 ], [ %29, %39 ]
%18 = phi i8* [ %12, %6 ], [ %32, %39 ]
br label %19
19: ; preds = %13, %41
%20 = phi i8* [ %15, %13 ], [ %42, %41 ]
%21 = phi i32 [ %16, %13 ], [ %25, %41 ]
%22 = phi i32 [ %17, %13 ], [ %29, %41 ]
%23 = phi i8* [ %18, %13 ], [ %32, %41 ]
br label %24
24: ; preds = %33, %19
%25 = phi i32 [ %21, %19 ], [ 1, %33 ]
%26 = phi i32 [ %22, %19 ], [ %29, %33 ]
%27 = phi i8* [ %23, %19 ], [ %32, %33 ]
br label %28
28: ; preds = %33, %24
%29 = phi i32 [ %26, %24 ], [ 1, %33 ]
%30 = phi i8* [ %27, %24 ], [ %32, %33 ]
br label %31
31: ; preds = %28, %35
%32 = phi i8* [ %30, %28 ], [ %36, %35 ]
br label %33
33: ; preds = %31, %43
%34 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
switch i32 %34, label %49 [
i32 -1, label %52
i32 66, label %35
i32 107, label %37
i32 114, label %39
i32 111, label %41
i32 86, label %43
i32 106, label %24
i32 83, label %28
i32 104, label %46
]
35: ; preds = %33
%36 = load i8*, i8** @optarg
br label %31
37: ; preds = %33
%38 = load i8*, i8** @optarg
br label %6
39: ; preds = %33
%40 = load i8*, i8** @optarg
br label %13
41: ; preds = %33
%42 = load i8*, i8** @optarg
br label %19
43: ; preds = %33
%44 = load i8*, i8** @optarg
%45 = call i32 @sscanf(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %33
46: ; preds = %33
%47 = load i8*, i8** %1
%48 = call i32 @usage(i8* %47)
br label %91
49: ; preds = %33
%50 = load i8*, i8** %1
%51 = call i32 @usage(i8* %50)
br label %91
52: ; preds = %33
%53 = icmp eq i8* %32, null
br i1 %53, label %54, label %59
54: ; preds = %52
%55 = load i32, i32* @stderr
%56 = call i8* @strerror(i32 0)
%57 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %52
%60 = icmp eq i8* %7, null
br i1 %60, label %61, label %66
61: ; preds = %59
%62 = load i32, i32* @stderr
%63 = call i8* @strerror(i32 0)
%64 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %63)
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %59
%67 = icmp eq i8* %14, null
br i1 %67, label %68, label %73
68: ; preds = %66
%69 = load i32, i32* @stderr
%70 = call i8* @strerror(i32 0)
%71 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %70)
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %66
%74 = icmp eq i8* %20, null
br i1 %74, label %75, label %80
75: ; preds = %73
%76 = load i32, i32* @stderr
%77 = call i8* @strerror(i32 0)
%78 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i8* %77)
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %73
%81 = call %struct.device_info* @find_board(i8* %32)
%82 = icmp eq %struct.device_info* %81, null
br i1 %82, label %83, label %88
83: ; preds = %80
%84 = load i32, i32* @stderr
%85 = call i8* @strerror(i32 0)
%86 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %32, i8* %85)
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %80
%89 = load i32, i32* %3
%90 = call i32 @build_image(i8* %20, i8* %7, i8* %14, i32 %89, i32 %25, i32 %29, %struct.device_info* %81)
br label %91
91: ; preds = %46, %49, %88
%92 = phi i32 [ 0, %88 ], [ 0, %46 ], [ 1, %49 ]
ret i32 %92
}