#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ b64pack_compress(char *, size_t *);
int /*<<< orphan*/ b64pack_decompress(char *, size_t *);
int /*<<< orphan*/ err_use(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
size_t get_message(char **);
int /*<<< orphan*/ put_message(char *, size_t);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char *msg;
  size_t msglen;
  int operation;
  switch (argc) {
  case 1:
    operation = 0;
    break;
  case 2:
    if (strcmp(argv[1], "-d") == 0) {
      operation = 1;
      break;
    }
  default:
    err_use(argv[0]);
  }
  msglen = get_message(&msg);
  if (operation == 0)
    b64pack_compress(msg, &msglen);
  else
    b64pack_decompress(msg, &msglen);
  put_message(msg, msglen);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x1,%eax
je     11ab <main+0x3b>
jmp    119a <main+0x2a>
mov    -0x28(%rbp),%eax
sub    $0x2,%eax
je     11b7 <main+0x47>
jmp    11e5 <main+0x75>
movl   $0x0,-0x24(%rbp)
jmp    11f1 <main+0x81>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11e0 <main+0x70>
movl   $0x1,-0x24(%rbp)
jmp    11f1 <main+0x81>
jmp    11e5 <main+0x75>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <err_use@plt>
lea    -0x18(%rbp),%rdi
call   1030 <get_message@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    121a <main+0xaa>
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1080 <b64pack_compress@plt>
jmp    1227 <main+0xb7>
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <b64pack_decompress@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <put_message@plt>
mov    0x2da5(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x1,%edi
je     11bb <main+0x4b>
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    11b3 <main+0x43>
mov    0x8(%rbx),%rdi
lea    0xe73(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    11b3 <main+0x43>
lea    0x8(%rsp),%rdi
call   1030 <get_message@plt>
mov    %rax,(%rsp)
mov    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <b64pack_decompress@plt>
jmp    11d6 <main+0x66>
mov    (%rbx),%rdi
call   1060 <err_use@plt>
lea    0x8(%rsp),%rdi
call   1030 <get_message@plt>
mov    %rax,(%rsp)
mov    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1080 <b64pack_compress@plt>
mov    0x8(%rsp),%rdi
mov    (%rsp),%rsi
call   1070 <put_message@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
switch i32 %9, label %19 [
i32 1, label %10
i32 2, label %11
]
10: ; preds = %2
store i32 0, i32* %8
br label %24
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
store i32 1, i32* %8
br label %24
18: ; preds = %11
br label %19
19: ; preds = %2, %18
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @err_use(i8* %22)
br label %24
24: ; preds = %19, %17, %10
%25 = call i64 @get_message(i8** %6)
store i64 %25, i64* %7
%26 = load i32, i32* %8
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i8*, i8** %6
%30 = call i32 @b64pack_compress(i8* %29, i64* %7)
br label %34
31: ; preds = %24
%32 = load i8*, i8** %6
%33 = call i32 @b64pack_decompress(i8* %32, i64* %7)
br label %34
34: ; preds = %31, %28
%35 = load i8*, i8** %6
%36 = load i64, i64* %7
%37 = call i32 @put_message(i8* %35, i64 %36)
%38 = load i32, i32* @EXIT_SUCCESS
%39 = call i32 @exit(i32 %38)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"-d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast i8** %3 to i8*
%6 = bitcast i64* %4 to i8*
switch i32 %0, label %12 [
i32 1, label %15
i32 2, label %7
]
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %7, %2
%13 = load i8*, i8** %1
%14 = tail call i32 @err_use(i8* %13)
br label %15
15: ; preds = %2, %12
%16 = call i64 @get_message(i8** %3)
store i64 %16, i64* %4
%17 = load i8*, i8** %3
%18 = call i32 @b64pack_compress(i8* %17, i64* %4)
br label %23
19: ; preds = %7
%20 = call i64 @get_message(i8** %3)
store i64 %20, i64* %4
%21 = load i8*, i8** %3
%22 = call i32 @b64pack_decompress(i8* %21, i64* %4)
br label %23
23: ; preds = %19, %15
%24 = load i8*, i8** %3
%25 = load i64, i64* %4
%26 = call i32 @put_message(i8* %24, i64 %25)
%27 = load i32, i32* @EXIT_SUCCESS
%28 = call i32 @exit(i32 %27)
unreachable
}