#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*/ atoi(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ to_565_raw();
int /*<<< orphan*/ to_565_raw_dither(int /*<<< orphan*/);
int /*<<< orphan*/ to_565_rle();
int main(int argc, char **argv) {
  if ((argc == 2) && (!strcmp(argv[1], "-rle"))) {
    to_565_rle();
  } else {
    if (argc > 2 && (!strcmp(argv[1], "-w"))) {
      to_565_raw_dither(atoi(argv[2]));
    } else {
      to_565_raw();
    }
  }
  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)
jne    1199 <main+0x49>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe81(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1199 <main+0x49>
mov    $0x0,%al
call   1050 <to_565_rle@plt>
jmp    11e5 <main+0x95>
cmpl   $0x2,-0x8(%rbp)
jle    11d9 <main+0x89>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe53(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11d9 <main+0x89>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1030 <to_565_raw_dither@plt>
jmp    11e0 <main+0x90>
mov    $0x0,%al
call   1070 <to_565_raw@plt>
jmp    11e5 <main+0x95>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1176 <main+0x26>
mov    0x8(%rbx),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    118c <main+0x3c>
xor    %eax,%eax
call   1050 <to_565_rle@plt>
jmp    1193 <main+0x43>
jle    118c <main+0x3c>
mov    0x8(%rbx),%rdi
lea    0xe82(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1197 <main+0x47>
xor    %eax,%eax
call   1070 <to_565_raw@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1030 <to_565_raw_dither@plt>
jmp    1193 <main+0x43>

LLVM IR (-O0):
@.str = [5 x i8] c"-rle\00"
@.str.1 = [3 x i8] c"-w\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 eq i32 %6, 2
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %8
%15 = call i32 (...) @to_565_rle()
br label %34
16: ; preds = %8, %2
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 2
br i1 %18, label %19, label %31
19: ; preds = %16
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @strcmp(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %31, label %25
25: ; preds = %19
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
%30 = call i32 @to_565_raw_dither(i32 %29)
br label %33
31: ; preds = %19, %16
%32 = call i32 (...) @to_565_raw()
br label %33
33: ; preds = %31, %25
br label %34
34: ; preds = %33, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"-rle\00"
@.str.1 = [3 x i8] c"-w\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %23
9: ; preds = %4
%10 = tail call i32 (...) @to_565_rle()
br label %25
11: ; preds = %2
%12 = icmp sgt i32 %0, 2
br i1 %12, label %13, label %23
13: ; preds = %11
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32 @strcmp(i8* dereferenceable(1) %15, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %13
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i32 @atoi(i8* %20)
%22 = tail call i32 @to_565_raw_dither(i32 %21)
br label %25
23: ; preds = %4, %13, %11
%24 = tail call i32 (...) @to_565_raw()
br label %25
25: ; preds = %18, %23, %9
ret i32 0
}