xunge/DecIR huggingface dataset:
int gstInt2Word(int integer) {
  int value;
  if (integer > 32767)
    integer = 32767;
  if (integer < -32768)
    integer = -32768;
  if (integer < 0)
    value = ((-integer) ^ 65535) + 1;
  else
    value = integer;
  return value;
}


x86 assembly (clang, -O0):
<gstInt2Word>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x7fff,-0x4(%rbp)
jle    111b <gstInt2Word+0x1b>
movl   $0x7fff,-0x4(%rbp)
cmpl   $0xffff8000,-0x4(%rbp)
jge    112f <gstInt2Word+0x2f>
movl   $0xffff8000,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    114e <gstInt2Word+0x4e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
xor    $0xffff,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <gstInt2Word+0x54>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gstInt2Word>:
cmp    $0x7fff,%edi
mov    $0x7fff,%eax
cmovl  %edi,%eax
cmp    $0xffff8001,%eax
mov    $0xffff8000,%ecx
cmovge %eax,%ecx
mov    %ecx,%eax
neg    %eax
xor    $0xffff,%eax
add    $0x1,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @gstInt2Word(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 32767
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 32767, i32* %2
br label %7
7: ; preds = %6, %1
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, -32768
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 -32768, i32* %2
br label %11
11: ; preds = %10, %7
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i32, i32* %2
%16 = sub nsw i32 0, %15
%17 = xor i32 %16, 65535
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %21
19: ; preds = %11
%20 = load i32, i32* %2
store i32 %20, i32* %3
br label %21
21: ; preds = %19, %14
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @gstInt2Word(i32 %0) {
%2 = icmp slt i32 %0, 32767
%3 = select i1 %2, i32 %0, i32 32767
%4 = icmp sgt i32 %3, -32768
%5 = select i1 %4, i32 %3, i32 -32768
%6 = icmp slt i32 %5, 0
%7 = sub nsw i32 0, %5
%8 = xor i32 %7, 65535
%9 = add nsw i32 %8, 1
%10 = select i1 %6, i32 %9, i32 %5
ret i32 %10
}
void skipwhite(char **s) {
  while (((**s) == ' ' || (**s) == '\t'))
    (*s)++;
}


x86 assembly (clang, -O0):
<skipwhite>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     1133 <skipwhite+0x33>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1143 <skipwhite+0x43>
jmp    1156 <skipwhite+0x56>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1108 <skipwhite+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipwhite>:
mov    (%rdi),%rax
jmp    1113 <skipwhite+0x13>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,(%rdi)
add    $0x1,%rax
movzbl -0x1(%rax),%ecx
cmp    $0x20,%cl
je     1110 <skipwhite+0x10>
cmp    $0x9,%cl
je     1110 <skipwhite+0x10>
ret

LLVM IR (-O0):
define void @skipwhite(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
br label %3
3: ; preds = %17, %1
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 32
br i1 %8, label %15, label %9
9: ; preds = %3
%10 = load i8**, i8*** %2
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 9
br label %15
15: ; preds = %9, %3
%16 = phi i1 [ true, %3 ], [ %14, %9 ]
br i1 %16, label %17, label %21
17: ; preds = %15
%18 = load i8**, i8*** %2
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %18
br label %3
21: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @skipwhite(i8** nocapture %0) {
%2 = load i8*, i8** %0
br label %3
3: ; preds = %6, %1
%4 = phi i8* [ %7, %6 ], [ %2, %1 ]
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 32, label %6
i8 9, label %6
]
6: ; preds = %3, %3
%7 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %7, i8** %0
br label %3
8: ; preds = %3
ret void
}
struct atcp_protocol *atcp_convert(struct common_protocol *cproto) {
  return (struct atcp_protocol *)cproto;
}


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

x86 assembly (clang, -O2):
<atcp_convert>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
%struct.atcp_protocol = type opaque
%struct.common_protocol = type opaque
define %struct.atcp_protocol* @atcp_convert(%struct.common_protocol* %0) {
%2 = alloca %struct.common_protocol*
store %struct.common_protocol* %0, %struct.common_protocol** %2
%3 = load %struct.common_protocol*, %struct.common_protocol** %2
%4 = bitcast %struct.common_protocol* %3 to %struct.atcp_protocol*
ret %struct.atcp_protocol* %4
}

LLVM IR (-O2):
%struct.atcp_protocol = type opaque
%struct.common_protocol = type opaque
define %struct.atcp_protocol* @atcp_convert(%struct.common_protocol* readnone %0) {
%2 = bitcast %struct.common_protocol* %0 to %struct.atcp_protocol*
ret %struct.atcp_protocol* %2
}
double Variance(int i, int j, double **delta) {
  if (i > j)
    return (delta[j][i]);
  else
    return (delta[i][j]);
}


x86 assembly (clang, -O0):
<Variance>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1139 <Variance+0x39>
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1153 <Variance+0x53>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Variance>:
cmp    %esi,%edi
mov    %edi,%eax
cmovg  %esi,%eax
cmovg  %edi,%esi
cltq
mov    (%rdx,%rax,8),%rax
movslq %esi,%rcx
movsd  (%rax,%rcx,8),%xmm0
ret

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

LLVM IR (-O2):
define double @Variance(i32 %0, i32 %1, double** nocapture %2) {
%4 = icmp sgt i32 %0, %1
%5 = select i1 %4, i32 %1, i32 %0
%6 = select i1 %4, i32 %0, i32 %1
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds double*, double** %2, i64 %7
%9 = load double*, double** %8
%10 = sext i32 %6 to i64
%11 = getelementptr inbounds double, double* %9, i64 %10
%12 = load double, double* %11
ret double %12
}
unsigned long signext16(unsigned short a) {
  if (a & 0x8000) {
    return (unsigned long)a | 0xffff0000;
  }
  return a;
}


x86 assembly (clang, -O0):
<signext16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     1137 <signext16+0x37>
movzwl -0xa(%rbp),%eax
movabs $0xffff0000,%rcx
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    113f <signext16+0x3f>
movzwl -0xa(%rbp),%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<signext16>:
mov    %edi,%ecx
mov    $0xffff0000,%eax
or     %rcx,%rax
test   %di,%di
cmovns %rcx,%rax
ret

LLVM IR (-O0):
define i64 @signext16(i16 zeroext %0) {
%2 = alloca i64
%3 = alloca i16
store i16 %0, i16* %3
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 32768
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i16, i16* %3
%10 = zext i16 %9 to i64
%11 = or i64 %10, 4294901760
store i64 %11, i64* %2
br label %15
12: ; preds = %1
%13 = load i16, i16* %3
%14 = zext i16 %13 to i64
store i64 %14, i64* %2
br label %15
15: ; preds = %12, %8
%16 = load i64, i64* %2
ret i64 %16
}

LLVM IR (-O2):
define i64 @signext16(i16 zeroext %0) {
%2 = icmp sgt i16 %0, -1
%3 = zext i16 %0 to i64
%4 = or i64 %3, 4294901760
%5 = select i1 %2, i64 %3, i64 %4
ret i64 %5
}
signed short b_ss(signed short a, signed char *b, int *c) {
  signed short d = a - *b;
  *c = d == 0;
  return d;
}


x86 assembly (clang, -O0):
<b_ss>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movswl -0x2(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
mov    %ax,-0x1a(%rbp)
movswl -0x1a(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movswl -0x1a(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_ss>:
mov    %edi,%eax
movsbl (%rsi),%ecx
xor    %esi,%esi
sub    %cx,%ax
sete   %sil
mov    %esi,(%rdx)
ret

LLVM IR (-O0):
define signext i16 @b_ss(i16 signext %0, i8* %1, i32* %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i16
store i16 %0, i16* %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%8 = load i16, i16* %4
%9 = sext i16 %8 to i32
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = sub nsw i32 %9, %12
%14 = trunc i32 %13 to i16
store i16 %14, i16* %7
%15 = load i16, i16* %7
%16 = sext i16 %15 to i32
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
%19 = load i32*, i32** %6
store i32 %18, i32* %19
%20 = load i16, i16* %7
ret i16 %20
}

LLVM IR (-O2):
define signext i16 @b_ss(i16 signext %0, i8* nocapture %1, i32* nocapture writeonly %2) {
%4 = load i8, i8* %1
%5 = sext i8 %4 to i16
%6 = sub i16 %0, %5
%7 = icmp eq i16 %6, 0
%8 = zext i1 %7 to i32
store i32 %8, i32* %2
ret i16 %6
}
void InitADC() {
  (*(char *)0x5400) = 0x29;
  (*(char *)0x5401) = 0x42;
  (*(char *)0x5402) = 0x40;
  (*(char *)0x5403) = 0x00;
  (*(char *)0x5401) |= (1 << 0);
}


x86 assembly (clang, -O0):
<InitADC>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5400,%eax
movb   $0x29,(%rax)
mov    $0x5401,%eax
movb   $0x42,(%rax)
mov    $0x5402,%eax
movb   $0x40,(%rax)
mov    $0x5403,%eax
movb   $0x0,(%rax)
mov    $0x5401,%eax
movsbl (%rax),%eax
or     $0x1,%eax
mov    %al,%cl
mov    $0x5401,%eax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<InitADC>:
movb   $0x29,0x5400
29
movb   $0x42,0x5401
42
movb   $0x40,0x5402
40
movb   $0x0,0x5403
orb    $0x1,0x5401
01
ret

LLVM IR (-O0):
define void @InitADC() {
store i8 41, i8* inttoptr (i64 21504 to i8*)
store i8 66, i8* inttoptr (i64 21505 to i8*)
store i8 64, i8* inttoptr (i64 21506 to i8*)
store i8 0, i8* inttoptr (i64 21507 to i8*)
%1 = load i8, i8* inttoptr (i64 21505 to i8*)
%2 = sext i8 %1 to i32
%3 = or i32 %2, 1
%4 = trunc i32 %3 to i8
store i8 %4, i8* inttoptr (i64 21505 to i8*)
ret void
}

LLVM IR (-O2):
define void @InitADC() {
store i8 41, i8* inttoptr (i64 21504 to i8*)
store i8 66, i8* inttoptr (i64 21505 to i8*)
store i8 64, i8* inttoptr (i64 21506 to i8*)
store i8 0, i8* inttoptr (i64 21507 to i8*)
%1 = load i8, i8* inttoptr (i64 21505 to i8*)
%2 = or i8 %1, 1
store i8 %2, i8* inttoptr (i64 21505 to i8*)
ret void
}
int test_imm_B5int8_mem(signed char *val) {
  return ((*val) & (-0xB5 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B5int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xffffff4b,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B5int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff4b,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_B5int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -181
%7 = icmp ne i32 %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_B5int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -181
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *, char const *);
void version(const char *prog, const char *vers) {
  printf("%s -- part of DOMjudge version %s\nWritten by the DOMjudge "
         "developers\n\nDOMjudge comes with ABSOLUTELY NO WARRANTY.  This is "
         "free software, and you\nare welcome to redistribute it under certain "
         "conditions.  See the GNU\nGeneral Public Licence for details.\n",
         prog, vers);
  exit(0);
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<version>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [253 x i8] c"%s -- part of DOMjudge version %s\0AWritten by the DOMjudge developers\0A\0ADOMjudge comes with ABSOLUTELY NO WARRANTY. This is free software, and you\0Aare welcome to redistribute it under certain conditions. See the GNU\0AGeneral Public Licence for details.\0A\00"
define void @version(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 = load i8*, i8** %4
%7 = call i32 @printf(i8* getelementptr inbounds ([253 x i8], [253 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [253 x i8] c"%s -- part of DOMjudge version %s\0AWritten by the DOMjudge developers\0A\0ADOMjudge comes with ABSOLUTELY NO WARRANTY. This is free software, and you\0Aare welcome to redistribute it under certain conditions. See the GNU\0AGeneral Public Licence for details.\0A\00"
define void @version(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([253 x i8], [253 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ parallel_clr_ndac(int);
int /*<<< orphan*/ parallel_set_ndac(int);
void parallel_drv0_set_ndac(unsigned char val) {
  if (val) {
    parallel_set_ndac(0x04);
  } else {
    parallel_clr_ndac(~0x04);
  }
}


x86 assembly (clang, -O0):
<parallel_drv0_set_ndac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
cmpb   $0x0,-0x1(%rbp)
je     1147 <parallel_drv0_set_ndac+0x27>
mov    $0x4,%edi
call   1040 <parallel_set_ndac@plt>
jmp    1151 <parallel_drv0_set_ndac+0x31>
mov    $0xfffffffb,%edi
call   1030 <parallel_clr_ndac@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parallel_drv0_set_ndac>:
test   %edi,%edi
je     112e <parallel_drv0_set_ndac+0xe>
mov    $0x4,%edi
jmp    1040 <parallel_set_ndac@plt>
mov    $0xfffffffb,%edi
jmp    1030 <parallel_clr_ndac@plt>

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

LLVM IR (-O2):
define void @parallel_drv0_set_ndac(i8 zeroext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @parallel_set_ndac(i32 4)
br label %7
5: ; preds = %1
%6 = tail call i32 @parallel_clr_ndac(i32 -5)
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int, int, int);
void dump3i(int *v, char *prefix) {
  printf("%s %8i %8i %8i\n", prefix, v[0], v[1], v[2]);
}


x86 assembly (clang, -O0):
<dump3i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%r8d
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump3i>:
mov    (%rdi),%edx
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%r8d
lea    0xee0(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [16 x i8] c"%s %8i %8i %8i\0A\00"
define void @dump3i(i32* nocapture %0, i8* %1) {
%3 = load i32, i32* %0
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = getelementptr inbounds i32, i32* %0, i64 2
%7 = load i32, i32* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %3, i32 %5, i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
char *mk_addr(int level) {
  static char buffer[100];
  sprintf(buffer,
          "levels/level"
          "%d"
          ".txt",
          level);
  return buffer;
}


x86 assembly (clang, -O0):
<mk_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0x2f1b(%rip),%rdi
lea    0xed4(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2f08(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mk_addr>:
push   %rbx
mov    %edi,%edx
lea    0x2f26(%rip),%rbx
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@mk_addr.buffer = internal global [100 x i8] zeroinitializer
@.str = [19 x i8] c"levels/level%d.txt\00"
define i8* @mk_addr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @sprintf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @mk_addr.buffer, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @mk_addr.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
@mk_addr.buffer = internal global [100 x i8] zeroinitializer
@.str = [19 x i8] c"levels/level%d.txt\00"
define i8* @mk_addr(i32 %0) {
%2 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @mk_addr.buffer, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @mk_addr.buffer, i64 0, i64 0)
}
/* Variables and functions */
int memcpy(int, int, int);
__memcpy_tofs(int x, int y, int z) { return memcpy(x, y, z); }


x86 assembly (clang, -O0):
<__memcpy_tofs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__memcpy_tofs>:
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define i32 @__memcpy_tofs(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @memcpy(i32 %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @__memcpy_tofs(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @memcpy(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
scalar_t__ pow(double, int);
double sqrt(scalar_t__);
double distance(double x1, double y1, double x2, double y2) {
  return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}


x86 assembly (clang, -O0):
<distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    -0x28(%rbp),%rdi
add    %rax,%rdi
call   1040 <sqrt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm3,0x8(%rsp)
movsd  %xmm1,(%rsp)
subsd  %xmm2,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,%rbx
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define double @distance(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 = call i64 @pow(double %11, i32 2)
%13 = load double, double* %6
%14 = load double, double* %8
%15 = fsub double %13, %14
%16 = call i64 @pow(double %15, i32 2)
%17 = add nsw i64 %12, %16
%18 = call double @sqrt(i64 %17)
ret double %18
}

LLVM IR (-O2):
define double @distance(double %0, double %1, double %2, double %3) {
%5 = fsub double %0, %2
%6 = tail call i64 @pow(double %5, i32 2)
%7 = fsub double %1, %3
%8 = tail call i64 @pow(double %7, i32 2)
%9 = add nsw i64 %8, %6
%10 = tail call double @sqrt(i64 %9)
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ a10(int);
void a9(int n) { a10(n); }


x86 assembly (clang, -O0):
<a9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <a10@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a9>:
jmp    1030 <a10@plt>

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

LLVM IR (-O2):
define void @a9(i32 %0) {
%2 = tail call i32 @a10(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ cbrtl(double);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
main() {
  if ((int)(cbrtl(27.0) + 0.5) != 3)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec1(%rip),%xmm0
call   1040 <cbrtl@plt>
cvtsi2sd %rax,%xmm0
movsd  0xea7(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
cmp    $0x3,%eax
je     1171 <main+0x41>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xec7(%rip),%xmm0
call   1040 <cbrtl@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0xeba(%rip),%xmm0
cvttsd2si %xmm0,%eax
cmp    $0x3,%eax
jne    115e <main+0x2e>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @cbrtl(double 2.700000e+01)
%3 = sitofp i64 %2 to double
%4 = fadd double %3, 5.000000e-01
%5 = fptosi double %4 to i32
%6 = icmp ne i32 %5, 3
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %0
%10 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @cbrtl(double 2.700000e+01)
%2 = sitofp i64 %1 to double
%3 = fadd double %2, 5.000000e-01
%4 = fptosi double %3 to i32
%5 = icmp eq i32 %4, 3
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef char *int64_t;

/* Variables and functions */
int64_t rdtsc() {
  int64_t ret;
  __asm__ volatile("rdtsc" : "=A"(ret) : :);
  return ret;
}


x86 assembly (clang, -O0):
<rdtsc>:
push   %rbp
mov    %rsp,%rbp
rdtsc
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @rdtsc() {
%1 = alloca i8*
%2 = call i8* asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
ret i8* %3
}

LLVM IR (-O2):
define i8* @rdtsc() {
%1 = tail call i8* asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0x88() {
  Assert_real((isalpha(136) == 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_isalpha.c",
              685, ("isalpha should be 0 for 0x88"));
}


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

x86 assembly (clang, -O2):
<t_isalpha_0x88>:
push   %rax
mov    $0x88,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x2ad,%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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0x88\00"
define void @t_isalpha_0x88() {
%1 = call i64 @isalpha(i32 136)
%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 685, 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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0x88\00"
define void @t_isalpha_0x88() {
%1 = tail call i64 @isalpha(i32 136)
%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 685, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void finn_root_draw() {}


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

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

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

LLVM IR (-O2):
define void @finn_root_draw() {
ret void
}
int stringlength2(char *s) {
  char *p = s;
  while (*(++p) != '\0')
    ;
  return p - s;
}


x86 assembly (clang, -O0):
<stringlength2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     1131 <stringlength2+0x31>
jmp    1110 <stringlength2+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringlength2>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <stringlength2+0x10>
ret

LLVM IR (-O0):
define i32 @stringlength2(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 = %11, %1
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %5
br label %5
12: ; preds = %5
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
%18 = trunc i64 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @stringlength2(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %4 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void fail(void) { exit(2); }


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<fail>:
push   %rax
mov    $0x2,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @fail() {
%1 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
define void @fail() {
%1 = tail call i32 @exit(i32 2)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ CX4_immediate_reg(int);
void CX4_op6a(void) { CX4_immediate_reg(18); }


x86 assembly (clang, -O0):
<CX4_op6a>:
push   %rbp
mov    %rsp,%rbp
mov    $0x12,%edi
call   1030 <CX4_immediate_reg@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CX4_op6a>:
mov    $0x12,%edi
jmp    1030 <CX4_immediate_reg@plt>

LLVM IR (-O0):
define void @CX4_op6a() {
%1 = call i32 @CX4_immediate_reg(i32 18)
ret void
}

LLVM IR (-O2):
define void @CX4_op6a() {
%1 = tail call i32 @CX4_immediate_reg(i32 18)
ret void
}
void RTMemEfAllocZVarNP(void) {}


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

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

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

LLVM IR (-O2):
define void @RTMemEfAllocZVarNP() {
ret void
}
/* Variables and functions */
int rand();
int randomRange(int range) { return (rand() % range) + 1; }


x86 assembly (clang, -O0):
<randomRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomRange>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
lea    0x1(%rdx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @randomRange(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
%6 = add nsw i32 %5, 1
ret i32 %6
}

LLVM IR (-O2):
define i32 @randomRange(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
%4 = add nsw i32 %3, 1
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int wclear(WINDOW *w) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @wclear(i32* nocapture readnone %0) {
ret i32 0
}
unsigned int Ones(mask)
unsigned long mask;
{
  register unsigned long y;
  y = (mask >> 1) & 033333333333;
  y = mask - y - ((y >> 1) & 033333333333);
  return ((unsigned int)(((y + (y >> 3)) & 030707070707) % 077));
}


x86 assembly (clang, -O0):
<Ones>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
movabs $0xdb6db6db,%rcx
and    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x1,%rcx
movabs $0xdb6db6db,%rdx
and    %rdx,%rcx
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x3,%rcx
add    %rcx,%rax
movabs $0xc71c71c7,%rcx
and    %rcx,%rax
mov    $0x3f,%ecx
xor    %edx,%edx
div    %rcx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ones>:
mov    %rdi,%rax
shr    %rax
and    $0xdb6db6db,%eax
mov    %rdi,%rcx
shr    $0x2,%rcx
and    $0x49249249,%ecx
add    %rax,%rcx
sub    %rcx,%rdi
mov    %rdi,%rcx
shr    $0x3,%rcx
add    %edi,%ecx
and    $0xc71c71c7,%ecx
imul   $0x4104105,%rcx,%rdx
shr    $0x20,%rdx
mov    %ecx,%eax
sub    %edx,%eax
shr    %eax
add    %edx,%eax
shr    $0x5,%eax
mov    %eax,%edx
shl    $0x6,%edx
sub    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @Ones(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = lshr i64 %4, 1
%6 = and i64 %5, 3681400539
store i64 %6, i64* %3
%7 = load i64, i64* %2
%8 = load i64, i64* %3
%9 = sub i64 %7, %8
%10 = load i64, i64* %3
%11 = lshr i64 %10, 1
%12 = and i64 %11, 3681400539
%13 = sub i64 %9, %12
store i64 %13, i64* %3
%14 = load i64, i64* %3
%15 = load i64, i64* %3
%16 = lshr i64 %15, 3
%17 = add i64 %14, %16
%18 = and i64 %17, 3340530119
%19 = urem i64 %18, 63
%20 = trunc i64 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @Ones(i64 %0) {
%2 = lshr i64 %0, 1
%3 = and i64 %2, 3681400539
%4 = lshr i64 %0, 2
%5 = and i64 %4, 1227133513
%6 = add nuw nsw i64 %5, %3
%7 = sub i64 %0, %6
%8 = lshr i64 %7, 3
%9 = add i64 %8, %7
%10 = trunc i64 %9 to i32
%11 = and i32 %10, -954437177
%12 = urem i32 %11, 63
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ fexpect(char *, int, int, int);
void test_signedcast() {
  unsigned char c = -1;
  int i = (signed char)c;
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/cast.c",
          9, i, -1);
  ;
}


x86 assembly (clang, -O0):
<test_signedcast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0xff,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
lea    0xed3(%rip),%rdi
mov    $0x9,%esi
mov    $0xffffffff,%ecx
call   1030 <fexpect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_signedcast>:
lea    0xee9(%rip),%rdi
mov    $0x9,%esi
mov    $0xffffffff,%edx
mov    $0xffffffff,%ecx
jmp    1030 <fexpect@plt>

LLVM IR (-O0):
@.str = [127 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/cast.c\00"
define void @test_signedcast() {
%1 = alloca i8
%2 = alloca i32
store i8 -1, i8* %1
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @fexpect(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str, i64 0, i64 0), i32 9, i32 %5, i32 -1)
ret void
}

LLVM IR (-O2):
@.str = [127 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/cast.c\00"
define void @test_signedcast() {
%1 = tail call i32 @fexpect(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str, i64 0, i64 0), i32 9, i32 -1, i32 -1)
ret void
}
adrreg0adr1(r0, r1, x0, x1, p0, p1) double r0, r1;
double *p0, *p1;
{
  if ((p0[10000000]) <= (*((double *)(11111111 & ~(__alignof__(double) - 1)))))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adrreg0adr1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x4c4b400(%rax),%xmm1
04
mov    $0xa98ac0,%eax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1147 <adrreg0adr1+0x47>
movl   $0x1,-0x4(%rbp)
jmp    114e <adrreg0adr1+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrreg0adr1>:
movsd  0xa98ac0,%xmm0
xor    %eax,%eax
ucomisd 0x4c4b400(%rdx),%xmm0
04
setae  %al
ret

LLVM IR (-O0):
define i32 @adrreg0adr1(double %0, double %1, i32 %2, i32 %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
store double %0, double* %8
store double %1, double* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
%14 = load double*, double** %12
%15 = getelementptr inbounds double, double* %14, i64 10000000
%16 = load double, double* %15
%17 = load double, double* inttoptr (i64 11111104 to double*)
%18 = fcmp ole double %16, %17
br i1 %18, label %19, label %20
19: ; preds = %6
store i32 1, i32* %7
br label %21
20: ; preds = %6
store i32 0, i32* %7
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @adrreg0adr1(double %0, double %1, i32 %2, i32 %3, double* nocapture %4, double* nocapture readnone %5) {
%7 = getelementptr inbounds double, double* %4, i64 10000000
%8 = load double, double* %7
%9 = load double, double* inttoptr (i64 11111104 to double*)
%10 = fcmp ole double %8, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ ap_base64decode(char *, char *, int);
int ap_base64decode_len(char *, int);
scalar_t__ malloc(int);
char *b64_decode(char *buf) {
  int elen;
  char *out;
  elen = ap_base64decode_len(buf, -1);
  out = (char *)malloc(sizeof(char) * (elen + 1));
  ap_base64decode(out, buf, -1);
  return out;
}


x86 assembly (clang, -O0):
<b64_decode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xffffffff,%esi
call   1050 <ap_base64decode_len@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0xffffffff,%edx
call   1030 <ap_base64decode@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b64_decode>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0xffffffff,%esi
call   1050 <ap_base64decode_len@plt>
lea    0x1(%rax),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    $0xffffffff,%edx
call   1030 <ap_base64decode@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @b64_decode(i8* %0) {
%2 = tail call i32 @ap_base64decode_len(i8* %0, i32 -1)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @ap_base64decode(i8* %5, i8* %0, i32 -1)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
void *realloc(void *, size_t);
void *xrealloc(void *ptr, size_t size) {
  ptr = realloc(ptr, size);
  if (ptr == NULL && size != 0)
    perror("no memory");
  return ptr;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1163 <xrealloc+0x43>
cmpq   $0x0,-0x10(%rbp)
je     1163 <xrealloc+0x43>
lea    0xea2(%rip),%rdi
call   1040 <perror@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <realloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1139 <xrealloc+0x19>
test   %r14,%r14
je     1144 <xrealloc+0x24>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xeb5(%rip),%rdi
call   1040 <perror@plt>
jmp    1139 <xrealloc+0x19>

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

LLVM IR (-O2):
@.str = [10 x i8] c"no memory\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i64 %1, 0
%6 = and i1 %5, %4
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
ret i8* %3
}
int util_isspace(char c) {
  return (c == ' ' || c == '\t' || c == '\n' || c == '\12');
}


x86 assembly (clang, -O0):
<util_isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     114d <util_isspace+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x2(%rbp)
je     114d <util_isspace+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
je     114d <util_isspace+0x4d>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_isspace>:
cmp    $0x20,%dil
sete   %al
add    $0xf7,%dil
cmp    $0x2,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @util_isspace(i8 signext %0) {
%2 = icmp eq i8 %0, 32
%3 = add i8 %0, -9
%4 = icmp ult i8 %3, 2
%5 = or i1 %2, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ tmpnam(char *);
void uninitvar_tmpnam(void) {
  char *s;
  (void)tmpnam(s);
}


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

x86 assembly (clang, -O2):
<uninitvar_tmpnam>:
jmp    1030 <tmpnam@plt>

LLVM IR (-O0):
define void @uninitvar_tmpnam() {
%1 = alloca i8*
%2 = load i8*, i8** %1
%3 = call i32 @tmpnam(i8* %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_tmpnam() {
%1 = tail call i32 @tmpnam(i8* undef)
ret void
}
double ease_in_out_quad(double t) {
  double p = t * 2.0;
  if (p < 1)
    return 0.5 * p * p;
  p -= 1;
  return -0.5 * (p * (p - 2) - 1);
}


x86 assembly (clang, -O0):
<ease_in_out_quad>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xedd(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    114a <ease_in_out_quad+0x4a>
movsd  0xeea(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1197 <ease_in_out_quad+0x97>
movsd  -0x18(%rbp),%xmm0
movsd  0xea9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xe96(%rip),%xmm2
subsd  %xmm2,%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe96(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe82(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ease_in_out_quad>:
addsd  %xmm0,%xmm0
movsd  0xef4(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1127 <ease_in_out_quad+0x27>
movsd  0xf06(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret
movsd  0xed9(%rip),%xmm2
addsd  %xmm2,%xmm0
movsd  0xed5(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
mulsd  0xec9(%rip),%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ease_in_out_quad(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = fmul double %5, 2.000000e+00
store double %6, double* %4
%7 = load double, double* %4
%8 = fcmp olt double %7, 1.000000e+00
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load double, double* %4
%11 = fmul double 5.000000e-01, %10
%12 = load double, double* %4
%13 = fmul double %11, %12
store double %13, double* %2
br label %22
14: ; preds = %1
%15 = load double, double* %4
%16 = fsub double %15, 1.000000e+00
store double %16, double* %4
%17 = load double, double* %4
%18 = load double, double* %4
%19 = fsub double %18, 2.000000e+00
%20 = call double @llvm.fmuladd.f64(double %17, double %19, double -1.000000e+00)
%21 = fmul double -5.000000e-01, %20
store double %21, double* %2
br label %22
22: ; preds = %14, %9
%23 = load double, double* %2
ret double %23
}

LLVM IR (-O2):
define double @ease_in_out_quad(double %0) {
%2 = fmul double %0, 2.000000e+00
%3 = fcmp olt double %2, 1.000000e+00
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = fmul double %2, 5.000000e-01
%6 = fmul double %2, %5
br label %12
7: ; preds = %1
%8 = fadd double %2, -1.000000e+00
%9 = fadd double %8, -2.000000e+00
%10 = tail call double @llvm.fmuladd.f64(double %8, double %9, double -1.000000e+00)
%11 = fmul double %10, -5.000000e-01
br label %12
12: ; preds = %7, %4
%13 = phi double [ %6, %4 ], [ %11, %7 ]
ret double %13
}