xunge/DecIR huggingface dataset:
float *sumVectors(const float *v1, const float *v2) {
  int flen = (sizeof(v1) / sizeof((v1)[0])) + 1;
  int slen = (sizeof(v2) / sizeof((v2)[0])) + 1;
  float result[] = {0, 0, 0};
  if (flen != slen) {
    return result;
  }
  int i;
  for (i = 0; i < flen; i++) {
    result[i] = v1[i] + v2[i];
  }
  return result;
}


x86 assembly (clang, -O0):
<sumVectors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x3,-0x1c(%rbp)
movl   $0x3,-0x20(%rbp)
lea    -0x2c(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1030 <memset@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
je     1157 <sumVectors+0x47>
lea    -0x2c(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11a4 <sumVectors+0x94>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    119c <sumVectors+0x8c>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
movslq -0x30(%rbp),%rax
movss  %xmm0,-0x2c(%rbp,%rax,4)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    115e <sumVectors+0x4e>
lea    -0x2c(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumVectors>:
lea    -0xc(%rsp),%rax
ret

LLVM IR (-O0):
define float* @sumVectors(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [3 x float]
%9 = alloca i32
store float* %0, float** %4
store float* %1, float** %5
store i32 3, i32* %6
store i32 3, i32* %7
%10 = bitcast [3 x float]* %8 to i8*
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
store float* %15, float** %3
br label %41
16: ; preds = %2
store i32 0, i32* %9
br label %17
17: ; preds = %36, %16
%18 = load i32, i32* %9
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %39
21: ; preds = %17
%22 = load float*, float** %4
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds float, float* %22, i64 %24
%26 = load float, float* %25
%27 = load float*, float** %5
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds float, float* %27, i64 %29
%31 = load float, float* %30
%32 = fadd float %26, %31
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 %34
store float %32, float* %35
br label %36
36: ; preds = %21
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
br label %17
39: ; preds = %17
%40 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
store float* %40, float** %3
br label %41
41: ; preds = %39, %14
%42 = load float*, float** %3
ret float* %42
}

LLVM IR (-O2):
define noalias float* @sumVectors(float* nocapture %0, float* nocapture %1) {
%3 = alloca [3 x float]
%4 = bitcast [3 x float]* %3 to i8*
%5 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
ret float* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void testf() { printf("does this work?"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"does this work?\00"
define void @testf() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"does this work?\00"
define void @testf() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int SubEvt_id(void const *);
uint32_t SubEvt_pureId(const void *my) { return SubEvt_id(my) & 0x7fffffffUL; }


x86 assembly (clang, -O0):
<SubEvt_pureId>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <SubEvt_id@plt>
cltq
and    $0x7fffffff,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SubEvt_pureId>:
push   %rax
call   1030 <SubEvt_id@plt>
and    $0x7fffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @SubEvt_pureId(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @SubEvt_id(i8* %3)
%5 = sext i32 %4 to i64
%6 = and i64 %5, 2147483647
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @SubEvt_pureId(i8* %0) {
%2 = tail call i32 @SubEvt_id(i8* %0)
%3 = and i32 %2, 2147483647
ret i32 %3
}
/* Variables and functions */
long abs(long number) {
  if (number < 0)
    return number * (-1);
  return number;
}


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1121 <abs+0x21>
imul   $0xffffffffffffffff,-0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1129 <abs+0x29>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @abs(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i64, i64* %3
%8 = mul nsw i64 %7, -1
store i64 %8, i64* %2
br label %11
9: ; preds = %1
%10 = load i64, i64* %3
store i64 %10, i64* %2
br label %11
11: ; preds = %9, %6
%12 = load i64, i64* %2
ret i64 %12
}

LLVM IR (-O2):
define i64 @abs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t dev_get_blocklen(int fd) { return 512; }


x86 assembly (clang, -O0):
<dev_get_blocklen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x200,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @dev_get_blocklen(i32 %0) {
ret i32 512
}
/* Variables and functions */
int /*<<< orphan*/ link_failure_sqrtl();
scalar_t__ sqrtl(long double);
void test_sqrtl(long double ld) {
  if (sqrtl(ld) != sqrtl(ld))
    link_failure_sqrtl();
}


x86 assembly (clang, -O0):
<test_sqrtl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <sqrtl@plt>
mov    %rax,-0x18(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <sqrtl@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     1163 <test_sqrtl+0x43>
mov    $0x0,%al
call   1040 <link_failure_sqrtl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_sqrtl>:
push   %rbx
sub    $0x20,%rsp
fldt   0x30(%rsp)
fld    %st(0)
fstpt  0x14(%rsp)
fstpt  (%rsp)
call   1030 <sqrtl@plt>
mov    %rax,%rbx
fldt   0x14(%rsp)
fstpt  (%rsp)
call   1030 <sqrtl@plt>
cmp    %rax,%rbx
jne    1151 <test_sqrtl+0x31>
add    $0x20,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
jmp    1040 <link_failure_sqrtl@plt>

LLVM IR (-O0):
define void @test_sqrtl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call i64 @sqrtl(x86_fp80 %3)
%5 = load x86_fp80, x86_fp80* %2
%6 = call i64 @sqrtl(x86_fp80 %5)
%7 = icmp ne i64 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @link_failure_sqrtl()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @test_sqrtl(x86_fp80 %0) {
%2 = tail call i64 @sqrtl(x86_fp80 %0)
%3 = tail call i64 @sqrtl(x86_fp80 %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_sqrtl()
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ doUpper();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Enter A String: ");
  doUpper();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <doUpper@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [17 x i8] c"Enter A String: \00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @doUpper()
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter A String: \00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @doUpper()
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void AESReset(uint32_t ui32Base) {
  ASSERT(ui32Base == 0x44036000);
  (*((volatile uint32_t *)(ui32Base + 0x00000084))) |= 0x00000002;
  while (((*((volatile uint32_t *)(ui32Base + 0x00000088))) & 0x00000001) ==
         0) {
  }
}


x86 assembly (clang, -O0):
<AESReset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x44036000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x84,%eax
cltq
mov    (%rax),%ecx
or     $0x2,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x88,%eax
cltq
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    115d <AESReset+0x4d>
jmp    1140 <AESReset+0x30>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AESReset>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x44036000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
orl    $0x2,0x84(%rax)
xchg   %ax,%ax
testl  $0x1,0x88(%rax)
je     1130 <AESReset+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @AESReset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1141071872
%5 = zext i1 %4 to i32
%6 = call i32 @ASSERT(i32 %5)
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 132
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = or i32 %11, 2
store volatile i32 %12, i32* %10
br label %13
13: ; preds = %21, %1
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 136
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load volatile i32, i32* %17
%19 = and i32 %18, 1
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %13
br label %13
22: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @AESReset(i32 %0) {
%2 = icmp eq i32 %0, 1141071872
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
%5 = add nsw i32 %0, 132
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = or i32 %8, 2
store volatile i32 %9, i32* %7
%10 = add nsw i32 %0, 136
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
br label %13
13: ; preds = %13, %1
%14 = load volatile i32, i32* %12
%15 = and i32 %14, 1
%16 = icmp eq i32 %15, 0
br i1 %16, label %13, label %17
17: ; preds = %13
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ islower(int);
void t_islower_0xe8() {
  Assert_real((islower(232) == 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_islower.c",
              1165, ("islower should be 0 for 0xe8"));
}


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

x86 assembly (clang, -O2):
<t_islower_0xe8>:
push   %rax
mov    $0xe8,%edi
call   1030 <islower@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x48d,%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_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0xe8\00"
define void @t_islower_0xe8() {
%1 = call i64 @islower(i32 232)
%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 1165, 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_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0xe8\00"
define void @t_islower_0xe8() {
%1 = tail call i64 @islower(i32 232)
%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 1165, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ callrts(char *);
zle() { callrts("ccle"); }


x86 assembly (clang, -O0):
<zle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <callrts@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"ccle\00"
define i32 @zle() {
%1 = alloca i32
%2 = call i32 @callrts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [5 x i8] c"ccle\00"
define i32 @zle() {
%1 = tail call i32 @callrts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ memcmp(void const *, void const *, int);
int match_int(const void *key1, const void *key2) {
  return !memcmp(key1, key2, sizeof(int));
}


x86 assembly (clang, -O0):
<match_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_int>:
push   %rax
mov    $0x4,%edx
call   1030 <memcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @match_int(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 @memcmp(i8* %5, i8* %6, i32 4)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @match_int(i8* %0, i8* %1) {
%3 = tail call i32 @memcmp(i8* %0, i8* %1, i32 4)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
int intFuncIntVarArgs(int i, ...) { return 42; }


x86 assembly (clang, -O0):
<intFuncIntVarArgs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x2a,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @intFuncIntVarArgs(i32 %0, ...) {
ret i32 42
}
int fn4(void) {
  static int d = 6;
  return d;
}


x86 assembly (clang, -O0):
<fn4>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@fn4.d = internal global i32 6
define i32 @fn4() {
%1 = load i32, i32* @fn4.d
ret i32 %1
}

LLVM IR (-O2):
define i32 @fn4() {
ret i32 6
}
/* Variables and functions */
int /*<<< orphan*/ v_writel(unsigned char, int);
void Permedia2WriteData(unsigned char data) {
  do {
    ;
    ;
    ;
    v_writel(data, 0x4008);
  } while (0);
}


x86 assembly (clang, -O0):
<Permedia2WriteData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x4008,%esi
movzbl -0x1(%rbp),%edi
call   1030 <v_writel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Permedia2WriteData>:
mov    $0x4008,%esi
jmp    1030 <v_writel@plt>

LLVM IR (-O0):
define void @Permedia2WriteData(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %1
%4 = load i8, i8* %2
%5 = call i32 @v_writel(i8 zeroext %4, i32 16392)
br label %6
6: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @Permedia2WriteData(i8 zeroext %0) {
%2 = tail call i32 @v_writel(i8 zeroext %0, i32 16392)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cpuid(int, unsigned int *, unsigned int *, unsigned int *,
                         unsigned int *);
int is_avx_supported() {
  unsigned int eax, ebx, ecx, edx;
  cpuid(1, &eax, &ebx, &ecx, &edx);
  return (ecx & (1 << 28)) ? 1 : 0;
}


x86 assembly (clang, -O0):
<is_avx_supported>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1030 <cpuid@plt>
mov    -0xc(%rbp),%edx
and    $0x10000000,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_avx_supported>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    $0x1,%edi
call   1030 <cpuid@plt>
mov    0x8(%rsp),%eax
shr    $0x1c,%eax
and    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @is_avx_supported() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @cpuid(i32 1, i32* %1, i32* %2, i32* %3, i32* %4)
%6 = load i32, i32* %3
%7 = and i32 %6, 268435456
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 1, i32 0
ret i32 %10
}

LLVM IR (-O2):
define i32 @is_avx_supported() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @cpuid(i32 1, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %3
%11 = lshr i32 %10, 28
%12 = and i32 %11, 1
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int out;
  int total = 5;
  {
    int total = 0;
    for (int i = 0; i <= 5; i++) {
      total += i;
    }
    out = total;
  };
  printf("out= %i original total=%i\n", out, total);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jg     1155 <main+0x45>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xf,%esi
mov    $0x5,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [27 x i8] c"out= %i original total=%i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 15, i32 5)
ret i32 0
}
float clamp(float value, float min, float max) {
  return (value > min) ? (value < max) ? value : max : min;
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    115d <clamp+0x5d>
movss  -0x4(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1144 <clamp+0x44>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    114e <clamp+0x4e>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1167 <clamp+0x67>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
movaps %xmm1,%xmm3
cmpltss %xmm0,%xmm3
minss  %xmm2,%xmm0
andps  %xmm3,%xmm0
andnps %xmm1,%xmm3
orps   %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @clamp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fcmp ogt float %7, %8
br i1 %9, label %10, label %20
10: ; preds = %3
%11 = load float, float* %4
%12 = load float, float* %6
%13 = fcmp olt float %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load float, float* %4
br label %18
16: ; preds = %10
%17 = load float, float* %6
br label %18
18: ; preds = %16, %14
%19 = phi float [ %15, %14 ], [ %17, %16 ]
br label %22
20: ; preds = %3
%21 = load float, float* %5
br label %22
22: ; preds = %20, %18
%23 = phi float [ %19, %18 ], [ %21, %20 ]
ret float %23
}

LLVM IR (-O2):
define float @clamp(float %0, float %1, float %2) {
%4 = fcmp ogt float %0, %1
%5 = fcmp olt float %0, %2
%6 = select i1 %5, float %0, float %2
%7 = select i1 %4, float %6, float %1
ret float %7
}
/* Type definitions */
typedef int uint8_t;
typedef int int16_t;

/* Variables and functions */
int16_t psf_get_be16(uint8_t *ptr, int offset) {
  return (ptr[offset] << 8) + ptr[offset + 1];
}


x86 assembly (clang, -O0):
<psf_get_be16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
add    (%rcx,%rdx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<psf_get_be16>:
movslq %esi,%rcx
mov    (%rdi,%rcx,4),%eax
shl    $0x8,%eax
add    0x4(%rdi,%rcx,4),%eax
ret

LLVM IR (-O0):
define i32 @psf_get_be16(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 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = load i32*, i32** %3
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %11, i64 %14
%16 = load i32, i32* %15
%17 = add nsw i32 %10, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @psf_get_be16(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = shl i32 %5, 8
%7 = add nsw i32 %1, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = add nsw i32 %6, %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage(void) {
  printf("usage:\n"
         "    remote-dump1090 [-h] [-v] [-l] [-s SRC_PORT] [-d DST_PORT] "
         "SRC_HOST DST_HOST\n");
}


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

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

LLVM IR (-O0):
@.str = [89 x i8] c"usage:\0A remote-dump1090 [-h] [-v] [-l] [-s SRC_PORT] [-d DST_PORT] SRC_HOST DST_HOST\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [88 x i8] c"usage:\0A remote-dump1090 [-h] [-v] [-l] [-s SRC_PORT] [-d DST_PORT] SRC_HOST DST_HOST\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @str, i64 0, i64 0))
ret void
}
void XtCreatePopupShell() {}


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

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

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

LLVM IR (-O2):
define void @XtCreatePopupShell() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello(void) { printf("Hello\n"); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"Hello\0A\00"
define void @hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"Hello\00"
define void @hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int natural_generator();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", natural_generator());
  printf("%d\n", natural_generator());
  printf("%d\n", natural_generator());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <natural_generator@plt>
mov    %eax,%esi
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <natural_generator@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <natural_generator@plt>
mov    %eax,%esi
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <natural_generator@plt>
lea    0xed1(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <natural_generator@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <natural_generator@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @natural_generator()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @natural_generator()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @natural_generator()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, int);
char *strerror(int);
void ex() {
  int e = errno;
  printf("Fork failed: %s (%d)\n", strerror(e), e);
  exit(1);
}


x86 assembly (clang, -O0):
<ex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <strerror@plt>
mov    %rax,%rsi
mov    -0x4(%rbp),%edx
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<ex>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1050 <strerror@plt>
lea    0xeb8(%rip),%rdi
mov    %rax,%rsi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@errno = global i32 0
@.str = [22 x i8] c"Fork failed: %s (%d)\0A\00"
define void @ex() {
%1 = alloca i32
%2 = load i32, i32* @errno
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i8* @strerror(i32 %3)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %5)
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [22 x i8] c"Fork failed: %s (%d)\0A\00"
define void @ex() {
%1 = load i32, i32* @errno
%2 = tail call i8* @strerror(i32 %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %1)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ pause();
void halt(void) {
  for (;; pause())
    ;
}


x86 assembly (clang, -O0):
<halt>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <halt+0x9>
jmp    111e <halt+0xe>
mov    $0x0,%al
call   1030 <pause@plt>
jmp    1119 <halt+0x9>

x86 assembly (clang, -O2):
<halt>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <pause@plt>
jmp    1120 <halt+0x10>

LLVM IR (-O0):
define void @halt() {
br label %1
1: ; preds = %2, %0
br label %2
2: ; preds = %1
%3 = call i32 (...) @pause()
br label %1
}

LLVM IR (-O2):
define void @halt() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @pause()
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ create_client();
int main(void) {
  create_client();
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <create_client@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @create_client()
ret i32 1
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @create_client()
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isgraph(int);
void t_isgraph_0xa8() {
  Assert_real((isgraph(168) == 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_isgraph.c",
              845, ("isgraph should be 0 for 0xa8"));
}


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

x86 assembly (clang, -O2):
<t_isgraph_0xa8>:
push   %rax
mov    $0xa8,%edi
call   1040 <isgraph@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x34d,%edx
pop    %rax
jmp    1030 <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_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xa8\00"
define void @t_isgraph_0xa8() {
%1 = call i64 @isgraph(i32 168)
%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 845, 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_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xa8\00"
define void @t_isgraph_0xa8() {
%1 = tail call i64 @isgraph(i32 168)
%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 845, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int test_imm_7Buint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x7B << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_7Buint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0x7b,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_7Buint64_midword_reg>:
test   $0x7b0000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_7Buint64_midword_reg(i64 %0) {
%2 = and i64 %0, 8060928
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int dwarf_get_CC_name(unsigned int, char const **);
char const *ellipname(int, unsigned int, char const *, char *, int);
const char *get_CC_name(unsigned int val_in, int printonerr) {
  const char *v = 0;
  int res = dwarf_get_CC_name(val_in, &v);
  return ellipname(res, val_in, v, "CC", printonerr);
}


x86 assembly (clang, -O0):
<get_CC_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1030 <dwarf_get_CC_name@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%r8d
lea    0xea6(%rip),%rcx
call   1040 <ellipname@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_CC_name>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
movq   $0x0,(%rsp)
mov    %rsp,%rsi
call   1030 <dwarf_get_CC_name@plt>
mov    (%rsp),%rdx
lea    0xebe(%rip),%rcx
mov    %eax,%edi
mov    %ebp,%esi
mov    %ebx,%r8d
call   1040 <ellipname@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"CC\00"
define i8* @get_CC_name(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i8* null, i8** %5
%7 = load i32, i32* %3
%8 = call i32 @dwarf_get_CC_name(i32 %7, i8** %5)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = load i32, i32* %3
%11 = load i8*, i8** %5
%12 = load i32, i32* %4
%13 = call i8* @ellipname(i32 %9, i32 %10, i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i8* %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"CC\00"
define i8* @get_CC_name(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i32 @dwarf_get_CC_name(i32 %0, i8** %3)
%6 = load i8*, i8** %3
%7 = call i8* @ellipname(i32 %5, i32 %0, i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ init_types();
int /*<<< orphan*/ output_splash();
int /*<<< orphan*/ repl();
int main() {
  output_splash();
  init_types();
  repl();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <output_splash@plt>
mov    $0x0,%al
call   1040 <init_types@plt>
mov    $0x0,%al
call   1030 <repl@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @output_splash()
%3 = call i32 (...) @init_types()
%4 = call i32 (...) @repl()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @output_splash()
%2 = tail call i32 (...) @init_types()
%3 = tail call i32 (...) @repl()
ret i32 0
}
void shift_down(char **entry) {
  do {
    entry[0] = entry[1];
  } while (*entry++);
}


x86 assembly (clang, -O0):
<shift_down>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
cmpq   $0x0,(%rax)
jne    1108 <shift_down+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift_down>:
add    $0x8,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rdi),%rax
mov    %rax,-0x8(%rdi)
add    $0x8,%rdi
test   %rax,%rax
jne    1110 <shift_down+0x10>
ret

LLVM IR (-O0):
define void @shift_down(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
br label %3
3: ; preds = %9, %1
%4 = load i8**, i8*** %2
%5 = getelementptr inbounds i8*, i8** %4, i64 1
%6 = load i8*, i8** %5
%7 = load i8**, i8*** %2
%8 = getelementptr inbounds i8*, i8** %7, i64 0
store i8* %6, i8** %8
br label %9
9: ; preds = %3
%10 = load i8**, i8*** %2
%11 = getelementptr inbounds i8*, i8** %10, i32 1
store i8** %11, i8*** %2
%12 = load i8*, i8** %10
%13 = icmp ne i8* %12, null
br i1 %13, label %3, label %14
14: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @shift_down(i8** nocapture %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
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %2
7: ; preds = %2
ret void
}
/* Variables and functions */
int pthread_atfork(int /*<<< orphan*/ *, int /*<<< orphan*/ *, void (*)());
int st_atfork(void (*fn)(void)) { return pthread_atfork(NULL, NULL, fn); }


x86 assembly (clang, -O0):
<st_atfork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1140 <__pthread_atfork>
add    $0x10,%rsp
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)

x86 assembly (clang, -O2):
<st_atfork>:
mov    %rdi,%rdx
xor    %edi,%edi
xor    %esi,%esi
jmp    1120 <__pthread_atfork>
nopl   0x0(%rax)

LLVM IR (-O0):
define i32 @st_atfork(void ()* %0) {
%2 = alloca void ()*
store void ()* %0, void ()** %2
%3 = load void ()*, void ()** %2
%4 = bitcast void ()* %3 to void (...)*
%5 = call i32 @pthread_atfork(i32* null, i32* null, void (...)* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @st_atfork(void ()* %0) {
%2 = bitcast void ()* %0 to void (...)*
%3 = tail call i32 @pthread_atfork(i32* null, i32* null, void (...)* %2)
ret i32 %3
}
vowel(i) int i;
{
  switch (i) {
  case 'a':
  case 'A':
  case 'e':
  case 'E':
  case 'i':
  case 'I':
  case 'o':
  case 'O':
  case 'u':
  case 'U':
  case 'y':
  case 'Y':
    return (1);
  default:
    return (0);
  }
}


x86 assembly (clang, -O0):
<vowel>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x41,%eax
je     11d6 <vowel+0xd6>
jmp    111b <vowel+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x45,%eax
je     11d6 <vowel+0xd6>
jmp    112c <vowel+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x49,%eax
je     11d6 <vowel+0xd6>
jmp    113d <vowel+0x3d>
mov    -0xc(%rbp),%eax
sub    $0x4f,%eax
je     11d6 <vowel+0xd6>
jmp    114e <vowel+0x4e>
mov    -0xc(%rbp),%eax
sub    $0x55,%eax
je     11d6 <vowel+0xd6>
jmp    115f <vowel+0x5f>
mov    -0xc(%rbp),%eax
sub    $0x59,%eax
je     11d6 <vowel+0xd6>
jmp    1170 <vowel+0x70>
mov    -0xc(%rbp),%eax
sub    $0x61,%eax
je     11d6 <vowel+0xd6>
jmp    1181 <vowel+0x81>
mov    -0xc(%rbp),%eax
sub    $0x65,%eax
je     11d6 <vowel+0xd6>
jmp    1192 <vowel+0x92>
mov    -0xc(%rbp),%eax
sub    $0x69,%eax
je     11d6 <vowel+0xd6>
jmp    11a3 <vowel+0xa3>
mov    -0xc(%rbp),%eax
sub    $0x6f,%eax
je     11d6 <vowel+0xd6>
jmp    11b4 <vowel+0xb4>
mov    -0xc(%rbp),%eax
sub    $0x75,%eax
je     11d6 <vowel+0xd6>
jmp    11c5 <vowel+0xc5>
mov    -0xc(%rbp),%eax
sub    $0x79,%eax
jne    11e2 <vowel+0xe2>
jmp    11d6 <vowel+0xd6>
movl   $0x1,-0x4(%rbp)
jmp    11e9 <vowel+0xe9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vowel>:
add    $0xffffffbf,%edi
ror    %edi
xor    %eax,%eax
cmp    $0x1c,%edi
ja     1119 <vowel+0x19>
movslq %edi,%rax
lea    0xeea(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @vowel(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 97, label %5
i32 65, label %5
i32 101, label %5
i32 69, label %5
i32 105, label %5
i32 73, label %5
i32 111, label %5
i32 79, label %5
i32 117, label %5
i32 85, label %5
i32 121, label %5
i32 89, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
@switch.table.vowel = [29 x i32] [i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 0, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 0, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1]
define i32 @vowel(i32 %0) {
%2 = add i32 %0, -65
%3 = tail call i32 @llvm.fshl.i32(i32 %2, i32 %2, i32 31)
%4 = icmp ult i32 %3, 29
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [29 x i32], [29 x i32]* @switch.table.vowel, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ 0, %1 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M588_f(char *s) {
  debug("M588_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M588_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M588_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M588_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M588_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M588_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M588_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ aprinter_platform_debug_write(void const *, size_t);
__attribute__((used)) int _write(int file, void const *ptr, size_t len) {
  aprinter_platform_debug_write(ptr, len);
  return len;
}


x86 assembly (clang, -O0):
<_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <aprinter_platform_debug_write@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_write>:
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <aprinter_platform_debug_write@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i32, i8*, i64)* @_write to i8*)], section "llvm.metadata"
define i32 @_write(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = call i32 @aprinter_platform_debug_write(i8* %7, i64 %8)
%10 = load i64, i64* %6
%11 = trunc i64 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i32, i8*, i64)* @_write to i8*)], section "llvm.metadata"
define i32 @_write(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @aprinter_platform_debug_write(i8* %1, i64 %2)
%5 = trunc i64 %2 to i32
ret i32 %5
}
int constant_test_bit(unsigned int nr, const volatile unsigned long *addr) {
  return (((1UL << (nr % 64)) & (((unsigned long *)addr)[nr / 64])) != 0);
}


x86 assembly (clang, -O0):
<constant_test_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3f,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    -0x10(%rbp),%rcx
mov    -0x4(%rbp),%edx
shr    $0x6,%edx
mov    %edx,%edx
and    (%rcx,%rdx,8),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<constant_test_bit>:
mov    %edi,%eax
shr    $0x6,%eax
mov    (%rsi,%rax,8),%rcx
xor    %eax,%eax
bt     %rdi,%rcx
setb   %al
ret

LLVM IR (-O0):
define i32 @constant_test_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%5 = load i32, i32* %3
%6 = urem i32 %5, 64
%7 = zext i32 %6 to i64
%8 = shl i64 1, %7
%9 = load i64*, i64** %4
%10 = load i32, i32* %3
%11 = udiv i32 %10, 64
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i64, i64* %9, i64 %12
%14 = load i64, i64* %13
%15 = and i64 %8, %14
%16 = icmp ne i64 %15, 0
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @constant_test_bit(i32 %0, i64* nocapture %1) {
%3 = and i32 %0, 63
%4 = zext i32 %3 to i64
%5 = shl nuw i64 1, %4
%6 = lshr i32 %0, 6
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i64, i64* %1, i64 %7
%9 = load i64, i64* %8
%10 = and i64 %9, %5
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}
int ck_cls() { return (-1); }


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

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

LLVM IR (-O0):
define i32 @ck_cls() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @ck_cls() {
ret i32 -1
}