#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 pack();
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int unpack();
int main(int argc, char **argv) {
  if (argc == 2) {
    if (strcmp("pack", argv[1]) == 0) {
      return pack();
    }
    if (strcmp("unpack", argv[1]) == 0) {
      return unpack();
    }
  }
  fprintf(stderr, "Usage: %s (pack|unpack)\n", argv[0]);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11bf <main+0x7f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe93(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    118d <main+0x4d>
mov    $0x0,%al
call   1030 <pack@plt>
mov    %eax,-0x4(%rbp)
jmp    11e2 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe64(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11ba <main+0x7a>
mov    $0x0,%al
call   1040 <unpack@plt>
mov    %eax,-0x4(%rbp)
jmp    11e2 <main+0xa2>
jmp    11bf <main+0x7f>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe31(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1173 <main+0x33>
mov    0x8(%rbx),%rsi
lea    0xeae(%rip),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1192 <main+0x52>
mov    0x8(%rbx),%rsi
lea    0xe97(%rip),%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     119a <main+0x5a>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe81(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
jmp    1030 <pack@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <unpack@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"pack\00"
@.str.1 = [7 x i8] c"unpack\00"
@stderr = global i32 0
@.str.2 = [25 x i8] c"Usage: %s (pack|unpack)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %17
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 (...) @pack()
br label %21
11: ; preds = %4
%12 = load i8*, i8** %5
%13 = tail call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = tail call i32 (...) @unpack()
br label %21
17: ; preds = %11, %2
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %1
%20 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %17, %15, %9
%22 = phi i32 [ %10, %9 ], [ %16, %15 ], [ 1, %17 ]
ret i32 %22
}