#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 *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  if (argc != 1 + 1) {
    fprintf(stderr, "Error! Expected %d param\n", 1);
    return 1;
  }
  if (strcmp(argv[1], "test_arg") != 0) {
    fprintf(stderr, "Error! Expected %s\n", "test_arg");
    return 2;
  }
  fputs("OK!\n", stdout);
  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)
je     1178 <main+0x48>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11dc <main+0xac>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe93(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11c0 <main+0x90>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
lea    0xe6d(%rip),%rdx
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    11dc <main+0xac>
mov    0x2e11(%rip),%rax
mov    (%rax),%esi
lea    0xe67(%rip),%rdi
call   1030 <fputs@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    1170 <main+0x40>
mov    0x8(%rsi),%rdi
lea    0xed9(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1193 <main+0x63>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0xec8(%rip),%rsi
lea    0xeb8(%rip),%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x2,%ebx
jmp    11aa <main+0x7a>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
mov    $0x1,%ebx
mov    $0x1,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11aa <main+0x7a>
mov    0x2e3e(%rip),%rax
mov    (%rax),%esi
lea    0xe94(%rip),%rdi
call   1030 <fputs@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Error! Expected %d param\0A\00"
@.str.1 = [9 x i8] c"test_arg\00"
@.str.2 = [20 x i8] c"Error! Expected %s\0A\00"
@.str.3 = [5 x i8] c"OK!\0A\00"
@stdout = global i32 0
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, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 1)
store i32 1, i32* %3
br label %23
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %3
br label %23
20: ; preds = %11
%21 = load i32, i32* @stdout
%22 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %21)
store i32 0, i32* %3
br label %23
23: ; preds = %20, %17, %8
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Error! Expected %d param\0A\00"
@.str.1 = [9 x i8] c"test_arg\00"
@.str.2 = [20 x i8] c"Error! Expected %s\0A\00"
@.str.3 = [5 x i8] c"OK!\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 1)
br label %18
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %18
15: ; preds = %7
%16 = load i32, i32* @stdout
%17 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %15, %12, %4
%19 = phi i32 [ 1, %4 ], [ 2, %12 ], [ 0, %15 ]
ret i32 %19
}