#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*/ pack(char *, char *);
int /*<<< orphan*/ showhelp();
int strlen(char *);
int /*<<< orphan*/ unpack(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 4 || argv[1][0] != '-' || strlen(argv[1]) != 2) {
    showhelp();
    return -1;
  }
  switch (argv[1][1]) {
  case 'p':
    pack(argv[2], argv[3]);
    break;
  case 'u':
    unpack(argv[2], argv[3]);
    break;
  default:
    showhelp();
    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)
cmpl   $0x4,-0x8(%rbp)
jne    118a <main+0x4a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    118a <main+0x4a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
je     119d <main+0x5d>
mov    $0x0,%al
call   1060 <showhelp@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1219 <main+0xd9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x70,%eax
je     11cb <main+0x8b>
jmp    11ba <main+0x7a>
mov    -0x14(%rbp),%eax
sub    $0x75,%eax
je     11e5 <main+0xa5>
jmp    11ff <main+0xbf>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <pack@plt>
jmp    1212 <main+0xd2>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1050 <unpack@plt>
jmp    1212 <main+0xd2>
mov    $0x0,%al
call   1060 <showhelp@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1219 <main+0xd9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x4,%edi
jne    117d <main+0x3d>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
cmpb   $0x2d,(%rdi)
jne    117d <main+0x3d>
call   1040 <strlen@plt>
cmp    $0x2,%eax
jne    117d <main+0x3d>
mov    0x8(%rbx),%rax
movsbl 0x1(%rax),%eax
cmp    $0x75,%eax
je     118b <main+0x4b>
cmp    $0x70,%eax
jne    117d <main+0x3d>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
call   1030 <pack@plt>
jmp    1198 <main+0x58>
xor    %eax,%eax
call   1060 <showhelp@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
call   1050 <unpack@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
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 ne i32 %6, 4
br i1 %7, label %22, label %8
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 45
br i1 %15, label %22, label %16
16: ; preds = %8
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strlen(i8* %19)
%21 = icmp ne i32 %20, 2
br i1 %21, label %22, label %24
22: ; preds = %16, %8, %2
%23 = call i32 (...) @showhelp()
store i32 -1, i32* %3
br label %50
24: ; preds = %16
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
switch i32 %30, label %47 [
i32 112, label %31
i32 117, label %39
]
31: ; preds = %24
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
%38 = call i32 @pack(i8* %34, i8* %37)
br label %49
39: ; preds = %24
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 3
%45 = load i8*, i8** %44
%46 = call i32 @unpack(i8* %42, i8* %45)
br label %49
47: ; preds = %24
%48 = call i32 (...) @showhelp()
store i32 -1, i32* %3
br label %50
49: ; preds = %39, %31
store i32 0, i32* %3
br label %50
50: ; preds = %49, %47, %22
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 45
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = tail call i32 @strlen(i8* %6)
%11 = icmp eq i32 %10, 2
br i1 %11, label %14, label %12
12: ; preds = %9, %4, %2
%13 = tail call i32 (...) @showhelp()
br label %33
14: ; preds = %9
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
switch i32 %18, label %31 [
i32 112, label %19
i32 117, label %25
]
19: ; preds = %14
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8*, i8** %1, i64 3
%23 = load i8*, i8** %22
%24 = tail call i32 @pack(i8* %21, i8* %23)
br label %33
25: ; preds = %14
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8*, i8** %1, i64 3
%29 = load i8*, i8** %28
%30 = tail call i32 @unpack(i8* %27, i8* %29)
br label %33
31: ; preds = %14
%32 = tail call i32 (...) @showhelp()
br label %33
33: ; preds = %19, %25, %31, %12
%34 = phi i32 [ -1, %12 ], [ -1, %31 ], [ 0, %25 ], [ 0, %19 ]
ret i32 %34
}