#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 *, ...);
void main(int argc, char *argv[]) {
  if (argc <= 1)
    printf("No commandline arguement passed \n");
  else if (argc == 2)
    printf("You passed %s as commandline arguement \n", argv[1]);
  else
    printf("Too many command line arguements \n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jg     113c <main+0x2c>
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1174 <main+0x64>
cmpl   $0x2,-0x4(%rbp)
jne    1161 <main+0x51>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116f <main+0x5f>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1174 <main+0x64>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x1,%edi
jg     1131 <main+0x11>
lea    0xf1f(%rip),%rdi
jmp    1030 <puts@plt>
cmp    $0x2,%edi
jne    1148 <main+0x28>
mov    0x8(%rsi),%rsi
lea    0xebf(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xeda(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"No commandline arguement passed \0A\00"
@.str.1 = [41 x i8] c"You passed %s as commandline arguement \0A\00"
@.str.2 = [35 x i8] c"Too many command line arguements \0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %20
9: ; preds = %2
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %19
17: ; preds = %9
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %12
br label %20
20: ; preds = %19, %7
ret void
}

LLVM IR (-O2):
@.str.1 = [41 x i8] c"You passed %s as commandline arguement \0A\00"
@str = [34 x i8] c"Too many command line arguements \00"
@str.3 = [33 x i8] c"No commandline arguement passed \00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
br label %14
6: ; preds = %2
%7 = icmp eq i32 %0, 2
br i1 %7, label %8, label %12
8: ; preds = %6
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %14
12: ; preds = %6
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %8, %12, %4
ret void
}