xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ encrypt(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ strlen(char *);
void writeData(char *fileName, char *data) {
  FILE *fp;
  fp = fopen(fileName, "w+");
  encrypt(data, strlen(data));
  fprintf(fp, "%s", data);
  fclose(fp);
}


x86 assembly (clang, -O0):
<writeData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1050 <encrypt@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe64(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeData>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
lea    0xea2(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <encrypt@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <fputs@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"w+\00"
@.str.1 = [3 x i8] c"%s\00"
define void @writeData(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %5
%8 = load i8*, i8** %4
%9 = load i8*, i8** %4
%10 = call i32 @strlen(i8* %9)
%11 = call i32 @encrypt(i8* %8, i32 %10)
%12 = load i32*, i32** %5
%13 = load i8*, i8** %4
%14 = call i32 @fprintf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = load i32*, i32** %5
%16 = call i32 @fclose(i32* %15)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"w+\00"
define void @writeData(i8* nocapture %0, i8* %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @strlen(i8* %1)
%5 = tail call i32 @encrypt(i8* %1, i32 %4)
%6 = tail call i32 @fputs(i8* %1, i32* %3)
%7 = tail call i32 @fclose(i32* %3)
ret void
}
int calculate_length(int number) {
  int tmp = number;
  int length = 0;
  while (tmp != 0) {
    length++;
    tmp /= 10;
  }
  return length;
}


x86 assembly (clang, -O0):
<calculate_length>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113a <calculate_length+0x3a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1114 <calculate_length+0x14>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_length>:
xor    %eax,%eax
test   %edi,%edi
je     1132 <calculate_length+0x32>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%eax
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <calculate_length+0x10>
ret

LLVM IR (-O0):
define i32 @calculate_length(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %9, %1
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
%12 = load i32, i32* %3
%13 = sdiv i32 %12, 10
store i32 %13, i32* %3
br label %6
14: ; preds = %6
%15 = load i32, i32* %4
ret i32 %15
}

LLVM IR (-O2):
define i32 @calculate_length(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = sdiv i32 %5, 10
%8 = add i32 %5, 9
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %11
}
/* Variables and functions */
char *strdup(char *);
char *cdio_get_default_device_freebsd() { return strdup("/dev/acd0c"); }


x86 assembly (clang, -O0):
<cdio_get_default_device_freebsd>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <strdup@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdio_get_default_device_freebsd>:
lea    0xee9(%rip),%rdi
jmp    1030 <strdup@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"/dev/acd0c\00"
define i8* @cdio_get_default_device_freebsd() {
%1 = call i8* @strdup(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [11 x i8] c"/dev/acd0c\00"
define noalias i8* @cdio_get_default_device_freebsd() {
%1 = tail call dereferenceable_or_null(11) i8* @strdup(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
int fun394() { return 394; }


x86 assembly (clang, -O0):
<fun394>:
push   %rbp
mov    %rsp,%rbp
mov    $0x18a,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun394>:
mov    $0x18a,%eax
ret

LLVM IR (-O0):
define i32 @fun394() {
ret i32 394
}

LLVM IR (-O2):
define i32 @fun394() {
ret i32 394
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gmtime_r(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ strftime(char *, int /*<<< orphan*/, char *, struct tm *);
void onion_shortcut_date_string(time_t t, char *dest) {
  struct tm ts;
  gmtime_r(&t, &ts);
  strftime(dest, t, "%a, %d %b %Y %T %Z", &ts);
}


x86 assembly (clang, -O0):
<onion_shortcut_date_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <gmtime_r@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
lea    0xeb6(%rip),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <strftime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<onion_shortcut_date_string>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%r14
mov    %r14,%rsi
call   1030 <gmtime_r@plt>
mov    0xc(%rsp),%esi
lea    0xeb5(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rcx
call   1040 <strftime@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [19 x i8] c"%a, %d %b %Y %T %Z\00"
define void @onion_shortcut_date_string(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.tm
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = call i32 @gmtime_r(i32* %3, %struct.tm* %5)
%7 = load i8*, i8** %4
%8 = load i32, i32* %3
%9 = call i32 @strftime(i8* %7, i32 %8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [19 x i8] c"%a, %d %b %Y %T %Z\00"
define void @onion_shortcut_date_string(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.tm
store i32 %0, i32* %3
%5 = bitcast %struct.tm* %4 to i8*
%6 = call i32 @gmtime_r(i32* %3, %struct.tm* %4)
%7 = load i32, i32* %3
%8 = call i32 @strftime(i8* %1, i32 %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %struct.tm* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glfwTerminate();
void _glfwTerminate_atexit(void) { glfwTerminate(); }


x86 assembly (clang, -O0):
<_glfwTerminate_atexit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <glfwTerminate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_glfwTerminate_atexit>:
xor    %eax,%eax
jmp    1030 <glfwTerminate@plt>

LLVM IR (-O0):
define void @_glfwTerminate_atexit() {
%1 = call i32 (...) @glfwTerminate()
ret void
}

LLVM IR (-O2):
define void @_glfwTerminate_atexit() {
%1 = tail call i32 (...) @glfwTerminate()
ret void
}
/* Variables and functions */
int errno;
int inputToken(char *, int *, char *, char *);
int readInt(char *prompt, char *errorMessage) {
  int err, ret = 0;
  err = inputToken("%d", &ret, prompt, errorMessage);
  if (err) {
    errno = err;
    return 0;
  }
  return ret;
}


x86 assembly (clang, -O0):
<readInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xeca(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <inputToken@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1164 <readInt+0x54>
mov    -0x1c(%rbp),%ecx
mov    0x2e8a(%rip),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    116a <readInt+0x5a>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readInt>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
movl   $0x0,0x4(%rsp)
lea    0xeda(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <inputToken@plt>
test   %eax,%eax
je     1141 <readInt+0x31>
mov    0x2ea5(%rip),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
pop    %rcx
ret
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@errno = global i32 0
define i32 @readInt(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %7
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i32 @inputToken(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7, i8* %8, i8* %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32, i32* %6
store i32 %14, i32* @errno
store i32 0, i32* %3
br label %17
15: ; preds = %2
%16 = load i32, i32* %7
store i32 %16, i32* %3
br label %17
17: ; preds = %15, %13
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@errno = global i32 0
define i32 @readInt(i8* %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = call i32 @inputToken(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3, i8* %0, i8* %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %2
store i32 %5, i32* @errno
br label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %10
10: ; preds = %8, %7
%11 = phi i32 [ 0, %7 ], [ %9, %8 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ ceil(int);
int log(int);
unsigned int get_mask(unsigned int max) {
  unsigned int bits = (int)(ceil(log(max) / log(2)));
  unsigned int mask = (2 << (bits - 1)) - 1;
  return mask;
}


x86 assembly (clang, -O0):
<get_mask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <log@plt>
mov    %eax,-0x10(%rbp)
mov    $0x2,%edi
call   1040 <log@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <ceil@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x2,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mask>:
push   %rbp
push   %rbx
push   %rax
call   1040 <log@plt>
mov    %eax,%ebx
mov    $0x2,%ebp
mov    $0x2,%edi
call   1040 <log@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <ceil@plt>
lea    -0x1(%rax),%ecx
shl    %cl,%ebp
add    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_mask(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @log(i32 %5)
%7 = call i32 @log(i32 2)
%8 = sdiv i32 %6, %7
%9 = call i64 @ceil(i32 %8)
%10 = trunc i64 %9 to i32
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = sub i32 %11, 1
%13 = shl i32 2, %12
%14 = sub nsw i32 %13, 1
store i32 %14, i32* %4
%15 = load i32, i32* %4
ret i32 %15
}

LLVM IR (-O2):
define i32 @get_mask(i32 %0) {
%2 = tail call i32 @log(i32 %0)
%3 = tail call i32 @log(i32 2)
%4 = sdiv i32 %2, %3
%5 = tail call i64 @ceil(i32 %4)
%6 = trunc i64 %5 to i32
%7 = add i32 %6, -1
%8 = shl i32 2, %7
%9 = add nsw i32 %8, -1
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void PrintCycle(int *cycle, int length) {
  for (int i = 0; i < length; i++) {
    printf("%d ", cycle[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<PrintCycle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <PrintCycle+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <PrintCycle+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintCycle>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <PrintCycle+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <PrintCycle+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @PrintCycle(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @PrintCycle(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8, %2
%7 = tail call i32 @putchar(i32 10)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %13, %8 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %8
}
/* Variables and functions */
int /*<<< orphan*/ PASS(char *);
int /*<<< orphan*/ RTLD_LAZY;
int /*<<< orphan*/ dlopen(char *, int /*<<< orphan*/);
int main() {
  dlopen("/usr/lib/libz.dylib", RTLD_LAZY);
  PASS("read-only-import-shared-cache-dlopen-override");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1030 <dlopen@plt>
lea    0xec9(%rip),%rdi
call   1040 <PASS@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <dlopen@plt>
lea    0xed7(%rip),%rdi
call   1040 <PASS@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"/usr/lib/libz.dylib\00"
@RTLD_LAZY = global i32 0
@.str.1 = [46 x i8] c"read-only-import-shared-cache-dlopen-override\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @RTLD_LAZY
%3 = call i32 @dlopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @PASS(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"/usr/lib/libz.dylib\00"
@RTLD_LAZY = global i32 0
@.str.1 = [46 x i8] c"read-only-import-shared-cache-dlopen-override\00"
define i32 @main() {
%1 = load i32, i32* @RTLD_LAZY
%2 = tail call i32 @dlopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @PASS(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
double math_delta(double x) { return (x == 0) ? (1.0 / 0.0) : 0; }


x86 assembly (clang, -O0):
<math_delta>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm3
xorps  %xmm2,%xmm2
cmpeqsd %xmm2,%xmm0
movaps %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_delta>:
xorpd  %xmm1,%xmm1
cmpeqsd %xmm1,%xmm0
movsd  0xeef(%rip),%xmm1
andpd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @math_delta(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oeq double %3, 0.000000e+00
%5 = zext i1 %4 to i64
%6 = select i1 %4, double 0x7FF0000000000000, double 0.000000e+00
ret double %6
}

LLVM IR (-O2):
define double @math_delta(double %0) {
%2 = fcmp oeq double %0, 0.000000e+00
%3 = select i1 %2, double 0x7FF0000000000000, double 0.000000e+00
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ set_binding_values(char const *, int /*<<< orphan*/ *,
                                      char const **);
char *libintl_bind_textdomain_codeset(const char *domainname,
                                      const char *codeset) {
  set_binding_values(domainname, NULL, &codeset);
  return (char *)codeset;
}


x86 assembly (clang, -O0):
<libintl_bind_textdomain_codeset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
lea    -0x10(%rbp),%rdx
call   1030 <set_binding_values@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libintl_bind_textdomain_codeset>:
push   %rax
mov    %rsi,(%rsp)
mov    %rsp,%rdx
xor    %esi,%esi
call   1030 <set_binding_values@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @libintl_bind_textdomain_codeset(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @set_binding_values(i8* %5, i32* null, i8** %4)
%7 = load i8*, i8** %4
ret i8* %7
}

LLVM IR (-O2):
define i8* @libintl_bind_textdomain_codeset(i8* %0, i8* %1) {
%3 = alloca i8*
store i8* %1, i8** %3
%4 = call i32 @set_binding_values(i8* %0, i32* null, i8** %3)
%5 = load i8*, i8** %3
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ pass1(char *);
int /*<<< orphan*/ pass2(char *);
int main(int argc, char *argv[]) {
  char *filename = argv[1];
  pass1(filename);
  pass2(filename);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <pass1@plt>
mov    -0x18(%rbp),%rdi
call   1030 <pass2@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rbx
mov    %rbx,%rdi
call   1040 <pass1@plt>
mov    %rbx,%rdi
call   1030 <pass2@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = call i32 @pass1(i8* %9)
%11 = load i8*, i8** %5
%12 = call i32 @pass2(i8* %11)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @pass1(i8* %4)
%6 = tail call i32 @pass2(i8* %4)
ret i32 0
}
int ft_strcmp(const char *s1, const char *s2) {
  while (*s1 != '\0' && *s1 == *s2) {
    s1++;
    s2++;
  }
  return ((unsigned char)*s1 - (unsigned char)*s2);
}


x86 assembly (clang, -O0):
<ft_strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1137 <ft_strcmp+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <ft_strcmp+0x47>
jmp    1164 <ft_strcmp+0x64>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <ft_strcmp+0xc>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strcmp>:
mov    (%rdi),%al
test   %al,%al
je     1123 <ft_strcmp+0x23>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
cmp    (%rsi),%al
jne    1125 <ft_strcmp+0x25>
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <ft_strcmp+0x10>
xor    %eax,%eax
movzbl %al,%eax
movzbl (%rsi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ft_strcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %20, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %13, %16
br label %18
18: ; preds = %10, %5
%19 = phi i1 [ false, %5 ], [ %17, %10 ]
br i1 %19, label %20, label %25
20: ; preds = %18
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %3
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
br label %5
25: ; preds = %18
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = load i8*, i8** %4
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = sub nsw i32 %28, %31
ret i32 %32
}

LLVM IR (-O2):
define i32 @ft_strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %14, %11 ], [ %3, %2 ]
%7 = phi i8* [ %13, %11 ], [ %1, %2 ]
%8 = phi i8* [ %12, %11 ], [ %0, %2 ]
%9 = load i8, i8* %7
%10 = icmp eq i8 %6, %9
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %11, %2
%17 = phi i8* [ %1, %2 ], [ %13, %11 ], [ %7, %5 ]
%18 = phi i8 [ 0, %2 ], [ 0, %11 ], [ %6, %5 ]
%19 = zext i8 %18 to i32
%20 = load i8, i8* %17
%21 = zext i8 %20 to i32
%22 = sub nsw i32 %19, %21
ret i32 %22
}
/* Variables and functions */
int doubleAdd(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int r = doubleAdd(2, 3);
  printf("r = %d\n", r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
mov    $0x3,%esi
call   1040 <doubleAdd@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x3,%esi
call   1040 <doubleAdd@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"r = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @doubleAdd(i32 2, i32 3)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"r = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @doubleAdd(i32 2, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
unsigned short inw(unsigned short _port) {
  unsigned short data;
  __asm__ __volatile__("in %%dx, %%ax" : "=a"(data) : "dN"(_port));
  return data;
}


x86 assembly (clang, -O0):
<inw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw>:
mov    %edi,%edx
in     (%dx),%ax
ret

LLVM IR (-O0):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i16 asm sideeffect "in %dx, %ax", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = tail call i16 asm sideeffect "in %dx, %ax", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) { printf("Hello, world\n"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, world\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"Hello, world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ chtype;

/* Variables and functions */
int /*<<< orphan*/ addchstr(int /*<<< orphan*/ *);
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
void cmd_addchstr(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_return(addchstr((chtype *)args[0]));
}


x86 assembly (clang, -O0):
<cmd_addchstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    116a <cmd_addchstr+0x2a>
jmp    1187 <cmd_addchstr+0x47>
mov    $0x1,%edi
call   1060 <report_count@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <addchstr@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_addchstr>:
push   %rbx
mov    %rsi,%rbx
mov    $0x1,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1155 <cmd_addchstr+0x15>
pop    %rbx
ret
mov    $0x1,%edi
call   1060 <report_count@plt>
mov    (%rbx),%rdi
call   1050 <addchstr@plt>
mov    %eax,%edi
pop    %rbx
jmp    1030 <report_return@plt>

LLVM IR (-O0):
define void @cmd_addchstr(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @check_arg_count(i32 %5, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %17
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = bitcast i8* %13 to i32*
%15 = call i32 @addchstr(i32* %14)
%16 = call i32 @report_return(i32 %15)
br label %17
17: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
define void @cmd_addchstr(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = bitcast i8** %1 to i32**
%8 = load i32*, i32** %7
%9 = tail call i32 @addchstr(i32* %8)
%10 = tail call i32 @report_return(i32 %9)
br label %11
11: ; preds = %2, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void help(void) {
  fprintf(stderr,
          "\n"
          "usage: tolua [options] input_file\n"
          "\n"
          "Command line options are:\n"
          "  -v       : print version information.\n"
          "  -o  file : set output file; default is stdout.\n"
          "  -H  file : create include file.\n"
          "  -n  name : set package name; default is input file root name.\n"
          "  -p       : parse only.\n"
          "  -P       : parse and print structure information (for debug).\n"
          "  -h       : print this message.\n"
          "Should the input file be omitted, stdin is assumed;\n"
          "in that case, the package name must be explicitly set.\n\n");
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [480 x i8] c"\0Ausage: tolua [options] input_file\0A\0ACommand line options are:\0A -v : print version information.\0A -o file : set output file; default is stdout.\0A -H file : create include file.\0A -n name : set package name; default is input file root name.\0A -p : parse only.\0A -P : parse and print structure information (for debug).\0A -h : print this message.\0AShould the input file be omitted, stdin is assumed;\0Ain that case, the package name must be explicitly set.\0A\0A\00"
define void @help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([480 x i8], [480 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [480 x i8] c"\0Ausage: tolua [options] input_file\0A\0ACommand line options are:\0A -v : print version information.\0A -o file : set output file; default is stdout.\0A -H file : create include file.\0A -n name : set package name; default is input file root name.\0A -p : parse only.\0A -P : parse and print structure information (for debug).\0A -h : print this message.\0AShould the input file be omitted, stdin is assumed;\0Ain that case, the package name must be explicitly set.\0A\0A\00"
define void @help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([480 x i8], [480 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint;

/* Variables and functions */
int /*<<< orphan*/ _uitoa_internal(unsigned int, char *, int /*<<< orphan*/);
char *_itoa_internal(int value, char *str, uint base) {
  char *ptr = str;
  int i = 0;
  if (value < 0) {
    ptr[i++] = '-';
    value = -value;
  }
  _uitoa_internal((unsigned int)value, str + i, base);
  return str;
}


x86 assembly (clang, -O0):
<_itoa_internal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1159 <_itoa_internal+0x49>
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
movslq %ecx,%rcx
movb   $0x2d,(%rax,%rcx,1)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
movslq -0x24(%rbp),%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
call   1030 <_uitoa_internal@plt>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_itoa_internal>:
push   %rbx
mov    %rsi,%rbx
test   %edi,%edi
js     111c <_itoa_internal+0xc>
xor    %esi,%esi
jmp    1126 <_itoa_internal+0x16>
movb   $0x2d,(%rbx)
neg    %edi
mov    $0x1,%esi
add    %rbx,%rsi
call   1030 <_uitoa_internal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @_itoa_internal(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %5
store i8* %9, i8** %7
store i32 0, i32* %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %3
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = add nsw i32 %14, 1
store i32 %15, i32* %8
%16 = sext i32 %14 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
store i8 45, i8* %17
%18 = load i32, i32* %4
%19 = sub nsw i32 0, %18
store i32 %19, i32* %4
br label %20
20: ; preds = %12, %3
%21 = load i32, i32* %4
%22 = load i8*, i8** %5
%23 = load i32, i32* %8
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i32, i32* %6
%27 = call i32 @_uitoa_internal(i32 %21, i8* %25, i32 %26)
%28 = load i8*, i8** %5
ret i8* %28
}

LLVM IR (-O2):
define i8* @_itoa_internal(i32 %0, i8* returned %1, i32 %2) {
%4 = icmp slt i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
store i8 45, i8* %1
%6 = sub nsw i32 0, %0
br label %7
7: ; preds = %5, %3
%8 = phi i32 [ %6, %5 ], [ %0, %3 ]
%9 = phi i64 [ 1, %5 ], [ 0, %3 ]
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = tail call i32 @_uitoa_internal(i32 %8, i8* %10, i32 %2)
ret i8* %1
}
void *f10(int n) {
  int *x = malloc(n * sizeof(int));
  int i = 0;
  while (i < n)
    x[i++] = 0;
  return x;
}


x86 assembly (clang, -O0):
<f10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
shl    $0x2,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115d <f10+0x4d>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    1133 <f10+0x23>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f10>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
movslq %edi,%rbx
lea    0x0(,%rbx,4),%rdi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %ebx,%ebx
jle    114d <f10+0x2d>
mov    %ebp,%edx
shl    $0x2,%rdx
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @f10(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = mul i64 %6, 4
%8 = call i8* @malloc(i64 %7)
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %3
store i32 0, i32* %4
br label %10
10: ; preds = %14, %1
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %20
14: ; preds = %10
%15 = load i32*, i32** %3
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
%18 = sext i32 %16 to i64
%19 = getelementptr inbounds i32, i32* %15, i64 %18
store i32 0, i32* %19
br label %10
20: ; preds = %10
%21 = load i32*, i32** %3
%22 = bitcast i32* %21 to i8*
ret i8* %22
}

LLVM IR (-O2):
define noalias i8* @f10(i32 %0) {
%2 = sext i32 %0 to i64
%3 = shl nsw i64 %2, 2
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = zext i32 %0 to i64
%8 = shl nuw nsw i64 %7, 2
br label %9
9: ; preds = %6, %1
ret i8* %4
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t gru_unit_kb(uint64_t num) { return (num / 1024); }


x86 assembly (clang, -O0):
<gru_unit_kb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<gru_unit_kb>:
lea    0x3ff(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0xa,%eax
ret

LLVM IR (-O0):
define i32 @gru_unit_kb(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 1024
ret i32 %4
}

LLVM IR (-O2):
define i32 @gru_unit_kb(i32 %0) {
%2 = sdiv i32 %0, 1024
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *xalloc(size_t size) {
  void *p = malloc(size);
  if (!p) {
    fprintf(stderr, "Virtual memory exhausted.\n");
    abort();
  }
  return p;
}


x86 assembly (clang, -O0):
<xalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1170 <xalloc+0x40>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xalloc>:
push   %rax
call   1050 <malloc@plt>
test   %rax,%rax
je     113d <xalloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"Virtual memory exhausted.\0A\00"
define i8* @xalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"Virtual memory exhausted.\0A\00"
define noalias i8* @xalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_UNBLOCK;
int /*<<< orphan*/ sigfillset(int /*<<< orphan*/ *);
int sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int unblock_signals(void) {
  sigset_t mask;
  sigfillset(&mask);
  return sigprocmask(SIG_UNBLOCK, &mask, NULL);
}


x86 assembly (clang, -O0):
<unblock_signals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <sigfillset@plt>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unblock_signals>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sigfillset@plt>
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SIG_UNBLOCK = global i32 0
define i32 @unblock_signals() {
%1 = alloca i32
%2 = call i32 @sigfillset(i32* %1)
%3 = load i32, i32* @SIG_UNBLOCK
%4 = call i32 @sigprocmask(i32 %3, i32* %1, i32* null)
ret i32 %4
}

LLVM IR (-O2):
@SIG_UNBLOCK = global i32 0
define i32 @unblock_signals() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sigfillset(i32* %1)
%4 = load i32, i32* @SIG_UNBLOCK
%5 = call i32 @sigprocmask(i32 %4, i32* %1, i32* null)
ret i32 %5
}
void av_spherical_alloc() {}


x86 assembly (clang, -O0):
<av_spherical_alloc>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_spherical_alloc>:
ret

LLVM IR (-O0):
define void @av_spherical_alloc() {
ret void
}

LLVM IR (-O2):
define void @av_spherical_alloc() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void data_print_padd(unsigned int i) {
  while (i-- > 0)
    putchar(' ');
}


x86 assembly (clang, -O0):
<data_print_padd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jbe    113e <data_print_padd+0x2e>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    111b <data_print_padd+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_print_padd>:
push   %rbx
test   %edi,%edi
je     112f <data_print_padd+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <data_print_padd+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @data_print_padd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* %2
%5 = add i32 %4, -1
store i32 %5, i32* %2
%6 = icmp ugt i32 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @putchar(i8 signext 32)
br label %3
9: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @data_print_padd(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add i32 %4, -1
%6 = tail call i32 @putchar(i8 signext 32)
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
void XkbGetKeySyms() {}


x86 assembly (clang, -O0):
<XkbGetKeySyms>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XkbGetKeySyms>:
ret

LLVM IR (-O0):
define void @XkbGetKeySyms() {
ret void
}

LLVM IR (-O2):
define void @XkbGetKeySyms() {
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int copy_dobldobl_target_system_to_container(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(251, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<copy_dobldobl_target_system_to_container>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xfb,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_dobldobl_target_system_to_container>:
mov    $0xfb,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @copy_dobldobl_target_system_to_container() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 251, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @copy_dobldobl_target_system_to_container() {
%1 = tail call i32 @_ada_use_c2phc(i32 251, i32* undef, i32* undef, double* undef)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ log_monitor_init();
int /*<<< orphan*/ log_player_init();
int /*<<< orphan*/ log_ui_init();
int /*<<< orphan*/ log_utils_init();
int /*<<< orphan*/ test();
int main() {
  test();
  log_monitor_init();
  log_player_init();
  log_utils_init();
  log_ui_init();
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <test@plt>
mov    $0x0,%al
call   1040 <log_monitor_init@plt>
mov    $0x0,%al
call   1050 <log_player_init@plt>
mov    $0x0,%al
call   1030 <log_utils_init@plt>
mov    $0x0,%al
call   1060 <log_ui_init@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <test@plt>
xor    %eax,%eax
call   1040 <log_monitor_init@plt>
xor    %eax,%eax
call   1050 <log_player_init@plt>
xor    %eax,%eax
call   1030 <log_utils_init@plt>
xor    %eax,%eax
call   1060 <log_ui_init@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test()
%3 = call i32 (...) @log_monitor_init()
%4 = call i32 (...) @log_player_init()
%5 = call i32 (...) @log_utils_init()
%6 = call i32 (...) @log_ui_init()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test()
%2 = tail call i32 (...) @log_monitor_init()
%3 = tail call i32 (...) @log_player_init()
%4 = tail call i32 (...) @log_utils_init()
%5 = tail call i32 (...) @log_ui_init()
ret i32 0
}
/* Variables and functions */
unsigned short READ_REG16(unsigned long);
unsigned short gfx_read_reg16(unsigned long offset) {
  unsigned short value;
  value = READ_REG16(offset);
  return value;
}


x86 assembly (clang, -O0):
<gfx_read_reg16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <READ_REG16@plt>
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gfx_read_reg16>:
jmp    1030 <READ_REG16@plt>

LLVM IR (-O0):
define zeroext i16 @gfx_read_reg16(i64 %0) {
%2 = alloca i64
%3 = alloca i16
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call zeroext i16 @READ_REG16(i64 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @gfx_read_reg16(i64 %0) {
%2 = tail call zeroext i16 @READ_REG16(i64 %0)
ret i16 %2
}
int compte_jusque_lastcharacter(char *character, char *lastcharacter) {
  int i = 0;
  int position_lastcharacter = 0;
  while (character + i < lastcharacter) {
    position_lastcharacter++;
    i++;
  }
  return position_lastcharacter;
}


x86 assembly (clang, -O0):
<compte_jusque_lastcharacter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
cmp    -0x10(%rbp),%rax
jae    1146 <compte_jusque_lastcharacter+0x46>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111a <compte_jusque_lastcharacter+0x1a>
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compte_jusque_lastcharacter>:
mov    %esi,%ecx
sub    %edi,%ecx
xor    %eax,%eax
cmp    %rsi,%rdi
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @compte_jusque_lastcharacter(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %14, %2
%8 = load i8*, i8** %3
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8*, i8** %4
%13 = icmp ult i8* %11, %12
br i1 %13, label %14, label %19
14: ; preds = %7
%15 = load i32, i32* %6
%16 = add nsw i32 %15, 1
store i32 %16, i32* %6
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %7
19: ; preds = %7
%20 = load i32, i32* %6
ret i32 %20
}

LLVM IR (-O2):
define i32 @compte_jusque_lastcharacter(i8* readnone %0, i8* readnone %1) {
%3 = icmp ult i8* %0, %1
%4 = ptrtoint i8* %1 to i64
%5 = ptrtoint i8* %0 to i64
%6 = trunc i64 %5 to i32
%7 = trunc i64 %4 to i32
%8 = sub i32 %7, %6
%9 = select i1 %3, i32 %8, i32 0
ret i32 %9
}
/* Variables and functions */
size_t base64_estimate_decode_size(size_t base64_in_size) {
  return ((base64_in_size / 4) * 3);
}


x86 assembly (clang, -O0):
<base64_estimate_decode_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x2,%rax
imul   $0x3,%rax,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64_estimate_decode_size>:
shr    $0x2,%rdi
lea    (%rdi,%rdi,2),%rax
ret

LLVM IR (-O0):
define i64 @base64_estimate_decode_size(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = udiv i64 %3, 4
%5 = mul i64 %4, 3
ret i64 %5
}

LLVM IR (-O2):
define i64 @base64_estimate_decode_size(i64 %0) {
%2 = lshr i64 %0, 2
%3 = mul nuw i64 %2, 3
ret i64 %3
}