#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*/ base64_decode(int /*<<< orphan*/);
int /*<<< orphan*/ base64_encode(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  int encode = 1;
  if (argc == 2) {
    if (strcmp("-d", argv[1]) == 0)
      encode = 0;
    else
      usage();
  } else if (argc != 1) {
    usage();
  }
  if (encode)
    base64_encode(stdin);
  else
    base64_decode(stdin);
  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)
movl   $0x1,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    119d <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe8a(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1191 <main+0x51>
movl   $0x0,-0x14(%rbp)
jmp    1198 <main+0x58>
mov    $0x0,%al
call   1050 <usage@plt>
jmp    11b3 <main+0x73>
cmpl   $0x1,-0x8(%rbp)
je     11ae <main+0x6e>
mov    $0x0,%al
call   1050 <usage@plt>
jmp    11b3 <main+0x73>
cmpl   $0x0,-0x14(%rbp)
je     11d0 <main+0x90>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
call   1040 <base64_encode@plt>
jmp    11de <main+0x9e>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
call   1060 <base64_decode@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
je     1167 <main+0x27>
cmp    $0x2,%edi
jne    1160 <main+0x20>
mov    0x8(%rsi),%rsi
lea    0xeaa(%rip),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1179 <main+0x39>
xor    %eax,%eax
call   1050 <usage@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
call   1040 <base64_encode@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
call   1060 <base64_decode@plt>
jmp    1175 <main+0x35>

LLVM IR (-O0):
@.str = [3 x i8] c"-d\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %9
store i32 0, i32* %6
br label %18
16: ; preds = %9
%17 = call i32 (...) @usage()
br label %18
18: ; preds = %16, %15
br label %25
19: ; preds = %2
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 (...) @usage()
br label %24
24: ; preds = %22, %19
br label %25
25: ; preds = %24, %18
%26 = load i32, i32* %6
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* @stdin
%30 = call i32 @base64_encode(i32 %29)
br label %34
31: ; preds = %25
%32 = load i32, i32* @stdin
%33 = call i32 @base64_decode(i32 %32)
br label %34
34: ; preds = %31, %28
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"-d\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %8 [
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 i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %2, %3
%9 = tail call i32 (...) @usage()
br label %10
10: ; preds = %8, %2
%11 = load i32, i32* @stdin
%12 = tail call i32 @base64_encode(i32 %11)
br label %16
13: ; preds = %3
%14 = load i32, i32* @stdin
%15 = tail call i32 @base64_decode(i32 %14)
br label %16
16: ; preds = %13, %10
ret i32 0
}