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

/* Variables and functions */
uint32_t rm_get_uint32le(uint8_t *buf) {
  return (uint32_t)((buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]);
}


x86 assembly (clang, -O0):
<rm_get_uint32le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
or     (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rm_get_uint32le>:
mov    0xc(%rdi),%ecx
shl    $0x18,%ecx
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%edx
shl    $0x10,%edx
or     %ecx,%edx
shl    $0x8,%eax
or     %edx,%eax
or     (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @rm_get_uint32le(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 3
%5 = load i32, i32* %4
%6 = shl i32 %5, 24
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 2
%9 = load i32, i32* %8
%10 = shl i32 %9, 16
%11 = or i32 %6, %10
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = shl i32 %14, 8
%16 = or i32 %11, %15
%17 = load i32*, i32** %2
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = or i32 %16, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @rm_get_uint32le(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
%4 = shl i32 %3, 24
%5 = getelementptr inbounds i32, i32* %0, i64 2
%6 = load i32, i32* %5
%7 = shl i32 %6, 16
%8 = or i32 %7, %4
%9 = getelementptr inbounds i32, i32* %0, i64 1
%10 = load i32, i32* %9
%11 = shl i32 %10, 8
%12 = or i32 %8, %11
%13 = load i32, i32* %0
%14 = or i32 %12, %13
ret i32 %14
}
/* Variables and functions */
scalar_t__ mock(char *);
char *cf_s_seq_news(char *s) { return (char *)mock(s); }


x86 assembly (clang, -O0):
<cf_s_seq_news>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cf_s_seq_news>:
jmp    1030 <mock@plt>

LLVM IR (-O0):
define i8* @cf_s_seq_news(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @mock(i8* %3)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define i8* @cf_s_seq_news(i8* %0) {
%2 = tail call i64 @mock(i8* %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
int main() {
  char out = 0x55;
  __asm__("movl $0x42, %%eax; cmpl $0x84, %%eax; seto %%al" : "=a"(out));
  return out;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movb   $0x55,-0x5(%rbp)
mov    $0x42,%eax
cmp    $0x84,%eax
seto   %al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x42,%eax
cmp    $0x84,%eax
seto   %al
movsbl %al,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 85, i8* %2
%3 = call i8 asm "movl $$0x42, %eax; cmpl $$0x84, %eax; seto %al", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8 asm "movl $$0x42, %eax; cmpl $$0x84, %eax; seto %al", "={ax},~{dirflag},~{fpsr},~{flags}"()
%2 = sext i8 %1 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ rcerror(char *);
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char *);
void cant(const char *s) {
  char buf[100];
  strcpy(buf, "can't happen: ");
  strcat(buf, s);
  rcerror(buf);
}


x86 assembly (clang, -O0):
<cant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x70(%rbp),%rdi
call   1040 <rcerror@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cant>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rdi,%rbx
lea    0xebf(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcat@plt>
mov    %r14,%rdi
call   1040 <rcerror@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"can't happen: \00"
define void @cant(i8* %0) {
%2 = alloca i8*
%3 = alloca [100 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i32 @strcat(i8* %6, i8* %7)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = call i32 @rcerror(i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"can't happen: \00"
define void @cant(i8* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @strcat(i8* %3, i8* %0)
%6 = call i32 @rcerror(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nand_init();
int nand_read(unsigned int, unsigned int, unsigned int);
int copykernel2ddr(unsigned int nand_start, unsigned int ddr_start,
                   unsigned int len) {
  int ret;
  nand_init();
  ret = nand_read(nand_start, ddr_start, len);
  return ret;
}


x86 assembly (clang, -O0):
<copykernel2ddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1030 <nand_init@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <nand_read@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copykernel2ddr>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <nand_init@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <nand_read@plt>

LLVM IR (-O0):
define i32 @copykernel2ddr(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = call i32 (...) @nand_init()
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 @nand_read(i32 %9, i32 %10, i32 %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
ret i32 %13
}

LLVM IR (-O2):
define i32 @copykernel2ddr(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (...) @nand_init()
%5 = tail call i32 @nand_read(i32 %0, i32 %1, i32 %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ f();
int *malloc(int);
int main() {
  int *a = malloc(sizeof(int) * 1024 * 10);
  f();
  int i;
  int *b[100];
  for (i = 0; i < 100; i++) {
    b[i] = malloc(sizeof(char) * 256);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa000,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    117f <main+0x5f>
mov    $0x100,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
mov    %rcx,-0x340(%rbp,%rax,8)
ff
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <main+0x2e>
mov    -0x4(%rbp),%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa000,%edi
call   1040 <malloc@plt>
xor    %eax,%eax
call   1030 <f@plt>
mov    $0x64,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x100,%edi
call   1040 <malloc@plt>
add    $0xffffffff,%ebx
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca [100 x i32*]
store i32 0, i32* %1
%5 = call i32* @malloc(i32 40960)
store i32* %5, i32** %2
%6 = call i32 (...) @f()
store i32 0, i32* %3
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 100
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = call i32* @malloc(i32 256)
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [100 x i32*], [100 x i32*]* %4, i64 0, i64 %13
store i32* %11, i32** %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %7
18: ; preds = %7
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 40960)
%2 = tail call i32 (...) @f()
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %6, %3 ]
%5 = tail call i32* @malloc(i32 256)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, 100
br i1 %7, label %8, label %3
8: ; preds = %3
ret i32 0
}
/* Variables and functions */
float noise1(float);
float lovrMathNoise1(float x) { return noise1(x) * .5f + .5f; }


x86 assembly (clang, -O0):
<lovrMathNoise1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <noise1@plt>
movss  0xed1(%rip),%xmm1
mulss  %xmm1,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lovrMathNoise1>:
push   %rax
call   1030 <noise1@plt>
movss  0xee2(%rip),%xmm1
mulss  %xmm1,%xmm0
addss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @lovrMathNoise1(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @noise1(float %3)
%5 = call float @llvm.fmuladd.f32(float %4, float 5.000000e-01, float 5.000000e-01)
ret float %5
}

LLVM IR (-O2):
define float @lovrMathNoise1(float %0) {
%2 = tail call float @noise1(float %0)
%3 = tail call float @llvm.fmuladd.f32(float %2, float 5.000000e-01, float 5.000000e-01)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int toupper(char);
void convmaius(char *str) {
  char *ch;
  for (ch = str; *ch != '\0'; ch++)
    printf("%c", toupper(*ch));
}


x86 assembly (clang, -O0):
<convmaius>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116f <convmaius+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,%esi
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <convmaius+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convmaius>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     115d <convmaius+0x3d>
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0xec8(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <convmaius+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @convmaius(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %15, %1
%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 = call i32 @toupper(i8 signext %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
br label %5
18: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @convmaius(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = tail call i32 @toupper(i8 signext %5)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ ispunct(int);
void t_ispunct_0x09() {
  Assert_real((ispunct(9) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_ispunct.c",
              50, ("ispunct should be 0 for 0x09"));
}


x86 assembly (clang, -O0):
<t_ispunct_0x09>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9,%edi
call   1030 <ispunct@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x32,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_ispunct_0x09>:
push   %rax
mov    $0x9,%edi
call   1030 <ispunct@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x32,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0x09\00"
define void @t_ispunct_0x09() {
%1 = call i64 @ispunct(i32 9)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0x09\00"
define void @t_ispunct_0x09() {
%1 = tail call i64 @ispunct(i32 9)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 50, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void raspddns_close_log(FILE *file) {
  if (file) {
    fclose(file);
  }
}


x86 assembly (clang, -O0):
<raspddns_close_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <raspddns_close_log+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raspddns_close_log>:
test   %rdi,%rdi
je     111a <raspddns_close_log+0xa>
jmp    1030 <fclose@plt>
ret

LLVM IR (-O0):
define void @raspddns_close_log(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32*, i32** %2
%7 = call i32 @fclose(i32* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @raspddns_close_log(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @fclose(i32* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void asdftest_yyfree(void *ptr) { free((char *)ptr); }


x86 assembly (clang, -O0):
<asdftest_yyfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asdftest_yyfree>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @asdftest_yyfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
ret void
}

LLVM IR (-O2):
define void @asdftest_yyfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
char *calloc(int, int);
char *almalloc(int sz) {
  char *tmp;
  tmp = calloc(1, 2 * sz);
  tmp = (char *)(((int)tmp + sz) & ~(sz - 1));
  return (tmp);
}


x86 assembly (clang, -O0):
<almalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
shl    $0x1,%esi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<almalloc>:
push   %rbx
mov    %edi,%ebx
lea    (%rbx,%rbx,1),%esi
mov    $0x1,%edi
call   1030 <calloc@plt>
add    %ebx,%eax
neg    %ebx
and    %eax,%ebx
movslq %ebx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @almalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 2, %4
%6 = call i8* @calloc(i32 1, i32 %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = ptrtoint i8* %7 to i32
%9 = load i32, i32* %2
%10 = add nsw i32 %8, %9
%11 = load i32, i32* %2
%12 = sub nsw i32 %11, 1
%13 = xor i32 %12, -1
%14 = and i32 %10, %13
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %3
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
define i8* @almalloc(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = tail call i8* @calloc(i32 1, i32 %2)
%4 = ptrtoint i8* %3 to i64
%5 = trunc i64 %4 to i32
%6 = add nsw i32 %5, %0
%7 = sub i32 0, %0
%8 = and i32 %6, %7
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
ret i8* %10
}
void encode(char *str, char *res) { int i, n; }


x86 assembly (clang, -O0):
<encode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @encode(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
ret void
}

LLVM IR (-O2):
define void @encode(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(unsigned int, int /*<<< orphan*/ *);
void store_u16(unsigned x, FILE *f) {
  fputc(x >> 0, f);
  fputc(x >> 8, f);
}


x86 assembly (clang, -O0):
<store_u16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
shr    $0x0,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
mov    -0x4(%rbp),%edi
shr    $0x8,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<store_u16>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <fputc@plt>
shr    $0x8,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
define void @store_u16(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = lshr i32 %5, 0
%7 = load i32*, i32** %4
%8 = call i32 @fputc(i32 %6, i32* %7)
%9 = load i32, i32* %3
%10 = lshr i32 %9, 8
%11 = load i32*, i32** %4
%12 = call i32 @fputc(i32 %10, i32* %11)
ret void
}

LLVM IR (-O2):
define void @store_u16(i32 %0, i32* nocapture %1) {
%3 = tail call i32 @fputc(i32 %0, i32* %1)
%4 = lshr i32 %0, 8
%5 = tail call i32 @fputc(i32 %4, i32* %1)
ret void
}
/* Type definitions */
struct timeval {
  long long tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long long get_unixtimestamp() {
  long long ts;
  struct timeval tv;
  gettimeofday(&tv, NULL);
  ts = tv.tv_sec;
  return ts;
}


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

x86 assembly (clang, -O2):
<get_unixtimestamp>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i64 }
define i64 @get_unixtimestamp() {
%1 = alloca i64
%2 = alloca %struct.timeval
%3 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%5 = load i64, i64* %4
store i64 %5, i64* %1
%6 = load i64, i64* %1
ret i64 %6
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
define i64 @get_unixtimestamp() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
ret i64 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
unsigned int is_a_double(int /*<<< orphan*/ const *);
unsigned int is_an_int(int /*<<< orphan*/ const *);
unsigned int is_a_number(const wchar_t *atom) {
  return (is_an_int(atom) | is_a_double(atom));
}


x86 assembly (clang, -O0):
<is_a_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <is_an_int@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <is_a_double@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_a_number>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <is_an_int@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <is_a_double@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @is_a_number(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @is_an_int(i32* %3)
%5 = load i32*, i32** %2
%6 = call i32 @is_a_double(i32* %5)
%7 = or i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @is_a_number(i32* %0) {
%2 = tail call i32 @is_an_int(i32* %0)
%3 = tail call i32 @is_a_double(i32* %0)
%4 = or i32 %3, %2
ret i32 %4
}
int Athena_Private_ShowWindow(void *x) {
  if (!x)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<Athena_Private_ShowWindow>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <Athena_Private_ShowWindow+0x1f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1126 <Athena_Private_ShowWindow+0x26>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Athena_Private_ShowWindow>:
cmp    $0x1,%rdi
sbb    %eax,%eax
ret

LLVM IR (-O0):
define i32 @Athena_Private_ShowWindow(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i32 -1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @Athena_Private_ShowWindow(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = sext i1 %2 to i32
ret i32 %3
}
int test_imm_29int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x29 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_29int64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0x29,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_29int64_highword_mem>:
testb  $0x29,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_29int64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 32
%6 = and i64 %5, 41
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_29int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 176093659136
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int INT_MAX;
void f(void) { int c = INT_MAX + 1; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
@INT_MAX = global i32 0
define void @f() {
%1 = alloca i32
%2 = load i32, i32* @INT_MAX
%3 = add nsw i32 %2, 1
store i32 %3, i32* %1
ret void
}

LLVM IR (-O2):
@INT_MAX = global i32 0
define void @f() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ run();
main(int argc, char *argv[]) {
  run();
  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)
mov    $0x0,%al
call   1030 <run@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <run@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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 = call i32 (...) @run()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @run()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __set_file_attribute(int *);
int *malloc(int);
int open(const char *path, int oflag, ...) {
  int *ret = malloc(sizeof(int));
  if (ret) {
    __set_file_attribute(ret);
    if (ret < (int *)1)
      while (1)
        ;
    return (long)ret;
  }
  return -1;
}


x86 assembly (clang, -O0):
<open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1176 <open+0x56>
mov    -0x20(%rbp),%rdi
call   1040 <__set_file_attribute@plt>
mov    $0x1,%eax
cmp    %rax,-0x20(%rbp)
jae    116a <open+0x4a>
jmp    1165 <open+0x45>
jmp    1165 <open+0x45>
mov    -0x20(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    117d <open+0x5d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open>:
push   %rbx
mov    $0x4,%edi
call   1030 <malloc@plt>
test   %rax,%rax
je     1142 <open+0x22>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <__set_file_attribute@plt>
test   %rbx,%rbx
jne    1147 <open+0x27>
jmp    1140 <open+0x20>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @open(i8* %0, i32 %1, ...) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = call i32* @malloc(i32 4)
store i32* %7, i32** %6
%8 = load i32*, i32** %6
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %21
10: ; preds = %2
%11 = load i32*, i32** %6
%12 = call i32 @__set_file_attribute(i32* %11)
%13 = load i32*, i32** %6
%14 = icmp ult i32* %13, inttoptr (i64 1 to i32*)
br i1 %14, label %15, label %17
15: ; preds = %10
br label %16
16: ; preds = %15, %16
br label %16
17: ; preds = %10
%18 = load i32*, i32** %6
%19 = ptrtoint i32* %18 to i64
%20 = trunc i64 %19 to i32
store i32 %20, i32* %3
br label %22
21: ; preds = %2
store i32 -1, i32* %3
br label %22
22: ; preds = %21, %17
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @open(i8* nocapture readnone %0, i32 %1, ...) {
%3 = tail call i32* @malloc(i32 4)
%4 = icmp eq i32* %3, null
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = tail call i32 @__set_file_attribute(i32* %3)
%7 = icmp ult i32* %3, inttoptr (i64 1 to i32*)
br i1 %7, label %8, label %9
8: ; preds = %5, %8
br label %8
9: ; preds = %5
%10 = ptrtoint i32* %3 to i64
%11 = trunc i64 %10 to i32
br label %12
12: ; preds = %2, %9
%13 = phi i32 [ %11, %9 ], [ -1, %2 ]
ret i32 %13
}
/* Variables and functions */
size_t int_hash(void *i) { return ((size_t)i) % 1024; }


x86 assembly (clang, -O0):
<int_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3ff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_hash>:
mov    %rdi,%rax
and    $0x3ff,%eax
ret

LLVM IR (-O0):
define i64 @int_hash(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = urem i64 %4, 1024
ret i64 %5
}

LLVM IR (-O2):
define i64 @int_hash(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = and i64 %2, 1023
ret i64 %3
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void writel(uint32_t value, uint32_t addr) {
  *((volatile uint32_t *)addr) = value;
}


x86 assembly (clang, -O0):
<writel>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<writel>:
mov    %rdi,(%rsi)
ret

LLVM IR (-O0):
define void @writel(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = inttoptr i64 %6 to i64*
store volatile i64 %5, i64* %7
ret void
}

LLVM IR (-O2):
define void @writel(i64 %0, i64 %1) {
%3 = inttoptr i64 %1 to i64*
store volatile i64 %0, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ repeatme(int /*<<< orphan*/);
int main(int argc, char **argv) {
  repeatme(0);
  printf("done\n");
  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)
xor    %edi,%edi
call   1040 <repeatme@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"done\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 = call i32 @repeatme(i32 0)
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [5 x i8] c"done\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @repeatme(i32 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef unsigned long long uint64_t;

/* Variables and functions */
int bits(uint64_t v) {
  int j = 63;
  while (j > 0 && (v & (1ULL << j)) == 0) {
    j--;
  }
  return j + 1;
}


x86 assembly (clang, -O0):
<bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x3f,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jle    113d <bits+0x3d>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%rdx
mov    %rdx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    114d <bits+0x4d>
jmp    115b <bits+0x5b>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <bits+0xf>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bits>:
mov    $0x3d,%eax
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x2(%rax),%ecx
movzbl %cl,%ecx
bt     %rcx,%rdi
jb     113e <bits+0x3e>
lea    0x1(%rax),%ecx
movzbl %cl,%ecx
bt     %rcx,%rdi
jb     1145 <bits+0x45>
bt     %rax,%rdi
jb     113a <bits+0x3a>
lea    -0x3(%rax),%ecx
cmp    $0x1,%eax
mov    %ecx,%eax
ja     1110 <bits+0x10>
xor    %eax,%eax
add    $0x1,%eax
ret
add    $0x2,%eax
add    $0x1,%eax
ret
add    $0x1,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @bits(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
store i32 63, i32* %3
br label %4
4: ; preds = %16, %1
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i64, i64* %2
%9 = load i32, i32* %3
%10 = zext i32 %9 to i64
%11 = shl i64 1, %10
%12 = and i64 %8, %11
%13 = icmp eq i64 %12, 0
br label %14
14: ; preds = %7, %4
%15 = phi i1 [ false, %4 ], [ %13, %7 ]
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i32, i32* %3
%18 = add nsw i32 %17, -1
store i32 %18, i32* %3
br label %4
19: ; preds = %14
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
ret i32 %21
}

LLVM IR (-O2):
define i32 @bits(i64 %0) {
br label %2
2: ; preds = %20, %1
%3 = phi i32 [ 63, %1 ], [ %21, %20 ]
%4 = zext i32 %3 to i64
%5 = shl nuw i64 1, %4
%6 = and i64 %5, %0
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %23
8: ; preds = %2
%9 = add nsw i32 %3, -1
%10 = zext i32 %9 to i64
%11 = shl nuw i64 1, %10
%12 = and i64 %11, %0
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %8
%15 = add nsw i32 %3, -2
%16 = zext i32 %15 to i64
%17 = shl nuw i64 1, %16
%18 = and i64 %17, %0
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %14
%21 = add nsw i32 %3, -3
%22 = icmp ugt i32 %15, 1
br i1 %22, label %2, label %23
23: ; preds = %20, %14, %8, %2
%24 = phi i32 [ %3, %2 ], [ %9, %8 ], [ %15, %14 ], [ 0, %20 ]
%25 = add nuw nsw i32 %24, 1
ret i32 %25
}
/* Variables and functions */
double sqrt(double);
double dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}


x86 assembly (clang, -O0):
<dist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm3
subsd  -0x20(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist>:
subsd  %xmm2,%xmm0
subsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1133 <dist+0x23>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @dist(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = load double, double* %7
%11 = fsub double %9, %10
%12 = load double, double* %5
%13 = load double, double* %7
%14 = fsub double %12, %13
%15 = load double, double* %6
%16 = load double, double* %8
%17 = fsub double %15, %16
%18 = load double, double* %6
%19 = load double, double* %8
%20 = fsub double %18, %19
%21 = fmul double %17, %20
%22 = call double @llvm.fmuladd.f64(double %11, double %14, double %21)
%23 = call double @sqrt(double %22)
ret double %23
}

LLVM IR (-O2):
define double @dist(double %0, double %1, double %2, double %3) {
%5 = fsub double %0, %2
%6 = fsub double %1, %3
%7 = fmul double %6, %6
%8 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %7)
%9 = tail call double @sqrt(double %8)
ret double %9
}
/* Variables and functions */
double rand();
float frand(void) { return 2.0 * (rand() / 32768.0 - .5); }


x86 assembly (clang, -O0):
<frand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
movaps %xmm0,%xmm1
movsd  0xeea(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xed6(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xec2(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<frand>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
mulsd  0xee0(%rip),%xmm0
addsd  0xee0(%rip),%xmm0
addsd  %xmm0,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @frand() {
%1 = call double (...) @rand()
%2 = fdiv double %1, 3.276800e+04
%3 = fsub double %2, 5.000000e-01
%4 = fmul double 2.000000e+00, %3
%5 = fptrunc double %4 to float
ret float %5
}

LLVM IR (-O2):
define float @frand() {
%1 = tail call double (...) @rand()
%2 = fmul double %1, 0x3F00000000000000
%3 = fadd double %2, -5.000000e-01
%4 = fmul double %3, 2.000000e+00
%5 = fptrunc double %4 to float
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
void appendCharacterist(char *buffer, char characterist) {
  if (characterist == '1') {
    strcat(buffer, "0001");
  } else {
    strcat(buffer, "0010");
  }
}


x86 assembly (clang, -O0):
<appendCharacterist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x31,%eax
jne    1144 <appendCharacterist+0x34>
mov    -0x8(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1030 <strcat@plt>
jmp    1154 <appendCharacterist+0x44>
mov    -0x8(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<appendCharacterist>:
cmp    $0x31,%sil
lea    0xee5(%rip),%rax
lea    0xee3(%rip),%rsi
cmove  %rax,%rsi
jmp    1030 <strcat@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"0001\00"
@.str.1 = [5 x i8] c"0010\00"
define void @appendCharacterist(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 49
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %14
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %11, %8
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"0001\00"
@.str.1 = [5 x i8] c"0010\00"
define void @appendCharacterist(i8* %0, i8 signext %1) {
%3 = icmp eq i8 %1, 49
%4 = select i1 %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 @strcat(i8* %0, i8* %4)
ret void
}
int func1(double d) { return (int)d; }


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func1>:
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @func1(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @func1(double %0) {
%2 = fptosi double %0 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ rmode();
void badexit(int num) {
  rmode();
  printf("Exiting on signal %d\n", num);
  exit(-1);
}


x86 assembly (clang, -O0):
<badexit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <rmode@plt>
mov    -0x4(%rbp),%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<badexit>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <rmode@plt>
lea    0xebf(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Exiting on signal %d\0A\00"
define void @badexit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rmode()
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [22 x i8] c"Exiting on signal %d\0A\00"
define void @badexit(i32 %0) {
%2 = tail call i32 (...) @rmode()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 @exit(i32 -1)
unreachable
}
int report(int n, int ndump) {
  if (ndump > 0) {
    return !(n % ndump);
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<report>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1130 <report+0x30>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1137 <report+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<report>:
test   %esi,%esi
jle    1111 <report+0x11>
mov    %edi,%eax
cltd
idiv   %esi
xor    %eax,%eax
test   %edx,%edx
sete   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @report(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = srem i32 %9, %10
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
store i32 %14, i32* %3
br label %16
15: ; preds = %2
store i32 0, i32* %3
br label %16
16: ; preds = %15, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @report(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = srem i32 %0, %1
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("Hello World\n");
  return EXIT_SUCCESS;
}


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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World\0A\00"
@EXIT_SUCCESS = global i32 0
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 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [12 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 ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x9d() {
  Assert_real((isdigit(157) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              790, ("isdigit should be 0 for 0x9d"));
}


x86 assembly (clang, -O0):
<t_isdigit_0x9d>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9d,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x316,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0x9d>:
push   %rax
mov    $0x9d,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x316,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0x9d\00"
define void @t_isdigit_0x9d() {
%1 = call i64 @isdigit(i32 157)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 790, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0x9d\00"
define void @t_isdigit_0x9d() {
%1 = tail call i64 @isdigit(i32 157)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 790, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
char state(int neighbors, char curr) {
  if (curr == '\n' || curr == '\0')
    return curr;
  switch (neighbors) {
  case 0:
  case 1:
    return '.';
    break;
  case 2:
    return curr;
    break;
  case 3:
    return 'X';
    break;
  case 4:
  case 5:
  case 6:
  case 7:
  case 8:
    return '.';
    break;
  }
}


x86 assembly (clang, -O0):
<state>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
je     1127 <state+0x27>
movsbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    1132 <state+0x32>
mov    -0x9(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    1178 <state+0x78>
mov    -0x8(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x8,%rax
ja     1178 <state+0x78>
mov    -0x18(%rbp),%rax
lea    0xeb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x2e,-0x1(%rbp)
jmp    1178 <state+0x78>
mov    -0x9(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    1178 <state+0x78>
movb   $0x58,-0x1(%rbp)
jmp    1178 <state+0x78>
movb   $0x2e,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<state>:
test   %sil,%sil
je     1117 <state+0x17>
cmp    $0xa,%sil
je     1117 <state+0x17>
cmp    $0x3,%edi
je     111a <state+0x1a>
mov    $0x2e,%al
cmp    $0x2,%edi
jne    111c <state+0x1c>
mov    %esi,%eax
ret
mov    $0x58,%al
ret

LLVM IR (-O0):
define signext i8 @state(i32 %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i8
store i32 %0, i32* %4
store i8 %1, i8* %5
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 10
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9, %2
%14 = load i8, i8* %5
store i8 %14, i8* %3
br label %22
15: ; preds = %9
%16 = load i32, i32* %4
switch i32 %16, label %22 [
i32 0, label %17
i32 1, label %17
i32 2, label %18
i32 3, label %20
i32 4, label %21
i32 5, label %21
i32 6, label %21
i32 7, label %21
i32 8, label %21
]
17: ; preds = %15, %15
store i8 46, i8* %3
br label %22
18: ; preds = %15
%19 = load i8, i8* %5
store i8 %19, i8* %3
br label %22
20: ; preds = %15
store i8 88, i8* %3
br label %22
21: ; preds = %15, %15, %15, %15, %15
store i8 46, i8* %3
br label %22
22: ; preds = %13, %17, %18, %20, %21, %15
%23 = load i8, i8* %3
ret i8 %23
}

LLVM IR (-O2):
define signext i8 @state(i32 %0, i8 signext %1) {
switch i8 %1, label %3 [
i8 10, label %6
i8 0, label %6
]
3: ; preds = %2
switch i32 %0, label %6 [
i32 3, label %5
i32 2, label %4
]
4: ; preds = %3
br label %6
5: ; preds = %3
br label %6
6: ; preds = %2, %2, %4, %5, %3
%7 = phi i8 [ 88, %5 ], [ %1, %4 ], [ %1, %2 ], [ %1, %2 ], [ 46, %3 ]
ret i8 %7
}
void *String_ctor(const char *str) { return 0; }


x86 assembly (clang, -O0):
<String_ctor>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<String_ctor>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @String_ctor(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @String_ctor(i8* nocapture readnone %0) {
ret i8* null
}