#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*/ printf(char *, ...);
int main(int argc, char **argv) {
  switch (argc) {
  case 1:
    printf("No arguments\n");
    return 0;
  case 2:
    printf("arg = %s\n", argv[1]);
    break;
  default:
    printf("More than 1 argument\n");
    break;
  }
  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     114b <main+0x3b>
jmp    113a <main+0x2a>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1165 <main+0x55>
jmp    1180 <main+0x70>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1195 <main+0x85>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118e <main+0x7e>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
je     1134 <main+0x14>
cmp    $0x1,%edi
jne    1148 <main+0x28>
lea    0xed8(%rip),%rdi
jmp    114f <main+0x2f>
mov    0x8(%rsi),%rsi
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1154 <main+0x34>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"No arguments\0A\00"
@.str.1 = [10 x i8] c"arg = %s\0A\00"
@.str.2 = [22 x i8] c"More than 1 argument\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 %14 [
i32 1, label %7
i32 2, label %9
]
7: ; preds = %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %17
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %9
store i32 0, i32* %3
br label %17
17: ; preds = %16, %7
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"arg = %s\0A\00"
@str = [13 x i8] c"No arguments\00"
@str.3 = [21 x i8] c"More than 1 argument\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %9 [
i32 1, label %3
i32 2, label %5
]
3: ; preds = %2
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %11
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %11
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.3, i64 0, i64 0))
br label %11
11: ; preds = %5, %9, %3
ret i32 0
}