#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 *, char *);
int /*<<< orphan*/ from_565_raw();
int /*<<< orphan*/ from_565_rle();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  if ((argc == 2) && (!strcmp(argv[1], "-rle"))) {
    from_565_rle();
  } else {
    if (argc == 1) {
      from_565_raw();
    } else {
      fprintf(stderr,
              "Usage : %s [-rle] < rgb_565_input_file > raw_rgb_output_file\n  "
              " -rle : RLE decode input file\n",
              argv[0]);
    }
  }
  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    1189 <main+0x49>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe91(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1189 <main+0x49>
mov    $0x0,%al
call   1060 <from_565_rle@plt>
jmp    11c0 <main+0x80>
cmpl   $0x1,-0x8(%rbp)
jne    119f <main+0x5f>
mov    $0x0,%al
call   1030 <from_565_raw@plt>
jmp    11bb <main+0x7b>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe4f(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11c0 <main+0x80>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
je     117c <main+0x3c>
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1162 <main+0x22>
mov    0x8(%rbx),%rdi
lea    0xea7(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1185 <main+0x45>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe90(%rip),%rsi
call   1050 <fprintf@plt>
jmp    118c <main+0x4c>
xor    %eax,%eax
call   1030 <from_565_raw@plt>
jmp    118c <main+0x4c>
xor    %eax,%eax
call   1060 <from_565_rle@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"-rle\00"
@stderr = global i32 0
@.str.1 = [94 x i8] c"Usage : %s [-rle] < rgb_565_input_file > raw_rgb_output_file\0A -rle : RLE decode input file\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
%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 (...) @from_565_rle()
br label %28
16: ; preds = %8, %2
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (...) @from_565_raw()
br label %27
21: ; preds = %16
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %21, %19
br label %28
28: ; preds = %27, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"-rle\00"
@stderr = global i32 0
@.str.1 = [94 x i8] c"Usage : %s [-rle] < rgb_565_input_file > raw_rgb_output_file\0A -rle : RLE decode input file\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %12 [
i32 2, label %3
i32 1, label %10
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = tail call i32 (...) @from_565_rle()
br label %16
10: ; preds = %2
%11 = tail call i32 (...) @from_565_raw()
br label %16
12: ; preds = %3, %2
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %1
%15 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %10, %12, %8
ret i32 0
}