#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 /*<<< orphan*/ mime_pack(char **, int);
int /*<<< orphan*/ mime_unpack(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  if (argc < 2) {
    mime_pack(argv + 1, argc - 1);
  } else if (!strcmp(argv[1], "-h")) {
    fprintf(stderr, "Usage: %s [-hlu | attachment1 attachment2...] < mail\n",
            argv[0]);
    return 1;
  } else if (!strcmp(argv[1], "-l"))
    mime_unpack(0);
  else if (!strcmp(argv[1], "-u"))
    mime_unpack(1);
  else
    mime_pack(argv + 1, argc - 1);
  return 0;
}


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)
jge    1178 <main+0x38>
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1030 <mime_pack@plt>
jmp    1234 <main+0xf4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe79(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11bd <main+0x7d>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe57(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    123b <main+0xfb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11e6 <main+0xa6>
xor    %edi,%edi
call   1060 <mime_unpack@plt>
jmp    122a <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe47(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1212 <main+0xd2>
mov    $0x1,%edi
call   1060 <mime_unpack@plt>
jmp    1225 <main+0xe5>
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1030 <mime_pack@plt>
jmp    122a <main+0xea>
jmp    122f <main+0xef>
jmp    1234 <main+0xf4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x8(%rsi),%r14
cmp    $0x1,%edi
jle    1192 <main+0x52>
mov    %rsi,%r12
mov    (%r14),%r15
lea    0xea0(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11a3 <main+0x63>
lea    0xec6(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11c3 <main+0x83>
lea    0xeb6(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11da <main+0x9a>
add    $0xffffffff,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <mime_pack@plt>
xor    %ebx,%ebx
jmp    11cc <main+0x8c>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%rdx
lea    0xe4c(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%ebx
jmp    11cc <main+0x8c>
xor    %ebx,%ebx
xor    %edi,%edi
call   1060 <mime_unpack@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    $0x1,%edi
call   1060 <mime_unpack@plt>
jmp    119f <main+0x5f>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@stderr = global i32 0
@.str.1 = [54 x i8] c"Usage: %s [-hlu | attachment1 attachment2...] < mail\0A\00"
@.str.2 = [3 x i8] c"-l\00"
@.str.3 = [3 x i8] c"-u\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 slt i32 %6, 2
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 1
%13 = call i32 @mime_pack(i8** %10, i32 %12)
br label %51
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %14
%21 = load i32, i32* @stderr
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i8* %24)
store i32 1, i32* %3
br label %52
26: ; preds = %14
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @strcmp(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%31 = icmp ne i32 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %26
%33 = call i32 @mime_unpack(i32 0)
br label %49
34: ; preds = %26
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i32 @strcmp(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp ne i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %34
%41 = call i32 @mime_unpack(i32 1)
br label %48
42: ; preds = %34
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i32, i32* %4
%46 = sub nsw i32 %45, 1
%47 = call i32 @mime_pack(i8** %44, i32 %46)
br label %48
48: ; preds = %42, %40
br label %49
49: ; preds = %48, %32
br label %50
50: ; preds = %49
br label %51
51: ; preds = %50, %8
store i32 0, i32* %3
br label %52
52: ; preds = %51, %20
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@stderr = global i32 0
@.str.1 = [54 x i8] c"Usage: %s [-hlu | attachment1 attachment2...] < mail\0A\00"
@.str.2 = [3 x i8] c"-l\00"
@.str.3 = [3 x i8] c"-u\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
br i1 %3, label %5, label %8
5: ; preds = %2
%6 = add nsw i32 %0, -1
%7 = tail call i32 @mime_pack(i8** %4, i32 %6)
br label %29
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %1
%15 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %29
16: ; preds = %8
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 @mime_unpack(i32 0)
br label %29
21: ; preds = %16
%22 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = tail call i32 @mime_unpack(i32 1)
br label %29
26: ; preds = %21
%27 = add nsw i32 %0, -1
%28 = tail call i32 @mime_pack(i8** %4, i32 %27)
br label %29
29: ; preds = %5, %19, %26, %24, %12
%30 = phi i32 [ 1, %12 ], [ 0, %24 ], [ 0, %26 ], [ 0, %19 ], [ 0, %5 ]
ret i32 %30
}