xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ pushNarray(char *, unsigned int);
void pushreal16array(char *x, int n) {
  pushNarray((char *)x, (unsigned int)(n * 16));
}


x86 assembly (clang, -O0):
<pushreal16array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shl    $0x4,%esi
call   1030 <pushNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pushreal16array>:
shl    $0x4,%esi
jmp    1030 <pushNarray@plt>

LLVM IR (-O0):
define void @pushreal16array(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 = mul nsw i32 %6, 16
%8 = call i32 @pushNarray(i8* %5, i32 %7)
ret void
}

LLVM IR (-O2):
define void @pushreal16array(i8* %0, i32 %1) {
%3 = shl nsw i32 %1, 4
%4 = tail call i32 @pushNarray(i8* %0, i32 %3)
ret void
}
void flush_cache_vunmap(unsigned long start, unsigned long end) {}


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

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

LLVM IR (-O0):
define void @flush_cache_vunmap(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
ret void
}

LLVM IR (-O2):
define void @flush_cache_vunmap(i64 %0, i64 %1) {
ret void
}
/* Type definitions */
struct forth_instance {
  int dummy;
};

/* Variables and functions */
intptr_t st_pop(struct forth_instance *);
void c_store(struct forth_instance *fi) {
  intptr_t tp = st_pop(fi);
  ((char *)tp)[0] = (char)st_pop(fi);
}


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

x86 assembly (clang, -O2):
<c_store>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <st_pop@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <st_pop@plt>
mov    %al,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.forth_instance = type { i32 }
define void @c_store(%struct.forth_instance* %0) {
%2 = alloca %struct.forth_instance*
%3 = alloca i64
store %struct.forth_instance* %0, %struct.forth_instance** %2
%4 = load %struct.forth_instance*, %struct.forth_instance** %2
%5 = call i64 @st_pop(%struct.forth_instance* %4)
store i64 %5, i64* %3
%6 = load %struct.forth_instance*, %struct.forth_instance** %2
%7 = call i64 @st_pop(%struct.forth_instance* %6)
%8 = trunc i64 %7 to i8
%9 = load i64, i64* %3
%10 = inttoptr i64 %9 to i8*
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 %8, i8* %11
ret void
}

LLVM IR (-O2):
%struct.forth_instance = type { i32 }
define void @c_store(%struct.forth_instance* %0) {
%2 = tail call i64 @st_pop(%struct.forth_instance* %0)
%3 = tail call i64 @st_pop(%struct.forth_instance* %0)
%4 = trunc i64 %3 to i8
%5 = inttoptr i64 %2 to i8*
store i8 %4, i8* %5
ret void
}
/* Variables and functions */
void *fb_StrAssignEx(void *, int, void *, int, int, int /*<<< orphan*/);
void *fb_StrAssign(void *dst, int dst_size, void *src, int src_size,
                   int fill_rem) {
  return fb_StrAssignEx(dst, dst_size, src, src_size, fill_rem, 0);
}


x86 assembly (clang, -O0):
<fb_StrAssign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
xor    %r9d,%r9d
call   1030 <fb_StrAssignEx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_StrAssign>:
xor    %r9d,%r9d
jmp    1030 <fb_StrAssignEx@plt>

LLVM IR (-O0):
define i8* @fb_StrAssign(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i8*, i8** %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i8* @fb_StrAssignEx(i8* %11, i32 %12, i8* %13, i32 %14, i32 %15, i32 0)
ret i8* %16
}

LLVM IR (-O2):
define i8* @fb_StrAssign(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = tail call i8* @fb_StrAssignEx(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 0)
ret i8* %6
}
/* Variables and functions */
scalar_t__ bkm_scale(unsigned long *, int);
int bkm_scale_by_power(unsigned long int *x, int base, int power) {
  while (power--)
    if (bkm_scale(x, base))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<bkm_scale_by_power>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     115d <bkm_scale_by_power+0x4d>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <bkm_scale@plt>
cmp    $0x0,%rax
je     1158 <bkm_scale_by_power+0x48>
movl   $0x1,-0x4(%rbp)
jmp    1164 <bkm_scale_by_power+0x54>
jmp    1122 <bkm_scale_by_power+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bkm_scale_by_power>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
add    $0x1,%ebx
nop
add    $0xffffffff,%ebx
je     113c <bkm_scale_by_power+0x2c>
mov    %rbp,%rdi
mov    %r14d,%esi
call   1030 <bkm_scale@plt>
test   %rax,%rax
je     1120 <bkm_scale_by_power+0x10>
mov    $0x1,%eax
jmp    113e <bkm_scale_by_power+0x2e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @bkm_scale_by_power(i64* %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %7, %3
%5 = phi i32 [ %2, %3 ], [ %8, %7 ]
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = add nsw i32 %5, -1
%9 = tail call i64 @bkm_scale(i64* %0, i32 %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %4, %7
%12 = phi i32 [ 1, %7 ], [ 0, %4 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SYS_getpid;
int /*<<< orphan*/ syscall_0(int /*<<< orphan*/);
pid_t getpid(void) { return syscall_0(SYS_getpid); }


x86 assembly (clang, -O0):
<getpid>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%edi
call   1030 <syscall_0@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<getpid>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall_0@plt>

LLVM IR (-O0):
@SYS_getpid = global i32 0
define i32 @getpid() {
%1 = load i32, i32* @SYS_getpid
%2 = call i32 @syscall_0(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@SYS_getpid = global i32 0
define i32 @getpid() {
%1 = load i32, i32* @SYS_getpid
%2 = tail call i32 @syscall_0(i32 %1)
ret i32 %2
}
int doubler(int num) { return num * 2; }


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

x86 assembly (clang, -O2):
<doubler>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @doubler(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
long ndb_get_ptr_i(long i_index, void **o_ptr, short *o_status, size_t *o_size,
                   char *o_remark) {
  return 0;
}


x86 assembly (clang, -O0):
<ndb_get_ptr_i>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @ndb_get_ptr_i(i64 %0, i8** %1, i16* %2, i64* %3, i8* %4) {
%6 = alloca i64
%7 = alloca i8**
%8 = alloca i16*
%9 = alloca i64*
%10 = alloca i8*
store i64 %0, i64* %6
store i8** %1, i8*** %7
store i16* %2, i16** %8
store i64* %3, i64** %9
store i8* %4, i8** %10
ret i64 0
}

LLVM IR (-O2):
define i64 @ndb_get_ptr_i(i64 %0, i8** nocapture readnone %1, i16* nocapture readnone %2, i64* nocapture readnone %3, i8* nocapture readnone %4) {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hp1(void) { printf("hello, world!\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"hello, world!\00"
define void @hp1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
__attribute__((__visibility__("hidden"))) double __math_check_uflow(double y) {
  return y == 0.0 ? (y) : y;
}


x86 assembly (clang, -O0):
<__math_check_uflow>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1130 <__math_check_uflow+0x30>
jp     1130 <__math_check_uflow+0x30>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    113a <__math_check_uflow+0x3a>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define hidden double @__math_check_uflow(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oeq double %3, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load double, double* %2
br label %9
7: ; preds = %1
%8 = load double, double* %2
br label %9
9: ; preds = %7, %5
%10 = phi double [ %6, %5 ], [ %8, %7 ]
ret double %10
}

LLVM IR (-O2):
define hidden double @__math_check_uflow(double returned %0) {
ret double %0
}
void slashcharclass2NVWHITESPACE() {}


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

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

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

LLVM IR (-O2):
define void @slashcharclass2NVWHITESPACE() {
ret void
}
int test_imm_D2uint32_mem(unsigned int *val) {
  return ((*val) & (0xD2 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D2uint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 210
%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_D2uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 210
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
char MirrorByte(char s) {
  return ((s << 7) + ((s << 5) & 64) + ((s << 3) & 32) + ((s << 1) & 16) +
          ((s >> 1) & 8) + ((s >> 3) & 4) + ((s >> 5) & 2) + (s >> 7));
}


x86 assembly (clang, -O0):
<MirrorByte>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
shl    $0x7,%eax
movsbl -0x1(%rbp),%ecx
shl    $0x5,%ecx
and    $0x40,%ecx
add    %ecx,%eax
movsbl -0x1(%rbp),%ecx
shl    $0x3,%ecx
and    $0x20,%ecx
add    %ecx,%eax
movsbl -0x1(%rbp),%ecx
shl    $0x1,%ecx
and    $0x10,%ecx
add    %ecx,%eax
movsbl -0x1(%rbp),%ecx
sar    $0x1,%ecx
and    $0x8,%ecx
add    %ecx,%eax
movsbl -0x1(%rbp),%ecx
sar    $0x3,%ecx
and    $0x4,%ecx
add    %ecx,%eax
movsbl -0x1(%rbp),%ecx
sar    $0x5,%ecx
and    $0x2,%ecx
add    %ecx,%eax
movsbl -0x1(%rbp),%ecx
sar    $0x7,%ecx
add    %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MirrorByte>:
mov    %edi,%r8d
shl    $0x7,%r8d
mov    %edi,%eax
shl    $0x5,%eax
and    $0x40,%eax
mov    %edi,%r10d
and    $0x4,%r10d
mov    %edi,%r9d
and    $0x8,%r9d
mov    %edi,%esi
shr    %esi
and    $0x8,%esi
mov    %edi,%edx
shr    $0x3,%edx
and    $0x4,%edx
mov    %edi,%ecx
shr    $0x5,%ecx
and    $0x2,%ecx
sar    $0x7,%edi
add    %r8d,%edi
add    %eax,%edi
lea    (%rdi,%r10,8),%eax
lea    (%rax,%r9,2),%eax
add    %esi,%eax
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @MirrorByte(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = shl i32 %4, 7
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = shl i32 %7, 5
%9 = and i32 %8, 64
%10 = add nsw i32 %5, %9
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = shl i32 %12, 3
%14 = and i32 %13, 32
%15 = add nsw i32 %10, %14
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = shl i32 %17, 1
%19 = and i32 %18, 16
%20 = add nsw i32 %15, %19
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = ashr i32 %22, 1
%24 = and i32 %23, 8
%25 = add nsw i32 %20, %24
%26 = load i8, i8* %2
%27 = sext i8 %26 to i32
%28 = ashr i32 %27, 3
%29 = and i32 %28, 4
%30 = add nsw i32 %25, %29
%31 = load i8, i8* %2
%32 = sext i8 %31 to i32
%33 = ashr i32 %32, 5
%34 = and i32 %33, 2
%35 = add nsw i32 %30, %34
%36 = load i8, i8* %2
%37 = sext i8 %36 to i32
%38 = ashr i32 %37, 7
%39 = add nsw i32 %35, %38
%40 = trunc i32 %39 to i8
ret i8 %40
}

LLVM IR (-O2):
define signext i8 @MirrorByte(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = shl nsw i32 %2, 7
%4 = shl nsw i32 %2, 5
%5 = and i32 %4, 64
%6 = shl nsw i32 %2, 3
%7 = and i32 %6, 32
%8 = shl nsw i32 %2, 1
%9 = and i32 %8, 16
%10 = lshr i32 %2, 1
%11 = and i32 %10, 8
%12 = lshr i32 %2, 3
%13 = and i32 %12, 4
%14 = lshr i32 %2, 5
%15 = and i32 %14, 2
%16 = ashr i32 %2, 7
%17 = add nsw i32 %16, %3
%18 = add nsw i32 %17, %5
%19 = add nsw i32 %18, %7
%20 = add nsw i32 %19, %9
%21 = add nsw i32 %20, %11
%22 = add i32 %21, %13
%23 = add i32 %22, %15
%24 = trunc i32 %23 to i8
ret i8 %24
}
/* Variables and functions */
char *mh_xcalloc(int, int);
char *mh_xstrdup(char const *);
char *getcpy(const char *str) {
  if (str)
    return mh_xstrdup(str);
  return mh_xcalloc(1, 1);
}


x86 assembly (clang, -O0):
<getcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1149 <getcpy+0x29>
mov    -0x10(%rbp),%rdi
call   1040 <mh_xstrdup@plt>
mov    %rax,-0x8(%rbp)
jmp    1159 <getcpy+0x39>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <mh_xcalloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcpy>:
test   %rdi,%rdi
je     112a <getcpy+0xa>
jmp    1040 <mh_xstrdup@plt>
mov    $0x1,%edi
mov    $0x1,%esi
jmp    1030 <mh_xcalloc@plt>

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

LLVM IR (-O2):
define i8* @getcpy(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @mh_xstrdup(i8* %0)
br label %7
5: ; preds = %1
%6 = tail call i8* @mh_xcalloc(i32 1, i32 1)
br label %7
7: ; preds = %5, %3
%8 = phi i8* [ %4, %3 ], [ %6, %5 ]
ret i8* %8
}
/* Variables and functions */
int atoi(char *);
int ExtractDayOfMonth(const char *RawDate) {
  char RawDay[3];
  int Temp;
  RawDay[0] = RawDate[8];
  RawDay[1] = RawDate[9];
  RawDay[2] = 0;
  Temp = atoi(RawDay);
  return Temp;
}


x86 assembly (clang, -O0):
<ExtractDayOfMonth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%al
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rax
mov    0x9(%rax),%al
mov    %al,-0xa(%rbp)
movb   $0x0,-0x9(%rbp)
lea    -0xb(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExtractDayOfMonth>:
push   %rax
mov    0x8(%rdi),%al
mov    %al,0x5(%rsp)
mov    0x9(%rdi),%al
mov    %al,0x6(%rsp)
movb   $0x0,0x7(%rsp)
lea    0x5(%rsp),%rdi
call   1030 <atoi@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ExtractDayOfMonth(i8* %0) {
%2 = alloca i8*
%3 = alloca [3 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 8
%7 = load i8, i8* %6
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
store i8 %7, i8* %8
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 9
%11 = load i8, i8* %10
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 1
store i8 %11, i8* %12
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
store i8 0, i8* %13
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %4
%16 = load i32, i32* %4
ret i32 %16
}

LLVM IR (-O2):
define i32 @ExtractDayOfMonth(i8* nocapture %0) {
%2 = alloca [3 x i8]
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds i8, i8* %0, i64 8
%5 = load i8, i8* %4
store i8 %5, i8* %3
%6 = getelementptr inbounds i8, i8* %0, i64 9
%7 = load i8, i8* %6
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
store i8 %7, i8* %8
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
store i8 0, i8* %9
%10 = call i32 @atoi(i8* %3)
ret i32 %10
}
void foo432(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo432(i32 %0) {
ret void
}
/* Variables and functions */
int gmx_within_tol(double, double, double);
int gmx_numzero(double a) {
  return gmx_within_tol(a, 0.0, 1.17549435E-38 / 5.96046448E-08);
}


x86 assembly (clang, -O0):
<gmx_numzero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
movsd  0xed3(%rip),%xmm2
call   1030 <gmx_within_tol@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gmx_numzero>:
movsd  0xee8(%rip),%xmm2
xorps  %xmm1,%xmm1
jmp    1030 <gmx_within_tol@plt>

LLVM IR (-O0):
define i32 @gmx_numzero(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @gmx_within_tol(double %3, double 0.000000e+00, double 0x398FFFFFFF671CD8)
ret i32 %4
}

LLVM IR (-O2):
define i32 @gmx_numzero(double %0) {
%2 = tail call i32 @gmx_within_tol(double %0, double 0.000000e+00, double 0x398FFFFFFF671CD8)
ret i32 %2
}
void arm_mcrr() {}


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

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

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

LLVM IR (-O2):
define void @arm_mcrr() {
ret void
}
/* Variables and functions */
double scalbn(double, int);
double SDL_scalbn(double x, int n) { return scalbn(x, n); }


x86 assembly (clang, -O0):
<SDL_scalbn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <scalbn@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SDL_scalbn>:
jmp    1030 <scalbn@plt>

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

LLVM IR (-O2):
define double @SDL_scalbn(double %0, i32 %1) {
%3 = tail call double @scalbn(double %0, i32 %1)
ret double %3
}
int hash(void *ptr, int size) { return (int)(((long)ptr) % size); }


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cqto
idiv   %rcx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    %rdi,%rax
movslq %esi,%rcx
mov    %rdi,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     111b <hash+0x1b>
cqto
idiv   %rcx
mov    %rdx,%rax
ret
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @hash(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 = ptrtoint i8* %5 to i64
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = srem i64 %6, %8
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @hash(i8* %0, i32 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = sext i32 %1 to i64
%5 = srem i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, char *, int);
char *sqlite3_errstr(int);
int /*<<< orphan*/ stderr;
void errSql(int rc, const char *op, const char *sql) {
  fprintf(stderr, "Error while %s: sql=%s error=%s (%d)\n", op, sql,
          sqlite3_errstr(rc), rc);
  abort();
}


x86 assembly (clang, -O0):
<errSql>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e96(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <sqlite3_errstr@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    %rax,%r8
mov    -0x4(%rbp),%r9d
lea    0xe80(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<errSql>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebp
mov    0x2e9a(%rip),%rax
mov    (%rax),%ebx
call   1050 <sqlite3_errstr@plt>
lea    0xeac(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %rax,%r8
mov    %ebp,%r9d
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"Error while %s: sql=%s error=%s (%d)\0A\00"
define void @errSql(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = load i32, i32* %4
%11 = call i8* @sqlite3_errstr(i32 %10)
%12 = load i32, i32* %4
%13 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9, i8* %11, i32 %12)
%14 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"Error while %s: sql=%s error=%s (%d)\0A\00"
define void @errSql(i32 %0, i8* %1, i8* %2) {
%4 = load i32, i32* @stderr
%5 = tail call i8* @sqlite3_errstr(i32 %0)
%6 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i8* %5, i32 %0)
%7 = tail call i32 (...) @abort()
unreachable
}
void derivs(float x, float y[], float dydx[]) {
  dydx[1] = x - y[1];
  dydx[2] = x * x - y[2];
}


x86 assembly (clang, -O0):
<derivs>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
mov    -0x10(%rbp),%rax
subss  0x4(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<derivs>:
movaps %xmm0,%xmm1
subss  0x4(%rdi),%xmm1
movss  %xmm1,0x4(%rsi)
mulss  %xmm0,%xmm0
subss  0x8(%rdi),%xmm0
movss  %xmm0,0x8(%rsi)
ret

LLVM IR (-O0):
define void @derivs(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 = getelementptr inbounds float, float* %8, i64 1
%10 = load float, float* %9
%11 = fsub float %7, %10
%12 = load float*, float** %6
%13 = getelementptr inbounds float, float* %12, i64 1
store float %11, float* %13
%14 = load float, float* %4
%15 = load float, float* %4
%16 = load float*, float** %5
%17 = getelementptr inbounds float, float* %16, i64 2
%18 = load float, float* %17
%19 = fneg float %18
%20 = call float @llvm.fmuladd.f32(float %14, float %15, float %19)
%21 = load float*, float** %6
%22 = getelementptr inbounds float, float* %21, i64 2
store float %20, float* %22
ret void
}

LLVM IR (-O2):
define void @derivs(float %0, float* nocapture %1, float* nocapture writeonly %2) {
%4 = getelementptr inbounds float, float* %1, i64 1
%5 = load float, float* %4
%6 = fsub float %0, %5
%7 = getelementptr inbounds float, float* %2, i64 1
store float %6, float* %7
%8 = getelementptr inbounds float, float* %1, i64 2
%9 = load float, float* %8
%10 = fneg float %9
%11 = tail call float @llvm.fmuladd.f32(float %0, float %0, float %10)
%12 = getelementptr inbounds float, float* %2, i64 2
store float %11, float* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ redraw();
void tty_show(void) { redraw(); }


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

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

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

LLVM IR (-O2):
define void @tty_show() {
%1 = tail call i32 (...) @redraw()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Keccak(int, int, unsigned char const *, unsigned int, int,
                          unsigned char *, int);
void FIPS202_SHAKE256(const unsigned char *input, unsigned int inputByteLen,
                      unsigned char *output, int outputByteLen) {
  Keccak(1088, 512, input, inputByteLen, 0x1F, output, outputByteLen);
}


x86 assembly (clang, -O0):
<FIPS202_SHAKE256>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r9
mov    -0x1c(%rbp),%eax
mov    $0x440,%edi
mov    $0x200,%esi
mov    $0x1f,%r8d
mov    %eax,(%rsp)
call   1030 <Keccak@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FIPS202_SHAKE256>:
push   %rax
mov    %rdx,%r9
mov    %esi,%eax
mov    %rdi,%rdx
mov    %ecx,(%rsp)
mov    $0x440,%edi
mov    $0x200,%esi
mov    %eax,%ecx
mov    $0x1f,%r8d
call   1030 <Keccak@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @FIPS202_SHAKE256(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @Keccak(i32 1088, i32 512, i8* %9, i32 %10, i32 31, i8* %11, i32 %12)
ret void
}

LLVM IR (-O2):
define void @FIPS202_SHAKE256(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32 @Keccak(i32 1088, i32 512, i8* %0, i32 %1, i32 31, i8* %2, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int oku() {
  int a;
  printf("bir sayi girin:");
  scanf("%d", &a);
  return a;
}


x86 assembly (clang, -O0):
<oku>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oku>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"bir sayi girin:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @oku() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [16 x i8] c"bir sayi girin:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @oku() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ flashrom_chip_write(int, int);
int /*<<< orphan*/ flashrom_wait_toggle_bit(int /*<<< orphan*/);
void flashrom_chip_erase(void) {
  flashrom_chip_write(0x5555, 0xAA);
  flashrom_chip_write(0x2AAA, 0x55);
  flashrom_chip_write(0x5555, 0x80);
  flashrom_chip_write(0x5555, 0xAA);
  flashrom_chip_write(0x2AAA, 0x55);
  flashrom_chip_write(0x5555, 0x10);
  flashrom_wait_toggle_bit(0);
}


x86 assembly (clang, -O0):
<flashrom_chip_erase>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5555,%edi
mov    $0xaa,%esi
call   1030 <flashrom_chip_write@plt>
mov    $0x2aaa,%edi
mov    $0x55,%esi
call   1030 <flashrom_chip_write@plt>
mov    $0x5555,%edi
mov    $0x80,%esi
call   1030 <flashrom_chip_write@plt>
mov    $0x5555,%edi
mov    $0xaa,%esi
call   1030 <flashrom_chip_write@plt>
mov    $0x2aaa,%edi
mov    $0x55,%esi
call   1030 <flashrom_chip_write@plt>
mov    $0x5555,%edi
mov    $0x10,%esi
call   1030 <flashrom_chip_write@plt>
xor    %edi,%edi
call   1040 <flashrom_wait_toggle_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<flashrom_chip_erase>:
push   %rax
mov    $0x5555,%edi
mov    $0xaa,%esi
call   1030 <flashrom_chip_write@plt>
mov    $0x2aaa,%edi
mov    $0x55,%esi
call   1030 <flashrom_chip_write@plt>
mov    $0x5555,%edi
mov    $0x80,%esi
call   1030 <flashrom_chip_write@plt>
mov    $0x5555,%edi
mov    $0xaa,%esi
call   1030 <flashrom_chip_write@plt>
mov    $0x2aaa,%edi
mov    $0x55,%esi
call   1030 <flashrom_chip_write@plt>
mov    $0x5555,%edi
mov    $0x10,%esi
call   1030 <flashrom_chip_write@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <flashrom_wait_toggle_bit@plt>

LLVM IR (-O0):
define void @flashrom_chip_erase() {
%1 = call i32 @flashrom_chip_write(i32 21845, i32 170)
%2 = call i32 @flashrom_chip_write(i32 10922, i32 85)
%3 = call i32 @flashrom_chip_write(i32 21845, i32 128)
%4 = call i32 @flashrom_chip_write(i32 21845, i32 170)
%5 = call i32 @flashrom_chip_write(i32 10922, i32 85)
%6 = call i32 @flashrom_chip_write(i32 21845, i32 16)
%7 = call i32 @flashrom_wait_toggle_bit(i32 0)
ret void
}

LLVM IR (-O2):
define void @flashrom_chip_erase() {
%1 = tail call i32 @flashrom_chip_write(i32 21845, i32 170)
%2 = tail call i32 @flashrom_chip_write(i32 10922, i32 85)
%3 = tail call i32 @flashrom_chip_write(i32 21845, i32 128)
%4 = tail call i32 @flashrom_chip_write(i32 21845, i32 170)
%5 = tail call i32 @flashrom_chip_write(i32 10922, i32 85)
%6 = tail call i32 @flashrom_chip_write(i32 21845, i32 16)
%7 = tail call i32 @flashrom_wait_toggle_bit(i32 0)
ret void
}
int SCE_Math_Ring(int x, int n) { return ((x % n) + n) % n; }


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

x86 assembly (clang, -O2):
<SCE_Math_Ring>:
mov    %edi,%eax
cltd
idiv   %esi
lea    (%rdx,%rsi,1),%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @SCE_Math_Ring(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 = srem i32 %5, %6
%8 = load i32, i32* %4
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %4
%11 = srem i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @SCE_Math_Ring(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = add nsw i32 %3, %1
%5 = srem i32 %4, %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ bar(char *);
void test4(int a, char b, char c, char d, char e, char f, char g, char h) {
  char *p = (char *)&a;
  p++;
  p++;
  p++;
  p++;
  bar(p);
}


x86 assembly (clang, -O0):
<test4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %r8d,-0x28(%rbp)
mov    %ecx,%eax
mov    -0x28(%rbp),%ecx
mov    %eax,-0x24(%rbp)
mov    %edx,%eax
mov    -0x24(%rbp),%edx
mov    %eax,-0x20(%rbp)
mov    %esi,%eax
mov    -0x20(%rbp),%esi
mov    %eax,-0x1c(%rbp)
mov    %edi,%r8d
mov    -0x1c(%rbp),%edi
mov    %r9b,%al
mov    0x18(%rbp),%r9b
mov    0x10(%rbp),%r9b
mov    %r8d,-0x4(%rbp)
mov    %dil,-0x5(%rbp)
mov    %sil,-0x6(%rbp)
mov    %dl,-0x7(%rbp)
mov    %cl,-0x8(%rbp)
mov    %al,-0x9(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <bar@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test4>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <bar@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @test4(i32 %0, i8 signext %1, i8 signext %2, i8 signext %3, i8 signext %4, i8 signext %5, i8 signext %6, i8 signext %7) {
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8
%15 = alloca i8
%16 = alloca i8
%17 = alloca i8*
store i32 %0, i32* %9
store i8 %1, i8* %10
store i8 %2, i8* %11
store i8 %3, i8* %12
store i8 %4, i8* %13
store i8 %5, i8* %14
store i8 %6, i8* %15
store i8 %7, i8* %16
%18 = bitcast i32* %9 to i8*
store i8* %18, i8** %17
%19 = load i8*, i8** %17
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %17
%21 = load i8*, i8** %17
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %17
%23 = load i8*, i8** %17
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %17
%25 = load i8*, i8** %17
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %17
%27 = load i8*, i8** %17
%28 = call i32 @bar(i8* %27)
ret void
}

LLVM IR (-O2):
define void @test4(i32 %0, i8 signext %1, i8 signext %2, i8 signext %3, i8 signext %4, i8 signext %5, i8 signext %6, i8 signext %7) {
%9 = alloca i32
store i32 %0, i32* %9
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = bitcast i32* %10 to i8*
%12 = call i32 @bar(i8* %11)
ret void
}
/* Type definitions */
struct lfq_ctx {
  int dummy;
};

/* Variables and functions */
int alloc_tid(struct lfq_ctx *);
int /*<<< orphan*/ free_tid(struct lfq_ctx *, int);
void *lfq_dequeue_tid(struct lfq_ctx *, int);
void *lfq_dequeue(struct lfq_ctx *ctx) {
  int tid = alloc_tid(ctx);
  if (tid == -1)
    return (void *)-1;
  void *ret = lfq_dequeue_tid(ctx, tid);
  free_tid(ctx, tid);
  return ret;
}


x86 assembly (clang, -O0):
<lfq_dequeue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <alloc_tid@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1162 <lfq_dequeue+0x32>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1186 <lfq_dequeue+0x56>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <lfq_dequeue_tid@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <free_tid@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lfq_dequeue>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <alloc_tid@plt>
cmp    $0xffffffff,%eax
je     115f <lfq_dequeue+0x2f>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <lfq_dequeue_tid@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <free_tid@plt>
mov    %r14,%rax
jmp    1166 <lfq_dequeue+0x36>
mov    $0xffffffffffffffff,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.lfq_ctx = type { i32 }
define i8* @lfq_dequeue(%struct.lfq_ctx* %0) {
%2 = alloca i8*
%3 = alloca %struct.lfq_ctx*
%4 = alloca i32
%5 = alloca i8*
store %struct.lfq_ctx* %0, %struct.lfq_ctx** %3
%6 = load %struct.lfq_ctx*, %struct.lfq_ctx** %3
%7 = call i32 @alloc_tid(%struct.lfq_ctx* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %1
store i8* inttoptr (i64 -1 to i8*), i8** %2
br label %19
11: ; preds = %1
%12 = load %struct.lfq_ctx*, %struct.lfq_ctx** %3
%13 = load i32, i32* %4
%14 = call i8* @lfq_dequeue_tid(%struct.lfq_ctx* %12, i32 %13)
store i8* %14, i8** %5
%15 = load %struct.lfq_ctx*, %struct.lfq_ctx** %3
%16 = load i32, i32* %4
%17 = call i32 @free_tid(%struct.lfq_ctx* %15, i32 %16)
%18 = load i8*, i8** %5
store i8* %18, i8** %2
br label %19
19: ; preds = %11, %10
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
%struct.lfq_ctx = type { i32 }
define i8* @lfq_dequeue(%struct.lfq_ctx* %0) {
%2 = tail call i32 @alloc_tid(%struct.lfq_ctx* %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i8* @lfq_dequeue_tid(%struct.lfq_ctx* %0, i32 %2)
%6 = tail call i32 @free_tid(%struct.lfq_ctx* %0, i32 %2)
br label %7
7: ; preds = %1, %4
%8 = phi i8* [ %5, %4 ], [ inttoptr (i64 -1 to i8*), %1 ]
ret i8* %8
}
/* Type definitions */
struct perm_args_info {
  int dummy;
};

/* Variables and functions */
int EXIT_SUCCESS;
int perm_cmdline_parser_required(struct perm_args_info *args_info,
                                 const char *prog_name) {
  (void)(args_info);
  (void)(prog_name);
  return EXIT_SUCCESS;
}


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

x86 assembly (clang, -O2):
<perm_cmdline_parser_required>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.perm_args_info = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @perm_cmdline_parser_required(%struct.perm_args_info* %0, i8* %1) {
%3 = alloca %struct.perm_args_info*
%4 = alloca i8*
store %struct.perm_args_info* %0, %struct.perm_args_info** %3
store i8* %1, i8** %4
%5 = load %struct.perm_args_info*, %struct.perm_args_info** %3
%6 = load i8*, i8** %4
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
%struct.perm_args_info = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @perm_cmdline_parser_required(%struct.perm_args_info* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
void name_output(struct cnode *cnode, unsigned int indent) {
  printf("%*s<name>\n", indent, "");
  outputchildren(cnode, indent, 1);
  printf("%*s</name>\n", indent, "");
}


x86 assembly (clang, -O0):
<name_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec7(%rip),%rdi
lea    0xed6(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1040 <outputchildren@plt>
mov    -0xc(%rbp),%esi
lea    0xea7(%rip),%rdi
lea    0xeab(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<name_output>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xecf(%rip),%rdi
lea    0xede(%rip),%r15
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <outputchildren@plt>
lea    0xeb1(%rip),%rdi
mov    %ebx,%esi
mov    %r15,%rdx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.cnode = type opaque
@.str = [11 x i8] c"%*s<name>\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [12 x i8] c"%*s</name>\0A\00"
define void @name_output(%struct.cnode* %0, i32 %1) {
%3 = alloca %struct.cnode*
%4 = alloca i32
store %struct.cnode* %0, %struct.cnode** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%7 = load %struct.cnode*, %struct.cnode** %3
%8 = load i32, i32* %4
%9 = call i32 (%struct.cnode*, i32, i32, ...) bitcast (i32 (...)* @outputchildren to i32 (%struct.cnode*, i32, i32, ...)*)(%struct.cnode* %7, i32 %8, i32 1)
%10 = load i32, i32* %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.cnode = type opaque
@.str = [11 x i8] c"%*s<name>\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [12 x i8] c"%*s</name>\0A\00"
define void @name_output(%struct.cnode* %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (%struct.cnode*, i32, i32, ...) bitcast (i32 (...)* @outputchildren to i32 (%struct.cnode*, i32, i32, ...)*)(%struct.cnode* %0, i32 %1, i32 1)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
void *my_calloc(int size, int num) {
  void *pointer = (void *)malloc(size * num * sizeof(char));
  return pointer;
}


x86 assembly (clang, -O0):
<my_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_calloc>:
imul   %esi,%edi
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define i8* @my_calloc(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
__attribute__((always_)) void __attribute__((format(printf, 1, 2)))
__simple_attr_check_format(const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @__simple_attr_check_format(i8* nocapture %0, ...) {
ret void
}
char *add_unsigned(char *base, unsigned long offset) { return base + offset; }


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

x86 assembly (clang, -O2):
<add_unsigned>:
lea    (%rdi,%rsi,1),%rax
ret

LLVM IR (-O0):
define i8* @add_unsigned(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = getelementptr inbounds i8, i8* %5, i64 %6
ret i8* %7
}

LLVM IR (-O2):
define i8* @add_unsigned(i8* readnone %0, i64 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 %1
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ createitem(int, int);
int newobject(int, int *);
int rnd(int);
void something(int cavelevel) {
  int j;
  int i;
  if (cavelevel < 0 || cavelevel > 11 + 3)
    return;
  if (rnd(101) < 8)
    something(cavelevel);
  j = newobject(cavelevel, &i);
  createitem(j, i);
}


x86 assembly (clang, -O0):
<something>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     115f <something+0x1f>
cmpl   $0xe,-0x4(%rbp)
jle    1164 <something+0x24>
jmp    1199 <something+0x59>
mov    $0x65,%edi
call   1050 <rnd@plt>
cmp    $0x8,%eax
jge    117f <something+0x3f>
mov    -0x4(%rbp),%edi
call   1030 <something@plt>
mov    -0x4(%rbp),%edi
lea    -0xc(%rbp),%rsi
call   1040 <newobject@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <createitem@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<something>:
cmp    $0xe,%edi
ja     117e <something+0x3e>
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    $0x65,%edi
call   1050 <rnd@plt>
cmp    $0x7,%eax
jg     1162 <something+0x22>
mov    %ebx,%edi
call   1030 <something@plt>
lea    0xc(%rsp),%rsi
mov    %ebx,%edi
call   1040 <newobject@plt>
mov    0xc(%rsp),%esi
mov    %eax,%edi
call   1060 <createitem@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @something(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 14
br i1 %9, label %10, label %11
10: ; preds = %7, %1
br label %22
11: ; preds = %7
%12 = call i32 @rnd(i32 101)
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = load i32, i32* %2
br label %16
16: ; preds = %14, %11
%17 = load i32, i32* %2
%18 = call i32 @newobject(i32 %17, i32* %4)
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @createitem(i32 %19, i32 %20)
br label %22
22: ; preds = %16, %10
ret void
}

LLVM IR (-O2):
define void @something(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = icmp ugt i32 %0, 14
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = tail call i32 @rnd(i32 101)
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %9
8: ; preds = %5
tail call void @something(i32 %0)
br label %9
9: ; preds = %8, %5
%10 = call i32 @newobject(i32 %0, i32* %2)
%11 = load i32, i32* %2
%12 = call i32 @createitem(i32 %10, i32 %11)
br label %13
13: ; preds = %1, %9
ret void
}