xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ crypto_scalarmult_base(unsigned char *, unsigned char *);
int /*<<< orphan*/ curve25519_randombytes(unsigned char *, int);
int curve25519_dh_keypair(unsigned char *pk, unsigned char *sk) {
  curve25519_randombytes(sk, 32);
  crypto_scalarmult_base(pk, sk);
  return 0;
}


x86 assembly (clang, -O0):
<curve25519_dh_keypair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x20,%esi
call   1030 <curve25519_randombytes@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <crypto_scalarmult_base@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curve25519_dh_keypair>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    $0x20,%esi
call   1030 <curve25519_randombytes@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <crypto_scalarmult_base@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @curve25519_dh_keypair(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @curve25519_randombytes(i8* %5, i32 32)
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 @crypto_scalarmult_base(i8* %7, i8* %8)
ret i32 0
}

LLVM IR (-O2):
define i32 @curve25519_dh_keypair(i8* %0, i8* %1) {
%3 = tail call i32 @curve25519_randombytes(i8* %1, i32 32)
%4 = tail call i32 @crypto_scalarmult_base(i8* %0, i8* %1)
ret i32 0
}
void ff_hevc_put_hevc_bi_epel_v48_10_avx2() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_epel_v48_10_avx2() {
ret void
}
unsigned mix32(unsigned int h) {
  h ^= h >> 16;
  h *= 0x85ebca6b;
  h ^= h >> 13;
  h *= 0xc2b2ae35;
  h ^= h >> 16;
  return h;
}


x86 assembly (clang, -O0):
<mix32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
imul   $0x85ebca6b,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0xd,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
imul   $0xc2b2ae35,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mix32>:
mov    %edi,%eax
shr    $0x10,%eax
xor    %edi,%eax
imul   $0x85ebca6b,%eax,%eax
mov    %eax,%ecx
shr    $0xd,%ecx
xor    %eax,%ecx
imul   $0xc2b2ae35,%ecx,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @mix32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 16
%5 = load i32, i32* %2
%6 = xor i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = mul i32 %7, -2048144789
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = lshr i32 %9, 13
%11 = load i32, i32* %2
%12 = xor i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = mul i32 %13, -1028477387
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = lshr i32 %15, 16
%17 = load i32, i32* %2
%18 = xor i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @mix32(i32 %0) {
%2 = lshr i32 %0, 16
%3 = xor i32 %2, %0
%4 = mul i32 %3, -2048144789
%5 = lshr i32 %4, 13
%6 = xor i32 %5, %4
%7 = mul i32 %6, -1028477387
%8 = lshr i32 %7, 16
%9 = xor i32 %8, %7
ret i32 %9
}
unsigned int calcAddrB(unsigned int offset) {
  offset *= 4;
  if (offset & 0x02000000)
    offset |= 0xfc000000;
  else
    offset &= 0x03ffffff;
  return offset + 8;
}


x86 assembly (clang, -O0):
<calcAddrB>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x2000000,%eax
cmp    $0x0,%eax
je     1131 <calcAddrB+0x31>
mov    -0x4(%rbp),%eax
or     $0xfc000000,%eax
mov    %eax,-0x4(%rbp)
jmp    113c <calcAddrB+0x3c>
mov    -0x4(%rbp),%eax
and    $0x3ffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcAddrB>:
lea    0x0(,%rdi,4),%eax
mov    %eax,%ecx
or     $0xfc000000,%ecx
and    $0x3fffffc,%eax
test   $0x800000,%edi
cmovne %ecx,%eax
add    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @calcAddrB(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul i32 %3, 4
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = and i32 %5, 33554432
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %2
%10 = or i32 %9, -67108864
store i32 %10, i32* %2
br label %14
11: ; preds = %1
%12 = load i32, i32* %2
%13 = and i32 %12, 67108863
store i32 %13, i32* %2
br label %14
14: ; preds = %11, %8
%15 = load i32, i32* %2
%16 = add i32 %15, 8
ret i32 %16
}

LLVM IR (-O2):
define i32 @calcAddrB(i32 %0) {
%2 = shl i32 %0, 2
%3 = and i32 %0, 8388608
%4 = icmp eq i32 %3, 0
%5 = or i32 %2, -67108864
%6 = and i32 %2, 67108860
%7 = select i1 %4, i32 %6, i32 %5
%8 = add nsw i32 %7, 8
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ setDefaultFilename();
int /*<<< orphan*/ setFilenameFromEnvironment();
void setFilenameAutomatically(void) {
  if (!setFilenameFromEnvironment())
    return;
  setDefaultFilename();
}


x86 assembly (clang, -O0):
<setFilenameAutomatically>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <setFilenameFromEnvironment@plt>
cmp    $0x0,%eax
jne    1139 <setFilenameAutomatically+0x19>
jmp    1140 <setFilenameAutomatically+0x20>
mov    $0x0,%al
call   1030 <setDefaultFilename@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<setFilenameAutomatically>:
push   %rax
xor    %eax,%eax
call   1040 <setFilenameFromEnvironment@plt>
test   %eax,%eax
je     1134 <setFilenameAutomatically+0x14>
xor    %eax,%eax
pop    %rcx
jmp    1030 <setDefaultFilename@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @setFilenameAutomatically() {
%1 = call i32 (...) @setFilenameFromEnvironment()
%2 = icmp ne i32 %1, 0
br i1 %2, label %4, label %3
3: ; preds = %0
br label %6
4: ; preds = %0
%5 = call i32 (...) @setDefaultFilename()
br label %6
6: ; preds = %4, %3
ret void
}

LLVM IR (-O2):
define void @setFilenameAutomatically() {
%1 = tail call i32 (...) @setFilenameFromEnvironment()
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @setDefaultFilename()
br label %5
5: ; preds = %0, %3
ret void
}
int getCounter() {
  static int s_counter = 0;
  return s_counter++;
}


x86 assembly (clang, -O0):
<getCounter>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f0f(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCounter>:
mov    0x2f1e(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2f15(%rip)
ret

LLVM IR (-O0):
@getCounter.s_counter = internal global i32 0
define i32 @getCounter() {
%1 = load i32, i32* @getCounter.s_counter
%2 = add nsw i32 %1, 1
store i32 %2, i32* @getCounter.s_counter
ret i32 %1
}

LLVM IR (-O2):
@getCounter.s_counter = internal unnamed_addr global i32 0
define i32 @getCounter() {
%1 = load i32, i32* @getCounter.s_counter
%2 = add nsw i32 %1, 1
store i32 %2, i32* @getCounter.s_counter
ret i32 %1
}
void ff_hevc_put_hevc_uni_epel_v32_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_epel_v32_10_sse4() {
ret void
}
/* Type definitions */
struct brw_compile {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ brw_wm_affine_st(struct brw_compile *, int, int, int);
int brw_wm_sample(struct brw_compile *, int, int, int, int);
int brw_wm_affine(struct brw_compile *p, int dw, int channel, int msg,
                  int result) {
  brw_wm_affine_st(p, dw, channel, msg);
  return brw_wm_sample(p, dw, channel, msg, result);
}


x86 assembly (clang, -O0):
<brw_wm_affine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <brw_wm_affine_st@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1040 <brw_wm_sample@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brw_wm_affine>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <brw_wm_affine_st@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <brw_wm_sample@plt>

LLVM IR (-O0):
%struct.brw_compile = type { i32 }
define i32 @brw_wm_affine(%struct.brw_compile* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.brw_compile*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.brw_compile* %0, %struct.brw_compile** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct.brw_compile*, %struct.brw_compile** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = call i32 @brw_wm_affine_st(%struct.brw_compile* %11, i32 %12, i32 %13, i32 %14)
%16 = load %struct.brw_compile*, %struct.brw_compile** %6
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = load i32, i32* %9
%20 = load i32, i32* %10
%21 = call i32 @brw_wm_sample(%struct.brw_compile* %16, i32 %17, i32 %18, i32 %19, i32 %20)
ret i32 %21
}

LLVM IR (-O2):
%struct.brw_compile = type { i32 }
define i32 @brw_wm_affine(%struct.brw_compile* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @brw_wm_affine_st(%struct.brw_compile* %0, i32 %1, i32 %2, i32 %3)
%7 = tail call i32 @brw_wm_sample(%struct.brw_compile* %0, i32 %1, i32 %2, i32 %3, i32 %4)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void sig_proc(int signo) {
  printf("proc new process send signal[%d] \n", signo);
}


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

x86 assembly (clang, -O2):
<sig_proc>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"proc new process send signal[%d] \0A\00"
define void @sig_proc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"proc new process send signal[%d] \0A\00"
define void @sig_proc(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ x86_int(int);
void x86illegal() { x86_int(6); }


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

x86 assembly (clang, -O2):
<x86illegal>:
mov    $0x6,%edi
jmp    1030 <x86_int@plt>

LLVM IR (-O0):
define void @x86illegal() {
%1 = call i32 @x86_int(i32 6)
ret void
}

LLVM IR (-O2):
define void @x86illegal() {
%1 = tail call i32 @x86_int(i32 6)
ret void
}
void foo263(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo263(i32 %0) {
ret void
}
/* Type definitions */
struct lobject {
  int dummy;
};
struct lemon {
  int dummy;
};

/* Variables and functions */
struct lobject *lobject_has_attr(struct lemon *, struct lobject *,
                                 struct lobject *);
struct lobject *lobject_get_default_has_attr(struct lemon *lemon,
                                             struct lobject *self, int argc,
                                             struct lobject *argv[]) {
  return lobject_has_attr(lemon, self, argv[0]);
}


x86 assembly (clang, -O0):
<lobject_get_default_has_attr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
call   1030 <lobject_has_attr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lobject_get_default_has_attr>:
mov    (%rcx),%rdx
jmp    1030 <lobject_has_attr@plt>

LLVM IR (-O0):
%struct.lemon = type { i32 }
%struct.lobject = type { i32 }
define %struct.lobject* @lobject_get_default_has_attr(%struct.lemon* %0, %struct.lobject* %1, i32 %2, %struct.lobject** %3) {
%5 = alloca %struct.lemon*
%6 = alloca %struct.lobject*
%7 = alloca i32
%8 = alloca %struct.lobject**
store %struct.lemon* %0, %struct.lemon** %5
store %struct.lobject* %1, %struct.lobject** %6
store i32 %2, i32* %7
store %struct.lobject** %3, %struct.lobject*** %8
%9 = load %struct.lemon*, %struct.lemon** %5
%10 = load %struct.lobject*, %struct.lobject** %6
%11 = load %struct.lobject**, %struct.lobject*** %8
%12 = getelementptr inbounds %struct.lobject*, %struct.lobject** %11, i64 0
%13 = load %struct.lobject*, %struct.lobject** %12
%14 = call %struct.lobject* @lobject_has_attr(%struct.lemon* %9, %struct.lobject* %10, %struct.lobject* %13)
ret %struct.lobject* %14
}

LLVM IR (-O2):
%struct.lemon = type { i32 }
%struct.lobject = type { i32 }
define %struct.lobject* @lobject_get_default_has_attr(%struct.lemon* %0, %struct.lobject* %1, i32 %2, %struct.lobject** nocapture %3) {
%5 = load %struct.lobject*, %struct.lobject** %3
%6 = tail call %struct.lobject* @lobject_has_attr(%struct.lemon* %0, %struct.lobject* %1, %struct.lobject* %5)
ret %struct.lobject* %6
}
void rop3_232_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk2 = S ^ T;
  stk3 = *D ^ S;
  stk2 = stk2 & stk3;
  stk1 = S ^ stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_232_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xa(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0xc(%rbp),%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
movzbl -0xa(%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    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%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):
<rop3_232_1_1>:
or     %edx,%esi
and    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_232_1_1(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* %5
%11 = zext i8 %10 to i32
%12 = load i8, i8* %6
%13 = zext i8 %12 to i32
%14 = xor i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = load i8, i8* %5
%20 = zext i8 %19 to i32
%21 = xor i32 %18, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %9
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = load i8, i8* %9
%26 = zext i8 %25 to i32
%27 = and i32 %24, %26
%28 = trunc i32 %27 to i8
store i8 %28, i8* %8
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = load i8, i8* %8
%32 = zext i8 %31 to i32
%33 = xor i32 %30, %32
%34 = trunc i32 %33 to i8
store i8 %34, i8* %7
%35 = load i8, i8* %7
%36 = zext i8 %35 to i32
%37 = load i8, i8* %5
%38 = zext i8 %37 to i32
%39 = xor i32 %38, -1
%40 = and i32 %36, %39
%41 = load i8, i8* %6
%42 = zext i8 %41 to i32
%43 = xor i32 %42, -1
%44 = and i32 %40, %43
%45 = load i8*, i8** %4
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = load i8, i8* %5
%49 = zext i8 %48 to i32
%50 = and i32 %47, %49
%51 = or i32 %44, %50
%52 = load i8*, i8** %4
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = load i8, i8* %6
%56 = zext i8 %55 to i32
%57 = and i32 %54, %56
%58 = or i32 %51, %57
%59 = trunc i32 %58 to i8
%60 = load i8*, i8** %4
store i8 %59, i8* %60
ret void
}

LLVM IR (-O2):
define void @rop3_232_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %2, %1
%6 = and i8 %4, %5
store i8 %6, i8* %0
ret void
}
int fun892() { return 892; }


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

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

LLVM IR (-O0):
define i32 @fun892() {
ret i32 892
}

LLVM IR (-O2):
define i32 @fun892() {
ret i32 892
}
int hex_to_int(char c) {
  if (c >= 97)
    c = c - 32;
  int first = c / 16 - 3;
  int second = c % 16;
  int result = first * 10 + second;
  if (result > 9)
    result--;
  return result;
}


x86 assembly (clang, -O0):
<hex_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1121 <hex_to_int+0x21>
movsbl -0x1(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
sub    $0x3,%eax
mov    %eax,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
imul   $0xa,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jle    115f <hex_to_int+0x5f>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_to_int>:
lea    -0x20(%rdi),%eax
cmp    $0x61,%dil
movzbl %al,%eax
cmovl  %edi,%eax
mov    %eax,%ecx
sar    $0x7,%cl
shr    $0x4,%cl
add    %al,%cl
mov    %ecx,%edx
and    $0xf0,%dl
sub    %dl,%al
sar    $0x4,%cl
movzbl %cl,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
movsbl %cl,%ecx
add    $0xe2,%al
movsbl %al,%eax
add    %ecx,%eax
xor    %ecx,%ecx
cmp    $0xa,%eax
setge  %cl
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @hex_to_int(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8 %0, i8* %2
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp sge i32 %7, 97
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = sub nsw i32 %11, 32
%13 = trunc i32 %12 to i8
store i8 %13, i8* %2
br label %14
14: ; preds = %9, %1
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = sdiv i32 %16, 16
%18 = sub nsw i32 %17, 3
store i32 %18, i32* %3
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = srem i32 %20, 16
store i32 %21, i32* %4
%22 = load i32, i32* %3
%23 = mul nsw i32 %22, 10
%24 = load i32, i32* %4
%25 = add nsw i32 %23, %24
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = icmp sgt i32 %26, 9
br i1 %27, label %28, label %31
28: ; preds = %14
%29 = load i32, i32* %5
%30 = add nsw i32 %29, -1
store i32 %30, i32* %5
br label %31
31: ; preds = %28, %14
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
define i32 @hex_to_int(i8 signext %0) {
%2 = icmp sgt i8 %0, 96
%3 = add i8 %0, -32
%4 = select i1 %2, i8 %3, i8 %0
%5 = sdiv i8 %4, 16
%6 = srem i8 %4, 16
%7 = mul nsw i8 %5, 10
%8 = sext i8 %7 to i32
%9 = add nsw i8 %6, -30
%10 = sext i8 %9 to i32
%11 = add nsw i32 %10, %8
%12 = icmp sgt i32 %11, 9
%13 = sext i1 %12 to i32
%14 = add nsw i32 %11, %13
ret i32 %14
}
void project_image(image, proj, nx, ny) float *image, *proj;
int nx, ny;
{
  float scale = 1.0;
  project_with_interp(image, proj, nx, ny, scale);
}


x86 assembly (clang, -O0):
<project_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movss  0xed2(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <project_with_interp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<project_image>:
movsd  0xee8(%rip),%xmm0
mov    $0x1,%al
jmp    1030 <project_with_interp@plt>

LLVM IR (-O0):
define void @project_image(float* %0, float* %1, i32 %2, i32 %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca float
store float* %0, float** %5
store float* %1, float** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store float 1.000000e+00, float* %9
%10 = load float*, float** %5
%11 = load float*, float** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load float, float* %9
%15 = fpext float %14 to double
%16 = call i32 (float*, float*, i32, i32, double, ...) bitcast (i32 (...)* @project_with_interp to i32 (float*, float*, i32, i32, double, ...)*)(float* %10, float* %11, i32 %12, i32 %13, double %15)
ret void
}

LLVM IR (-O2):
define void @project_image(float* %0, float* %1, i32 %2, i32 %3) {
%5 = tail call i32 (float*, float*, i32, i32, double, ...) bitcast (i32 (...)* @project_with_interp to i32 (float*, float*, i32, i32, double, ...)*)(float* %0, float* %1, i32 %2, i32 %3, double 1.000000e+00)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ steer(int);
void steer_center() { steer(1024 - 200); }


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

x86 assembly (clang, -O2):
<steer_center>:
mov    $0x338,%edi
jmp    1030 <steer@plt>

LLVM IR (-O0):
define void @steer_center() {
%1 = call i32 @steer(i32 824)
ret void
}

LLVM IR (-O2):
define void @steer_center() {
%1 = tail call i32 @steer(i32 824)
ret void
}
unsigned int fixunssfsi(float f) { return f; }


x86 assembly (clang, -O0):
<fixunssfsi>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
cvttss2si -0x4(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fixunssfsi>:
cvttss2si %xmm0,%rax
ret

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

LLVM IR (-O2):
define i32 @fixunssfsi(float %0) {
%2 = fptoui float %0 to i32
ret i32 %2
}
void sofunc(void) {
  extern void goCallback(void);
  goCallback();
}


x86 assembly (clang, -O0):
<sofunc>:
push   %rbp
mov    %rsp,%rbp
call   1030 <goCallback@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sofunc>:
jmp    1030 <goCallback@plt>

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

LLVM IR (-O2):
define void @sofunc() {
tail call void @goCallback()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SetupClock(int);
int /*<<< orphan*/ SetupFPU();
int /*<<< orphan*/ SetupStdio();
int /*<<< orphan*/ main();
void HardwareInit() {
  SetupFPU();
  SetupClock(1);
  SetupStdio();
  main();
}


x86 assembly (clang, -O0):
<HardwareInit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <SetupFPU@plt>
mov    $0x1,%edi
call   1030 <SetupClock@plt>
mov    $0x0,%al
call   1040 <SetupStdio@plt>
mov    $0x0,%al
call   1060 <main@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HardwareInit>:
push   %rax
xor    %eax,%eax
call   1050 <SetupFPU@plt>
mov    $0x1,%edi
call   1030 <SetupClock@plt>
xor    %eax,%eax
call   1040 <SetupStdio@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <main@plt>

LLVM IR (-O0):
define void @HardwareInit() {
%1 = call i32 (...) @SetupFPU()
%2 = call i32 @SetupClock(i32 1)
%3 = call i32 (...) @SetupStdio()
%4 = call i32 (...) @main()
ret void
}

LLVM IR (-O2):
define void @HardwareInit() {
%1 = tail call i32 (...) @SetupFPU()
%2 = tail call i32 @SetupClock(i32 1)
%3 = tail call i32 (...) @SetupStdio()
%4 = tail call i32 (...) @main()
ret void
}
int fib(n) {
  if (n <= 2)
    return 1;
  else
    return fib(n - 1) + fib(n - 2);
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     1131 <fib+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1154 <fib+0x44>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
cmp    $0x3,%edi
jl     1145 <fib+0x35>
mov    %edi,%ebx
add    $0x2,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x3(%rbx),%edi
call   1030 <fib@plt>
add    %eax,%ebp
add    $0xfffffffe,%ebx
cmp    $0x4,%ebx
ja     1130 <fib+0x20>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib(i32 %0) {
%2 = icmp slt i32 %0, 3
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 5
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = add i32 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 1, %1 ], [ %12, %11 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ pthread_self();
int __dealer(void *arg) {
  int _arg = *((int *)arg);
  printf("[%ld] %d\n", pthread_self(), _arg);
  return 0;
}


x86 assembly (clang, -O0):
<__dealer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%esi
mov    -0xc(%rbp),%edx
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__dealer>:
push   %rbx
mov    (%rdi),%ebx
xor    %eax,%eax
call   1040 <pthread_self@plt>
lea    0xecf(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"[%ld] %d\0A\00"
define i32 @__dealer(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = call i32 (...) @pthread_self()
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"[%ld] %d\0A\00"
define i32 @__dealer(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 (...) @pthread_self()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ compare_and_swap64(unsigned long long volatile *, long long,
                                      long long);
void atmc_add64(volatile unsigned long long *address, unsigned long long inc) {
  long long old_value;
  long long new_value;
  do {
    old_value = *address;
    new_value = old_value + inc;
  } while (!compare_and_swap64(address, old_value, new_value));
}


x86 assembly (clang, -O0):
<atmc_add64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <compare_and_swap64@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1120 <atmc_add64+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atmc_add64>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%rsi
lea    (%rsi,%r14,1),%rdx
mov    %rbx,%rdi
call   1030 <compare_and_swap64@plt>
test   %eax,%eax
je     1120 <atmc_add64+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @atmc_add64(i64* %0, i64 %1) {
br label %3
3: ; preds = %3, %2
%4 = load volatile i64, i64* %0
%5 = add i64 %4, %1
%6 = tail call i32 @compare_and_swap64(i64* %0, i64 %4, i64 %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %3, label %8
8: ; preds = %3
ret void
}
/* Variables and functions */
unsigned int zipmapRawKeyLength(unsigned char *);
unsigned int zipmapRawValueLength(unsigned char *);
unsigned int zipmapRawEntryLength(unsigned char *p) {
  unsigned int l = zipmapRawKeyLength(p);
  return l + zipmapRawValueLength(p + l);
}


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

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

LLVM IR (-O0):
define i32 @zipmapRawEntryLength(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @zipmapRawKeyLength(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i8*, i8** %2
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = call i32 @zipmapRawValueLength(i8* %10)
%12 = add i32 %6, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @zipmapRawEntryLength(i8* %0) {
%2 = tail call i32 @zipmapRawKeyLength(i8* %0)
%3 = zext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = tail call i32 @zipmapRawValueLength(i8* %4)
%6 = add i32 %5, %2
ret i32 %6
}
int fun(int n) {
  if ((n - 1) % 5 == 0)
    return n - (n - 1) / 5 - 1;
  return 0;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1144 <fun+0x44>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    114b <fun+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
add    $0xffffffff,%edi
imul   $0xcccccccd,%edi,%ecx
add    $0x19999999,%ecx
xor    %eax,%eax
cmp    $0x33333332,%ecx
jbe    111a <fun+0x1a>
ret
movslq %edi,%rax
imul   $0xffffffff99999999,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
add    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @fun(i32 %0) {
%2 = add i32 %0, -1
%3 = srem i32 %2, 5
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = sdiv i32 %2, -5
%7 = add i32 %2, %6
br label %8
8: ; preds = %1, %5
%9 = phi i32 [ %7, %5 ], [ 0, %1 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void no_mem_exit(char *where) {
  printf("Could not allocate memory: %s\n", where);
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"Could not allocate memory: %s\0A\00"
define void @no_mem_exit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [31 x i8] c"Could not allocate memory: %s\0A\00"
define void @no_mem_exit(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void menu(int value) { printf("menu: entry = %d\n", value); }


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

x86 assembly (clang, -O2):
<menu>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"menu: entry = %d\0A\00"
define void @menu(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"menu: entry = %d\0A\00"
define void @menu(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ run_example(char *);
int main(int argc, char **argv) {
  run_example("tests/testdata/uniprot_sprot.fasta");
  run_example("tests/testdata/Rfam_11_0.fasta");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <run_example@plt>
lea    0xeea(%rip),%rdi
call   1030 <run_example@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [35 x i8] c"tests/testdata/uniprot_sprot.fasta\00"
@.str.1 = [31 x i8] c"tests/testdata/Rfam_11_0.fasta\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @run_example(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @run_example(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"tests/testdata/uniprot_sprot.fasta\00"
@.str.1 = [31 x i8] c"tests/testdata/Rfam_11_0.fasta\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @run_example(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @run_example(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ srand(scalar_t__);
void red_srand() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  srand(tv.tv_sec * 1000000 + tv.tv_usec);
}


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

x86 assembly (clang, -O2):
<red_srand>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
imul   $0xf4240,%rax,%rdi
add    0x10(%rsp),%rdi
add    $0x18,%rsp
jmp    1040 <srand@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define void @red_srand() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000000
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = add nsw i64 %6, %8
%10 = call i32 @srand(i64 %9)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define void @red_srand() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %9, %7
%11 = tail call i32 @srand(i64 %10)
ret void
}
double ls_cost_nm2_sign(double x) { return x < 0 ? -1 : x > 0 ? 1 : x; }


x86 assembly (clang, -O0):
<ls_cost_nm2_sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1129 <ls_cost_nm2_sign+0x29>
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1161 <ls_cost_nm2_sign+0x61>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114d <ls_cost_nm2_sign+0x4d>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1157 <ls_cost_nm2_sign+0x57>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_cost_nm2_sign>:
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm0,%xmm2
movsd  0xeeb(%rip),%xmm3
andpd  %xmm2,%xmm3
andnpd %xmm0,%xmm2
orpd   %xmm3,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm2,%xmm1
movsd  0xed2(%rip),%xmm2
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ls_cost_nm2_sign(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %6
5: ; preds = %1
br label %14
6: ; preds = %1
%7 = load double, double* %2
%8 = fcmp ogt double %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %6
br label %12
10: ; preds = %6
%11 = load double, double* %2
br label %12
12: ; preds = %10, %9
%13 = phi double [ 1.000000e+00, %9 ], [ %11, %10 ]
br label %14
14: ; preds = %12, %5
%15 = phi double [ -1.000000e+00, %5 ], [ %13, %12 ]
ret double %15
}

LLVM IR (-O2):
define double @ls_cost_nm2_sign(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fcmp ogt double %0, 0.000000e+00
%4 = select i1 %3, double 1.000000e+00, double %0
%5 = select i1 %2, double -1.000000e+00, double %4
ret double %5
}
long find_zero(unsigned long mask) { return __builtin_ctzl(mask) >> 3; }


x86 assembly (clang, -O0):
<find_zero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
bsf    %rax,%rax
sar    $0x3,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_zero>:
bsf    %rdi,%rax
shr    $0x3,%rax
ret

LLVM IR (-O0):
define i64 @find_zero(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @llvm.cttz.i64(i64 %3, i1 true)
%5 = trunc i64 %4 to i32
%6 = ashr i32 %5, 3
%7 = sext i32 %6 to i64
ret i64 %7
}

LLVM IR (-O2):
define i64 @find_zero(i64 %0) {
%2 = tail call i64 @llvm.cttz.i64(i64 %0, i1 true)
%3 = lshr i64 %2, 3
ret i64 %3
}
unsigned int next_permutation(unsigned int v) {
  unsigned int t = v | (v - 1);
  return (t + 1) | (((~t & (t + 1)) - 1) >> (__builtin_ctz(v) + 1));
}


x86 assembly (clang, -O0):
<next_permutation>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    -0x8(%rbp),%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
and    %ecx,%edx
sub    $0x1,%edx
mov    -0x4(%rbp),%ecx
bsf    %ecx,%ecx
add    $0x1,%ecx
shr    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_permutation>:
lea    -0x1(%rdi),%eax
or     %edi,%eax
lea    0x1(%rax),%edx
not    %eax
and    %edx,%eax
add    $0xffffffff,%eax
bsf    %edi,%ecx
add    $0x1,%cl
shr    %cl,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @next_permutation(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = sub i32 %5, 1
%7 = or i32 %4, %6
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = add i32 %8, 1
%10 = load i32, i32* %3
%11 = xor i32 %10, -1
%12 = load i32, i32* %3
%13 = add i32 %12, 1
%14 = and i32 %11, %13
%15 = sub i32 %14, 1
%16 = load i32, i32* %2
%17 = call i32 @llvm.cttz.i32(i32 %16, i1 true)
%18 = add nsw i32 %17, 1
%19 = lshr i32 %15, %18
%20 = or i32 %9, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @next_permutation(i32 %0) {
%2 = add i32 %0, -1
%3 = or i32 %2, %0
%4 = add i32 %3, 1
%5 = xor i32 %3, -1
%6 = and i32 %4, %5
%7 = add i32 %6, -1
%8 = tail call i32 @llvm.cttz.i32(i32 %0, i1 true)
%9 = add nuw nsw i32 %8, 1
%10 = lshr i32 %7, %9
%11 = or i32 %10, %4
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
void *malloc(int);
int /*<<< orphan*/ stderr;
void *mymalloc(int size) {
  void *ret = malloc(size);
  if (ret == 0) {
    fputs("C CGI Library out of memory\n", stderr);
    exit(1);
  }
  return ret;
}


x86 assembly (clang, -O0):
<mymalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1171 <mymalloc+0x41>
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
lea    0xe9e(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mymalloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <mymalloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
lea    0xeb3(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"C CGI Library out of memory\0A\00"
@stderr = global i32 0
define i8* @mymalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [29 x i8] c"C CGI Library out of memory\0A\00"
@stderr = global i32 0
define noalias i8* @mymalloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ bus_read(int);
uint8_t read_fifo(void) {
  uint8_t data;
  data = bus_read(0x3D);
  return data;
}


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

x86 assembly (clang, -O2):
<read_fifo>:
mov    $0x3d,%edi
jmp    1030 <bus_read@plt>

LLVM IR (-O0):
define i32 @read_fifo() {
%1 = alloca i32
%2 = call i32 @bus_read(i32 61)
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @read_fifo() {
%1 = tail call i32 @bus_read(i32 61)
ret i32 %1
}
int hex2dec4Byte(unsigned char byte3, unsigned char byte2, unsigned char byte1,
                 unsigned char byte0) {
  return (byte3 << 24) + (byte2 << 16) + (byte1 << 8) + byte0;
}


x86 assembly (clang, -O0):
<hex2dec4Byte>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %cl,-0x3(%rbp)
mov    %al,-0x4(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x18,%eax
movzbl -0x2(%rbp),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
movzbl -0x3(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
movzbl -0x4(%rbp),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex2dec4Byte>:
shl    $0x18,%edi
shl    $0x10,%esi
lea    (%rsi,%rdi,1),%eax
shl    $0x8,%edx
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @hex2dec4Byte(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8 %0, i8* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 24
%12 = load i8, i8* %6
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 16
%15 = add nsw i32 %11, %14
%16 = load i8, i8* %7
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = add nsw i32 %15, %18
%20 = load i8, i8* %8
%21 = zext i8 %20 to i32
%22 = add nsw i32 %19, %21
ret i32 %22
}

LLVM IR (-O2):
define i32 @hex2dec4Byte(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = zext i8 %0 to i32
%6 = shl nuw i32 %5, 24
%7 = zext i8 %1 to i32
%8 = shl nuw nsw i32 %7, 16
%9 = or i32 %8, %6
%10 = zext i8 %2 to i32
%11 = shl nuw nsw i32 %10, 8
%12 = or i32 %9, %11
%13 = zext i8 %3 to i32
%14 = or i32 %12, %13
ret i32 %14
}