xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ cgincind(char *, char *, int);
void cgdec1pi(int v) { cgincind("ax", "sub", v); }


x86 assembly (clang, -O0):
<cgdec1pi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xedb(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1030 <cgincind@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgdec1pi>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
lea    0xee3(%rip),%rsi
jmp    1030 <cgincind@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"ax\00"
@.str.1 = [4 x i8] c"sub\00"
define void @cgdec1pi(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @cgincind(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"ax\00"
@.str.1 = [4 x i8] c"sub\00"
define void @cgdec1pi(i32 %0) {
%2 = tail call i32 @cgincind(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double Wtime(void) {
  struct timeval t;
  gettimeofday(&t, NULL);
  return ((double)t.tv_sec * 1e06 + (double)(t.tv_usec));
}


x86 assembly (clang, -O0):
<Wtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xec7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Wtime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm0
cvtsi2sdq 0x8(%rsp),%xmm1
mulsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @Wtime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = sitofp i64 %4 to double
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = call double @llvm.fmuladd.f64(double %5, double 1.000000e+06, double %8)
ret double %9
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @Wtime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = tail call double @llvm.fmuladd.f64(double %6, double 1.000000e+06, double %9)
ret double %10
}
int Int__DIV_(int x, int y) { return x / y; }


x86 assembly (clang, -O0):
<Int__DIV_>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Int__DIV_>:
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @Int__DIV_(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 = sdiv i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @Int__DIV_(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}
int condition_hash(char c) { return c == '#'; }


x86 assembly (clang, -O0):
<condition_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x23,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<condition_hash>:
xor    %eax,%eax
cmp    $0x23,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @condition_hash(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, 35
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @condition_hash(i8 signext %0) {
%2 = icmp eq i8 %0, 35
%3 = zext i1 %2 to i32
ret i32 %3
}
void SysCtlIntDisable(unsigned long ulIntFlags) {

  ;
  (*((volatile unsigned long *)(0x40021008))) &= ~(ulIntFlags << 8);
}


x86 assembly (clang, -O0):
<SysCtlIntDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x8,%rax
xor    $0xffffffffffffffff,%rax
mov    $0x40021008,%ecx
mov    (%rcx),%rcx
and    %rax,%rcx
mov    $0x40021008,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlIntDisable>:
shl    $0x8,%rdi
not    %rdi
and    %rdi,0x40021008
40
ret

LLVM IR (-O0):
define void @SysCtlIntDisable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = shl i64 %3, 8
%5 = xor i64 %4, -1
%6 = load volatile i64, i64* inttoptr (i64 1073877000 to i64*)
%7 = and i64 %6, %5
store volatile i64 %7, i64* inttoptr (i64 1073877000 to i64*)
ret void
}

LLVM IR (-O2):
define void @SysCtlIntDisable(i64 %0) {
%2 = shl i64 %0, 8
%3 = xor i64 %2, -1
%4 = load volatile i64, i64* inttoptr (i64 1073877000 to i64*)
%5 = and i64 %4, %3
store volatile i64 %5, i64* inttoptr (i64 1073877000 to i64*)
ret void
}
/* Variables and functions */
char *alloca(int);
int /*<<< orphan*/ memset(char *, char, int);
int strlen(char *);
int test14(void) {
  char *p = alloca(100);
  memset(p, 'a', 100);
  p[100 - 1] = 0;
  return strlen(p);
}


x86 assembly (clang, -O0):
<test14>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1050 <alloca@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x61,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rax
movb   $0x0,0x63(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test14>:
push   %rbx
mov    $0x64,%edi
call   1050 <alloca@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x61,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movb   $0x0,0x63(%rbx)
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <strlen@plt>

LLVM IR (-O0):
define i32 @test14() {
%1 = alloca i8*
%2 = call i8* @alloca(i32 100)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @memset(i8* %3, i8 signext 97, i32 100)
%5 = load i8*, i8** %1
%6 = getelementptr inbounds i8, i8* %5, i64 99
store i8 0, i8* %6
%7 = load i8*, i8** %1
%8 = call i32 @strlen(i8* %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @test14() {
%1 = tail call i8* @alloca(i32 100)
%2 = tail call i32 @memset(i8* %1, i8 signext 97, i32 100)
%3 = getelementptr inbounds i8, i8* %1, i64 99
store i8 0, i8* %3
%4 = tail call i32 @strlen(i8* %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ islower(int);
void t_islower_0x1c() {
  Assert_real((islower(28) == 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",
              145, ("islower should be 0 for 0x1c"));
}


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

x86 assembly (clang, -O2):
<t_islower_0x1c>:
push   %rax
mov    $0x1c,%edi
call   1030 <islower@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x91,%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 0x1c\00"
define void @t_islower_0x1c() {
%1 = call i64 @islower(i32 28)
%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 145, 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 0x1c\00"
define void @t_islower_0x1c() {
%1 = tail call i64 @islower(i32 28)
%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 145, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void rop3_100_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = T | S;
  stk2 = *D & stk3;
  stk1 = S ^ stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xd(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
or     %edx,%esi
and    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_100_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = or i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %9
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = load i8, i8* %9
%20 = zext i8 %19 to i32
%21 = and i32 %18, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %8
%23 = load i8, i8* %5
%24 = zext i8 %23 to i32
%25 = load i8, i8* %8
%26 = zext i8 %25 to i32
%27 = xor i32 %24, %26
%28 = trunc i32 %27 to i8
store i8 %28, i8* %7
%29 = load i8, i8* %7
%30 = zext i8 %29 to i32
%31 = load i8, i8* %5
%32 = zext i8 %31 to i32
%33 = xor i32 %32, -1
%34 = and i32 %30, %33
%35 = load i8*, i8** %4
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = load i8, i8* %5
%39 = zext i8 %38 to i32
%40 = and i32 %37, %39
%41 = or i32 %34, %40
%42 = trunc i32 %41 to i8
%43 = load i8*, i8** %4
store i8 %42, i8* %43
ret void
}

LLVM IR (-O2):
define void @rop3_100_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %2, %1
%6 = and i8 %5, %4
store i8 %6, i8* %0
ret void
}
/* Variables and functions */
int add(int, int);
int main() { return add(1, add(3, add(4, 5))); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
mov    $0x5,%esi
call   1030 <add@plt>
mov    $0x3,%edi
mov    %eax,%esi
call   1030 <add@plt>
mov    $0x1,%edi
mov    %eax,%esi
pop    %rax
jmp    1030 <add@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @add(i32 4, i32 5)
%2 = tail call i32 @add(i32 3, i32 %1)
%3 = tail call i32 @add(i32 1, i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int gcd(int, int);
void gcd_test(void) {
  assert(gcd(3, 5) == 1);
  assert(gcd(12, 60) == 12);
  assert(gcd(90, 12) == 6);
  assert(gcd(-90, 12) == 6);
}


x86 assembly (clang, -O0):
<gcd_test>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
mov    $0x5,%esi
call   1040 <gcd@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0xc,%edi
mov    $0x3c,%esi
call   1040 <gcd@plt>
cmp    $0xc,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x5a,%edi
mov    $0xc,%esi
call   1040 <gcd@plt>
cmp    $0x6,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0xffffffa6,%edi
mov    $0xc,%esi
call   1040 <gcd@plt>
cmp    $0x6,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd_test>:
push   %rax
mov    $0x3,%edi
mov    $0x5,%esi
call   1040 <gcd@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0xc,%edi
mov    $0x3c,%esi
call   1040 <gcd@plt>
xor    %edi,%edi
cmp    $0xc,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x5a,%edi
mov    $0xc,%esi
call   1040 <gcd@plt>
xor    %edi,%edi
cmp    $0x6,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0xffffffa6,%edi
mov    $0xc,%esi
call   1040 <gcd@plt>
xor    %edi,%edi
cmp    $0x6,%eax
sete   %dil
pop    %rax
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @gcd_test() {
%1 = call i32 @gcd(i32 3, i32 5)
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
%5 = call i32 @gcd(i32 12, i32 60)
%6 = icmp eq i32 %5, 12
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @gcd(i32 90, i32 12)
%10 = icmp eq i32 %9, 6
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @gcd(i32 -90, i32 12)
%14 = icmp eq i32 %13, 6
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
ret void
}

LLVM IR (-O2):
define void @gcd_test() {
%1 = tail call i32 @gcd(i32 3, i32 5)
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @gcd(i32 12, i32 60)
%6 = icmp eq i32 %5, 12
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @gcd(i32 90, i32 12)
%10 = icmp eq i32 %9, 6
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @gcd(i32 -90, i32 12)
%14 = icmp eq i32 %13, 6
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
ret void
}
int test_imm_E4int8_reg(signed char val) {
  return ((val) & (-0xE4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E4int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffff1c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_E4int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -228
%6 = icmp ne i32 %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_E4int8_reg(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = and i32 %2, -228
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
long long cpucycles_amd64cpuinfo(void) {
  unsigned long long result;
  asm volatile(".byte 15;.byte 49;shlq $32,%%rdx;orq %%rdx,%%rax"
               : "=a"(result)::"%rdx");
  return result;
}


x86 assembly (clang, -O0):
<cpucycles_amd64cpuinfo>:
push   %rbp
mov    %rsp,%rbp
rdtsc
shl    $0x20,%rdx
or     %rdx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpucycles_amd64cpuinfo>:
rdtsc
shl    $0x20,%rdx
or     %rdx,%rax
ret

LLVM IR (-O0):
define i64 @cpucycles_amd64cpuinfo() {
%1 = alloca i64
%2 = call i64 asm sideeffect ".byte 15;.byte 49;shlq $$32,%rdx;orq %rdx,%rax", "={ax},~{rdx},~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @cpucycles_amd64cpuinfo() {
%1 = tail call i64 asm sideeffect ".byte 15;.byte 49;shlq $$32,%rdx;orq %rdx,%rax", "={ax},~{rdx},~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
/* Variables and functions */
unsigned int __builtin_cbcdtd(unsigned int);
unsigned int from_bcd(unsigned int a) { return __builtin_cbcdtd(a); }


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

x86 assembly (clang, -O2):
<from_bcd>:
jmp    1030 <__builtin_cbcdtd@plt>

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

LLVM IR (-O2):
define i32 @from_bcd(i32 %0) {
%2 = tail call i32 @__builtin_cbcdtd(i32 %0)
ret i32 %2
}
/* Variables and functions */
scalar_t__ mock(char *);
char *cf_s_logfile(char *s) { return (char *)mock(s); }


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

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

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

LLVM IR (-O2):
define i8* @cf_s_logfile(i8* %0) {
%2 = tail call i64 @mock(i8* %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
main(void) {
  char *cp = "\"¡\"";
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    0xeee(%rip),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"\22\C2\A1\C2\81\22\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int strlen(char *);
int append_in(char *buffer, char c) {
  int i = strlen(buffer);
  int result = 1;
  if (i < 512 - 1) {
    buffer[i] = c;
    buffer[i + 1] = '\0';
  } else {
    result = 0;
  }
  return result;
}


x86 assembly (clang, -O0):
<append_in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x1ff,-0x10(%rbp)
jge    1166 <append_in+0x56>
mov    -0x9(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    116d <append_in+0x5d>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<append_in>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1fe,%ecx
jg     113a <append_in+0x2a>
movslq %ecx,%rax
mov    %bpl,(%rbx,%rax,1)
movb   $0x0,0x1(%rbx,%rax,1)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @append_in(i8* %0, i8 signext %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp slt i32 %3, 511
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %1, i8* %7
%8 = add nsw i32 %3, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
store i8 0, i8* %10
br label %11
11: ; preds = %2, %5
%12 = phi i32 [ 1, %5 ], [ 0, %2 ]
ret i32 %12
}
int emac2_atxpausemacctrlframes_set(
    unsigned int dev_id, union emac2_atxpausemacctrlframes_u *value) {
  return 1;
}


x86 assembly (clang, -O0):
<emac2_atxpausemacctrlframes_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.emac2_atxpausemacctrlframes_u = type opaque
define i32 @emac2_atxpausemacctrlframes_set(i32 %0, %union.emac2_atxpausemacctrlframes_u* %1) {
%3 = alloca i32
%4 = alloca %union.emac2_atxpausemacctrlframes_u*
store i32 %0, i32* %3
store %union.emac2_atxpausemacctrlframes_u* %1, %union.emac2_atxpausemacctrlframes_u** %4
ret i32 1
}

LLVM IR (-O2):
%union.emac2_atxpausemacctrlframes_u = type opaque
define i32 @emac2_atxpausemacctrlframes_set(i32 %0, %union.emac2_atxpausemacctrlframes_u* nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
int test_level_four(int one, int two, int three, int four,
                    void (*callback_func)(void *), void *data) {
  if (callback_func != NULL) {
    callback_func(data);
  } else {
    while (1) {
    }
  }
  return one + two + three + four;
}


x86 assembly (clang, -O0):
<test_level_four>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1136 <test_level_four+0x36>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rdi
call   *%rax
jmp    1140 <test_level_four+0x40>
jmp    113b <test_level_four+0x3b>
jmp    113b <test_level_four+0x3b>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_level_four>:
test   %r8,%r8
je     1140 <test_level_four+0x40>
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebp
mov    %edi,%ebx
mov    %r9,%rdi
call   *%r8
add    %ebx,%ebp
add    %r15d,%ebp
add    %r14d,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
jmp    1140 <test_level_four+0x40>

LLVM IR (-O0):
define i32 @test_level_four(i32 %0, i32 %1, i32 %2, i32 %3, void (i8*)* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca void (i8*)*
%12 = alloca i8*
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store void (i8*)* %4, void (i8*)** %11
store i8* %5, i8** %12
%13 = load void (i8*)*, void (i8*)** %11
%14 = icmp ne void (i8*)* %13, null
br i1 %14, label %15, label %18
15: ; preds = %6
%16 = load void (i8*)*, void (i8*)** %11
%17 = load i8*, i8** %12
br label %20
18: ; preds = %6
br label %19
19: ; preds = %18, %19
br label %19
20: ; preds = %15
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = add nsw i32 %21, %22
%24 = load i32, i32* %9
%25 = add nsw i32 %23, %24
%26 = load i32, i32* %10
%27 = add nsw i32 %25, %26
ret i32 %27
}

LLVM IR (-O2):
define i32 @test_level_four(i32 %0, i32 %1, i32 %2, i32 %3, void (i8*)* %4, i8* %5) {
%7 = icmp eq void (i8*)* %4, null
br i1 %7, label %12, label %8
8: ; preds = %6
tail call void %4(i8* %5)
%9 = add nsw i32 %1, %0
%10 = add nsw i32 %9, %2
%11 = add nsw i32 %10, %3
ret i32 %11
12: ; preds = %6, %12
br label %12
}
/* Type definitions */
struct buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct buffer *);
void buff_free(struct buffer *buff) {
  if (buff)
    free(buff);
}


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

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

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

LLVM IR (-O2):
%struct.buffer = type { i32 }
define void @buff_free(%struct.buffer* %0) {
%2 = icmp eq %struct.buffer* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.buffer* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void write_file_version(FILE *fd) {
  fprintf(fd, "# vtk DataFile Version 2.0\n");
}


x86 assembly (clang, -O0):
<write_file_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_file_version>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"# vtk DataFile Version 2.0\0A\00"
define void @write_file_version(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"# vtk DataFile Version 2.0\0A\00"
define void @write_file_version(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 27, i64 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ halt_isr();
__attribute__((weak)) void SVC_Handler() { halt_isr(); }


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

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

LLVM IR (-O0):
define weak void @SVC_Handler() {
%1 = call i32 (...) @halt_isr()
ret void
}

LLVM IR (-O2):
define weak void @SVC_Handler() {
%1 = tail call i32 (...) @halt_isr()
ret void
}
int octal_digit(char c) { return (c >= '0' && c <= '7'); }


x86 assembly (clang, -O0):
<octal_digit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <octal_digit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x37,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<octal_digit>:
and    $0xf8,%dil
xor    %eax,%eax
cmp    $0x30,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @octal_digit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 55
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @octal_digit(i8 signext %0) {
%2 = and i8 %0, -8
%3 = icmp eq i8 %2, 48
%4 = zext i1 %3 to i32
ret i32 %4
}
int main() {
  unsigned int ni_flags;
  unsigned int flit;
  unsigned int packet_counter;
  while (1) {
    packet_counter = (*(volatile unsigned int *)(0x8004u));
    if (packet_counter > 0) {
      ni_flags = (*(volatile unsigned int *)0x8000u);
      if (((ni_flags & 0x80000000) == 0)) {
        flit = (*(volatile unsigned int *)0x7FFCu);
      }
    } else {
      (*(volatile unsigned int *)0x7FFCu =
           (0b00100000000011110000000000000000));
      asm("nop");
      asm("nop");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x8004,%eax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jbe    1149 <main+0x49>
mov    $0x8000,%eax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
jne    1144 <main+0x44>
mov    $0x7ffc,%eax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <main+0x56>
mov    $0x7ffc,%eax
movl   $0x200f0000,(%rax)
nop
nop
jmp    110b <main+0xb>

x86 assembly (clang, -O2):
<main>:
jmp    111d <main+0x1d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x200f0000,0x7ffc
nop
nop
cmpl   $0x0,0x8004
je     1110 <main+0x10>
cmpl   $0x0,0x8000
js     111d <main+0x1d>
mov    0x7ffc,%eax
jmp    111d <main+0x1d>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %0, %18
%6 = load volatile i32, i32* inttoptr (i64 32772 to i32*)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ugt i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %5
%10 = load volatile i32, i32* inttoptr (i64 32768 to i32*)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = and i32 %11, -2147483648
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = load volatile i32, i32* inttoptr (i64 32764 to i32*)
store i32 %15, i32* %3
br label %16
16: ; preds = %14, %9
br label %18
17: ; preds = %5
store volatile i32 537853952, i32* inttoptr (i64 32764 to i32*)
br label %18
18: ; preds = %17, %16
br label %5
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %7, %0
%2 = load volatile i32, i32* inttoptr (i64 32772 to i32*)
%3 = icmp eq i32 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = load volatile i32, i32* inttoptr (i64 32768 to i32*)
%6 = icmp sgt i32 %5, -1
br i1 %6, label %8, label %7
7: ; preds = %4, %8, %10
br label %1
8: ; preds = %4
%9 = load volatile i32, i32* inttoptr (i64 32764 to i32*)
br label %7
10: ; preds = %1
store volatile i32 537853952, i32* inttoptr (i64 32764 to i32*)
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
br label %7
}
/* Variables and functions */
int /*<<< orphan*/ log_error(char *, char const *, int);
void log_oom(const char *file, int line) {
  log_error("out of memory at %s:%d\n", file, line);
}


x86 assembly (clang, -O0):
<log_oom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <log_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_oom>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <log_error@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"out of memory at %s:%d\0A\00"
define void @log_oom(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @log_error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"out of memory at %s:%d\0A\00"
define void @log_oom(i8* %0, i32 %1) {
%3 = tail call i32 @log_error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int x;
  int n = 0;
  scanf("%d", &x);
  while (x > 0) {
    n++;
    x /= 10;
  }
  printf("%d\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    116c <main+0x4c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x26>
mov    -0xc(%rbp),%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
xor    %esi,%esi
test   %eax,%eax
jle    1168 <main+0x48>
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,%edx
add    $0x1,%esi
mov    %eax,%eax
imul   %rcx,%rax
shr    $0x23,%rax
cmp    $0x9,%edx
ja     1150 <main+0x30>
mov    %eax,0x4(%rsp)
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %0, %6
%7 = phi i32 [ %9, %6 ], [ 0, %0 ]
%8 = phi i32 [ %10, %6 ], [ %4, %0 ]
%9 = add nuw nsw i32 %7, 1
%10 = udiv i32 %8, 10
%11 = icmp ult i32 %8, 10
br i1 %11, label %12, label %6
12: ; preds = %6
store i32 %10, i32* %1
br label %13
13: ; preds = %12, %0
%14 = phi i32 [ %9, %12 ], [ 0, %0 ]
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
ret i32 0
}
unsigned int hash_func(unsigned int x, unsigned int y, unsigned int n) {
  return (x * 2185031351ul ^ y * 4232417593ul) % n;
}


x86 assembly (clang, -O0):
<hash_func>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
movabs $0x823ceeb7,%rcx
imul   %rcx,%rax
mov    -0x8(%rbp),%ecx
movabs $0xfc459139,%rdx
imul   %rdx,%rcx
xor    %rcx,%rax
mov    -0xc(%rbp),%ecx
xor    %edx,%edx
div    %rcx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_func>:
mov    %edi,%ecx
mov    $0x823ceeb7,%eax
imul   %rax,%rcx
mov    %esi,%esi
add    $0x7a08a282,%rax
imul   %rsi,%rax
xor    %rcx,%rax
mov    %edx,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
ret

LLVM IR (-O0):
define i32 @hash_func(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 = zext i32 %7 to i64
%9 = mul i64 %8, 2185031351
%10 = load i32, i32* %5
%11 = zext i32 %10 to i64
%12 = mul i64 %11, 4232417593
%13 = xor i64 %9, %12
%14 = load i32, i32* %6
%15 = zext i32 %14 to i64
%16 = urem i64 %13, %15
%17 = trunc i64 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @hash_func(i32 %0, i32 %1, i32 %2) {
%4 = zext i32 %0 to i64
%5 = mul nuw i64 %4, 2185031351
%6 = zext i32 %1 to i64
%7 = mul nuw i64 %6, 4232417593
%8 = xor i64 %7, %5
%9 = zext i32 %2 to i64
%10 = urem i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
int is_gbk(const unsigned char *str) {
  unsigned char high = str[0];
  unsigned char low = str[1];
  return high >= 0x81 && high <= 0xfe && low >= 0x40 && low <= 0xfe &&
         low != 0x7f;
}


x86 assembly (clang, -O0):
<is_gbk>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0x81,%ecx
mov    %al,-0xb(%rbp)
jl     1179 <is_gbk+0x79>
movzbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0xfe,%ecx
mov    %al,-0xb(%rbp)
jg     1179 <is_gbk+0x79>
movzbl -0xa(%rbp),%ecx
xor    %eax,%eax
cmp    $0x40,%ecx
mov    %al,-0xb(%rbp)
jl     1179 <is_gbk+0x79>
movzbl -0xa(%rbp),%ecx
xor    %eax,%eax
cmp    $0xfe,%ecx
mov    %al,-0xb(%rbp)
jg     1179 <is_gbk+0x79>
movzbl -0xa(%rbp),%eax
cmp    $0x7f,%eax
setne  %al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_gbk>:
mov    (%rdi),%al
mov    0x1(%rdi),%cl
add    $0x7f,%al
cmp    $0x7e,%al
setb   %sil
cmp    $0x40,%cl
setae  %dl
cmp    $0xff,%cl
setne  %al
and    %dl,%al
and    %sil,%al
cmp    $0x7f,%cl
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @is_gbk(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
%5 = add i8 %2, 127
%6 = icmp ult i8 %5, 126
%7 = icmp ugt i8 %4, 63
%8 = select i1 %6, i1 %7, i1 false
%9 = icmp ne i8 %4, -1
%10 = select i1 %8, i1 %9, i1 false
%11 = icmp ne i8 %4, 127
%12 = select i1 %10, i1 %11, i1 false
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void OsaCloseDriver(void *hDriver) { close((int)hDriver); }


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

x86 assembly (clang, -O2):
<OsaCloseDriver>:
jmp    1030 <close@plt>

LLVM IR (-O0):
define void @OsaCloseDriver(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = call i32 @close(i32 %4)
ret void
}

LLVM IR (-O2):
define void @OsaCloseDriver(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @close(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void x4(void) { printf(" x4"); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c" x4\00"
define void @x4() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
long main() { return 1337; }


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

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

LLVM IR (-O0):
define i64 @main() {
ret i64 1337
}

LLVM IR (-O2):
define i64 @main() {
ret i64 1337
}
/* Variables and functions */
int /*<<< orphan*/ acos(double);
double rad2deg(int /*<<< orphan*/);
double dot2ang(double dotval) {
  double ang_deg;
  if (dotval >= 1.0)
    ang_deg = 0.0;
  else if (dotval <= -1.0)
    ang_deg = 180.0;
  else
    ang_deg = rad2deg(acos(dotval));
  return ang_deg;
}


x86 assembly (clang, -O0):
<dot2ang>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xec6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1151 <dot2ang+0x31>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1191 <dot2ang+0x71>
movsd  0xeaf(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     1176 <dot2ang+0x56>
movsd  0xea4(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    118c <dot2ang+0x6c>
movsd  -0x8(%rbp),%xmm0
call   1030 <acos@plt>
mov    %eax,%edi
call   1040 <rad2deg@plt>
movsd  %xmm0,-0x10(%rbp)
jmp    1191 <dot2ang+0x71>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dot2ang>:
push   %rax
xorps  %xmm1,%xmm1
ucomisd 0xed4(%rip),%xmm0
jae    1151 <dot2ang+0x31>
movsd  0xeda(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1149 <dot2ang+0x29>
call   1030 <acos@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <rad2deg@plt>
movsd  0xeb7(%rip),%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @dot2ang(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fcmp oge double %4, 1.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store double 0.000000e+00, double* %3
br label %16
7: ; preds = %1
%8 = load double, double* %2
%9 = fcmp ole double %8, -1.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %7
store double 1.800000e+02, double* %3
br label %15
11: ; preds = %7
%12 = load double, double* %2
%13 = call i32 @acos(double %12)
%14 = call double @rad2deg(i32 %13)
store double %14, double* %3
br label %15
15: ; preds = %11, %10
br label %16
16: ; preds = %15, %6
%17 = load double, double* %3
ret double %17
}

LLVM IR (-O2):
define double @dot2ang(double %0) {
%2 = fcmp ult double %0, 1.000000e+00
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = fcmp ugt double %0, -1.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i32 @acos(double %0)
%7 = tail call double @rad2deg(i32 %6)
br label %8
8: ; preds = %3, %1, %5
%9 = phi double [ %7, %5 ], [ 0.000000e+00, %1 ], [ 1.800000e+02, %3 ]
ret double %9
}
void func_2f(int *const *const i) {
  printf("func_2f : %d >> ", **i);
  {
    int bkup = **i;
    **i = 10;
    printf("%d\n", **i);
    **i = bkup;
  }
}


x86 assembly (clang, -O0):
<func_2f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movl   $0xa,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_2f>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    (%rax),%esi
lea    0xede(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%rax
mov    (%rax),%ebp
movl   $0xa,(%rax)
lea    0xed6(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%rax
mov    %ebp,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"func_2f : %d >> \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @func_2f(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = load i32, i32* %2
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32*, i32** %0
%6 = load i32, i32* %5
store i32 10, i32* %5
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 10)
%8 = load i32*, i32** %0
store i32 %6, i32* %8
ret void
}
__attribute__((always_)) void free_part_stats(struct hd_struct *part) {}


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

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

LLVM IR (-O0):
%struct.hd_struct = type opaque
define void @free_part_stats(%struct.hd_struct* %0) {
%2 = alloca %struct.hd_struct*
store %struct.hd_struct* %0, %struct.hd_struct** %2
ret void
}

LLVM IR (-O2):
%struct.hd_struct = type opaque
define void @free_part_stats(%struct.hd_struct* nocapture %0) {
ret void
}
int my_nb_len(int n) {
  int nb;
  int i;
  nb = n;
  i = 0;
  while (nb >= 1) {
    nb = nb / 10;
    i++;
  }
  return i;
}


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

x86 assembly (clang, -O2):
<my_nb_len>:
xor    %eax,%eax
test   %edi,%edi
jle    1124 <my_nb_len+0x24>
mov    $0xcccccccd,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x9,%edi
mov    %edx,%edi
ja     1110 <my_nb_len+0x10>
ret

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

LLVM IR (-O2):
define i32 @my_nb_len(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = udiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 10
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}