#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*/ create_lar_from_config(char const *, char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt(int, char **, char *);
char *optarg;
int optind;
int /*<<< orphan*/ pbuilder_show_lar(char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  char *config = NULL;
  while (1) {
    signed ch = getopt(argc, argv, "c:");
    if (ch == -1)
      break;
    switch (ch) {
    case 'c':
      config = optarg;
      break;
    default:
      usage();
      return -1;
    }
  }
  if (optind >= argc) {
    usage();
    return 0;
  }
  if (!strcmp(argv[optind], "create")) {
    if (config == NULL) {
      fprintf(stderr, "E: No config was provided\n");
      usage();
      return -1;
    }
    if (optind + 1 >= argc) {
      fprintf(stderr, "E: No LAR name was given\n");
      usage();
      return -1;
    }
    create_lar_from_config((const char *)config,
                           (const char *)argv[optind + 1]);
  } else if (!strcmp(argv[optind], "show")) {
    if (optind + 1 >= argc) {
      fprintf(stderr, "E: No LAR name was given\n");
      usage();
      return -1;
    }
    pbuilder_show_lar((const char *)argv[optind + 1]);
  } else {
    usage();
    return -1;
  }
  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)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe74(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    11a3 <main+0x43>
jmp    11df <main+0x7f>
mov    -0x1c(%rbp),%eax
sub    $0x63,%eax
jne    11c7 <main+0x67>
jmp    11b4 <main+0x54>
mov    0x2e3d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    11da <main+0x7a>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1364 <main+0x204>
jmp    117e <main+0x1e>
mov    0x2dfa(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jl     1204 <main+0xa4>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1364 <main+0x204>
mov    -0x10(%rbp),%rax
mov    0x2dd1(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xde6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    12c0 <main+0x160>
cmpq   $0x0,-0x18(%rbp)
jne    125e <main+0xfe>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
lea    0xdc4(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1364 <main+0x204>
mov    0x2d7b(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jl     129b <main+0x13b>
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
lea    0xda2(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1364 <main+0x204>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x2d36(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <create_lar_from_config@plt>
jmp    135d <main+0x1fd>
mov    -0x10(%rbp),%rax
mov    0x2d15(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd66(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1345 <main+0x1e5>
mov    0x2cf2(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jl     1324 <main+0x1c4>
mov    0x2ccd(%rip),%rax
mov    (%rax),%edi
lea    0xd19(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1364 <main+0x204>
mov    -0x10(%rbp),%rax
mov    0x2cb1(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1080 <pbuilder_show_lar@plt>
jmp    1358 <main+0x1f8>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1364 <main+0x204>
jmp    135d <main+0x1fd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebx,%ebx
lea    0xe89(%rip),%rbp
mov    0x2e7a(%rip),%r12
xchg   %ax,%ax
mov    %r15d,%edi
mov    %r14,%rsi
mov    %rbp,%rdx
call   1070 <getopt@plt>
cmp    $0x63,%eax
jne    1199 <main+0x39>
mov    (%r12),%rbx
jmp    1180 <main+0x20>
cmp    $0xffffffff,%eax
jne    1240 <main+0xe0>
mov    0x2e37(%rip),%rax
movslq (%rax),%rbp
cmp    %r15d,%ebp
jge    11f0 <main+0x90>
mov    (%r14,%rbp,8),%r12
lea    0xe47(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11fb <main+0x9b>
lea    0xe70(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1240 <main+0xe0>
lea    0x1(%rbp),%eax
cmp    %r15d,%eax
jge    1219 <main+0xb9>
cltq
mov    (%r14,%rax,8),%rdi
call   1080 <pbuilder_show_lar@plt>
jmp    1215 <main+0xb5>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <usage@plt>
jmp    124c <main+0xec>
test   %rbx,%rbx
je     122b <main+0xcb>
lea    0x1(%rbp),%eax
cmp    %r15d,%eax
jge    1219 <main+0xb9>
mov    0x8(%r14,%rbp,8),%rsi
mov    %rbx,%rdi
call   1030 <create_lar_from_config@plt>
xor    %ebx,%ebx
jmp    124c <main+0xec>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xdfc(%rip),%rsi
jmp    123b <main+0xdb>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
lea    0xdcf(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1060 <usage@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"c:\00"
@optarg = global i8* null
@optind = global i32 0
@.str.1 = [7 x i8] c"create\00"
@stderr = global i32 0
@.str.2 = [27 x i8] c"E: No config was provided\0A\00"
@.str.3 = [26 x i8] c"E: No LAR name was given\0A\00"
@.str.4 = [5 x i8] c"show\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
br label %8
8: ; preds = %2, %21
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %8
br label %22
15: ; preds = %8
%16 = load i32, i32* %7
switch i32 %16, label %19 [
i32 99, label %17
]
17: ; preds = %15
%18 = load i8*, i8** @optarg
store i8* %18, i8** %6
br label %21
19: ; preds = %15
%20 = call i32 (...) @usage()
store i32 -1, i32* %3
br label %90
21: ; preds = %17
br label %8
22: ; preds = %14
%23 = load i32, i32* @optind
%24 = load i32, i32* %4
%25 = icmp sge i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 (...) @usage()
store i32 0, i32* %3
br label %90
28: ; preds = %22
%29 = load i8**, i8*** %5
%30 = load i32, i32* @optind
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 @strcmp(i8* %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp ne i32 %34, 0
br i1 %35, label %61, label %36
36: ; preds = %28
%37 = load i8*, i8** %6
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%42 = call i32 (...) @usage()
store i32 -1, i32* %3
br label %90
43: ; preds = %36
%44 = load i32, i32* @optind
%45 = add nsw i32 %44, 1
%46 = load i32, i32* %4
%47 = icmp sge i32 %45, %46
br i1 %47, label %48, label %52
48: ; preds = %43
%49 = load i32, i32* @stderr
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%51 = call i32 (...) @usage()
store i32 -1, i32* %3
br label %90
52: ; preds = %43
%53 = load i8*, i8** %6
%54 = load i8**, i8*** %5
%55 = load i32, i32* @optind
%56 = add nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %54, i64 %57
%59 = load i8*, i8** %58
%60 = call i32 @create_lar_from_config(i8* %53, i8* %59)
br label %89
61: ; preds = %28
%62 = load i8**, i8*** %5
%63 = load i32, i32* @optind
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %62, i64 %64
%66 = load i8*, i8** %65
%67 = call i32 @strcmp(i8* %66, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%68 = icmp ne i32 %67, 0
br i1 %68, label %86, label %69
69: ; preds = %61
%70 = load i32, i32* @optind
%71 = add nsw i32 %70, 1
%72 = load i32, i32* %4
%73 = icmp sge i32 %71, %72
br i1 %73, label %74, label %78
74: ; preds = %69
%75 = load i32, i32* @stderr
%76 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%77 = call i32 (...) @usage()
store i32 -1, i32* %3
br label %90
78: ; preds = %69
%79 = load i8**, i8*** %5
%80 = load i32, i32* @optind
%81 = add nsw i32 %80, 1
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8*, i8** %79, i64 %82
%84 = load i8*, i8** %83
%85 = call i32 @pbuilder_show_lar(i8* %84)
br label %88
86: ; preds = %61
%87 = call i32 (...) @usage()
store i32 -1, i32* %3
br label %90
88: ; preds = %78
br label %89
89: ; preds = %88, %52
store i32 0, i32* %3
br label %90
90: ; preds = %89, %86, %74, %48, %39, %26, %19
%91 = load i32, i32* %3
ret i32 %91
}

LLVM IR (-O2):
@.str = [3 x i8] c"c:\00"
@optarg = global i8* null
@optind = global i32 0
@.str.1 = [7 x i8] c"create\00"
@stderr = global i32 0
@.str.2 = [27 x i8] c"E: No config was provided\0A\00"
@.str.3 = [26 x i8] c"E: No LAR name was given\0A\00"
@.str.4 = [5 x i8] c"show\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ null, %2 ], [ %9, %8 ]
%5 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %5, label %6 [
i32 -1, label %10
i32 99, label %8
]
6: ; preds = %3
%7 = tail call i32 (...) @usage()
br label %56
8: ; preds = %3
%9 = load i8*, i8** @optarg
br label %3
10: ; preds = %3
%11 = load i32, i32* @optind
%12 = icmp slt i32 %11, %0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (...) @usage()
br label %56
15: ; preds = %10
%16 = sext i32 %11 to i64
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %39
21: ; preds = %15
%22 = icmp eq i8* %4, null
br i1 %22, label %23, label %27
23: ; preds = %21
%24 = load i32, i32* @stderr
%25 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%26 = tail call i32 (...) @usage()
br label %56
27: ; preds = %21
%28 = add nsw i32 %11, 1
%29 = icmp slt i32 %28, %0
br i1 %29, label %34, label %30
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = tail call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%33 = tail call i32 (...) @usage()
br label %56
34: ; preds = %27
%35 = sext i32 %28 to i64
%36 = getelementptr inbounds i8*, i8** %1, i64 %35
%37 = load i8*, i8** %36
%38 = tail call i32 @create_lar_from_config(i8* %4, i8* %37)
br label %56
39: ; preds = %15
%40 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %54
42: ; preds = %39
%43 = add nsw i32 %11, 1
%44 = icmp slt i32 %43, %0
br i1 %44, label %49, label %45
45: ; preds = %42
%46 = load i32, i32* @stderr
%47 = tail call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%48 = tail call i32 (...) @usage()
br label %56
49: ; preds = %42
%50 = sext i32 %43 to i64
%51 = getelementptr inbounds i8*, i8** %1, i64 %50
%52 = load i8*, i8** %51
%53 = tail call i32 @pbuilder_show_lar(i8* %52)
br label %56
54: ; preds = %39
%55 = tail call i32 (...) @usage()
br label %56
56: ; preds = %6, %34, %49, %54, %45, %30, %23, %13
%57 = phi i32 [ 0, %13 ], [ -1, %54 ], [ -1, %45 ], [ -1, %23 ], [ -1, %30 ], [ 0, %49 ], [ 0, %34 ], [ -1, %6 ]
ret i32 %57
}