#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*/ one_argument(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ two_arguments(char *, char *);
int main(int argc, char *argv[]) {
  switch (argc) {
  case 1:
    printf("Usage:\n");
    printf("0 parameters - this message.\n");
    printf("1 parameter  - display uncompressed size.\n");
    printf("2 parameters - extract arg1 into arg2.\n");
    break;
  case 2:
    one_argument(argv[1]);
    break;
  case 3:
    two_arguments(argv[1], argv[2]);
    break;
  default:
    printf("Too many command line parameters.\n");
  }
  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)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     117c <main+0x4c>
jmp    115a <main+0x2a>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     11b1 <main+0x81>
jmp    116b <main+0x3b>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     11c3 <main+0x93>
jmp    11dd <main+0xad>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <main+0xb9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <one_argument@plt>
jmp    11e9 <main+0xb9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1040 <two_arguments@plt>
jmp    11e9 <main+0xb9>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x3,%edi
je     116d <main+0x3d>
cmp    $0x2,%edi
je     117c <main+0x4c>
cmp    $0x1,%edi
jne    1187 <main+0x57>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
jmp    118e <main+0x5e>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1040 <two_arguments@plt>
jmp    1193 <main+0x63>
mov    0x8(%rsi),%rdi
call   1050 <one_argument@plt>
jmp    1193 <main+0x63>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [30 x i8] c"0 parameters - this message.\0A\00"
@.str.2 = [43 x i8] c"1 parameter - display uncompressed size.\0A\00"
@.str.3 = [40 x i8] c"2 parameters - extract arg1 into arg2.\0A\00"
@.str.4 = [35 x i8] c"Too many command line parameters.\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
switch i32 %6, label %25 [
i32 1, label %7
i32 2, label %12
i32 3, label %17
]
7: ; preds = %2
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
br label %27
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @one_argument(i8* %15)
br label %27
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @two_arguments(i8* %20, i8* %23)
br label %27
25: ; preds = %2
%26 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25, %17, %12, %7
ret i32 0
}

LLVM IR (-O2):
@str = [7 x i8] c"Usage:\00"
@str.5 = [29 x i8] c"0 parameters - this message.\00"
@str.6 = [42 x i8] c"1 parameter - display uncompressed size.\00"
@str.7 = [39 x i8] c"2 parameters - extract arg1 into arg2.\00"
@str.8 = [34 x i8] c"Too many command line parameters.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %18 [
i32 1, label %3
i32 2, label %8
i32 3, label %12
]
3: ; preds = %2
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.6, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.7, i64 0, i64 0))
br label %20
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @one_argument(i8* %10)
br label %20
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @two_arguments(i8* %14, i8* %16)
br label %20
18: ; preds = %2
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.8, i64 0, i64 0))
br label %20
20: ; preds = %18, %12, %8, %3
ret i32 0
}