#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*/ Compress(char *, int, unsigned char **, unsigned int *);
char *base64(unsigned char *, unsigned int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main(int argc, char *argv[]) {
  unsigned char *szDest = NULL;
  char input[12] = {0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20,
                    0x77, 0x6F, 0x72, 0x6C, 0x64, '\0'};
  unsigned int nDest = 0;
  printf("base64(gzip(%s))\n", input);
  Compress(input, strlen(input), &szDest, &nDest);
  printf("from %d to %d\n", strlen(input), nDest);
  char *output = base64(szDest, nDest);
  printf("Base64: %s\n", output);
  free(output);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0xe92(%rip),%rax
mov    %rax,-0x24(%rbp)
mov    0xe90(%rip),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x28(%rbp)
lea    -0x24(%rbp),%rsi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x24(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x24(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
lea    -0x18(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1070 <Compress@plt>
lea    -0x24(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
mov    -0x28(%rbp),%edx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1060 <base64@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movq   $0x0,0x8(%rsp)
movabs $0x6f77206f6c6c6568,%rax
20 77 6f
mov    %rax,0x10(%rsp)
movl   $0x646c72,0x18(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xe88(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    %rbx,%rdi
mov    %eax,%esi
call   1070 <Compress@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    0x4(%rsp),%edx
lea    0xe5c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rdi
mov    0x4(%rsp),%esi
call   1060 <base64@plt>
mov    %rax,%rbx
lea    0xe4a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.input = [12 x i8] c"hello world\00"
@.str = [18 x i8] c"base64(gzip(%s))\0A\00"
@.str.1 = [15 x i8] c"from %d to %d\0A\00"
@.str.2 = [12 x i8] c"Base64: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca [12 x i8]
%7 = alloca i32
%8 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i8* null, i8** %5
%9 = bitcast [12 x i8]* %6 to i8*
store i32 0, i32* %7
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @Compress(i8* %12, i32 %14, i8** %5, i32* %7)
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = load i32, i32* %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %18)
%20 = load i8*, i8** %5
%21 = load i32, i32* %7
%22 = call i8* @base64(i8* %20, i32 %21)
store i8* %22, i8** %8
%23 = load i8*, i8** %8
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = load i8*, i8** %8
%26 = call i32 @free(i8* %25)
ret i32 0
}

LLVM IR (-O2):
@__const.main.input = [12 x i8] c"hello world\00"
@.str = [18 x i8] c"base64(gzip(%s))\0A\00"
@.str.1 = [15 x i8] c"from %d to %d\0A\00"
@.str.2 = [12 x i8] c"Base64: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = alloca [12 x i8]
%5 = alloca i32
%6 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %7)
%10 = call i32 @strlen(i8* %7)
%11 = call i32 @Compress(i8* %7, i32 %10, i8** %3, i32* %5)
%12 = call i32 @strlen(i8* %7)
%13 = load i32, i32* %5
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13)
%15 = load i8*, i8** %3
%16 = load i32, i32* %5
%17 = call i8* @base64(i8* %15, i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = call i32 @free(i8* %17)
ret i32 0
}