xunge/DecIR huggingface dataset:
int test_imm_8Dint16_mem(short *val) {
  return ((*val) & (-0x8D << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_8Dint16_mem>:
movzwl (%rdi),%eax
test   $0xff73,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_8Dint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -141
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int f_gt_rm2(float a1, float *a2) { return !(((a1) > (*a2))); }


x86 assembly (clang, -O0):
<f_gt_rm2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
mov    -0x10(%rbp),%rax
ucomiss (%rax),%xmm0
seta   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_gt_rm2>:
xor    %eax,%eax
ucomiss (%rdi),%xmm0
setbe  %al
ret

LLVM IR (-O0):
define i32 @f_gt_rm2(float %0, float* %1) {
%3 = alloca float
%4 = alloca float*
store float %0, float* %3
store float* %1, float** %4
%5 = load float, float* %3
%6 = load float*, float** %4
%7 = load float, float* %6
%8 = fcmp ogt float %5, %7
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @f_gt_rm2(float %0, float* nocapture %1) {
%3 = load float, float* %1
%4 = fcmp uge float %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  int fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
  (int)fd;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
call   1030 <socket@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    0x2ebe(%rip),%rax
mov    (%rax),%edx
call   1030 <socket@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @PF_INET
%4 = load i32, i32* @SOCK_STREAM
%5 = load i32, i32* @IPPROTO_TCP
%6 = call i32 @socket(i32 %3, i32 %4, i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %2
ret i32 0
}

LLVM IR (-O2):
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
define i32 @main() {
%1 = load i32, i32* @PF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = load i32, i32* @IPPROTO_TCP
%4 = tail call i32 @socket(i32 %1, i32 %2, i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cgdefw(int);
int /*<<< orphan*/ gendata();
void gendefw(int v) {
  gendata();
  cgdefw(v);
}


x86 assembly (clang, -O0):
<gendefw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <gendata@plt>
mov    -0x4(%rbp),%edi
call   1040 <cgdefw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gendefw>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <gendata@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <cgdefw@plt>

LLVM IR (-O0):
define void @gendefw(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @gendata()
%4 = load i32, i32* %2
%5 = call i32 @cgdefw(i32 %4)
ret void
}

LLVM IR (-O2):
define void @gendefw(i32 %0) {
%2 = tail call i32 (...) @gendata()
%3 = tail call i32 @cgdefw(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ get_log_file();
char *level_to_string(unsigned int);
void log_level(unsigned int level, char *message) {
  if (level <= 4) {
    fprintf(get_log_file(), "libpeggo [%s]: %s\n", level_to_string(level),
            message);
  }
}


x86 assembly (clang, -O0):
<log_level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x4(%rbp)
ja     1171 <log_level+0x41>
mov    $0x0,%al
call   1040 <get_log_file@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <level_to_string@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rdx
mov    -0x10(%rbp),%rcx
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_level>:
cmp    $0x4,%edi
ja     1168 <log_level+0x38>
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <get_log_file@plt>
mov    %eax,%r14d
mov    %ebp,%edi
call   1050 <level_to_string@plt>
lea    0xeaa(%rip),%rsi
mov    %r14d,%edi
mov    %rax,%rdx
mov    %rbx,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fprintf@plt>
ret

LLVM IR (-O0):
@.str = [19 x i8] c"libpeggo [%s]: %s\0A\00"
define void @log_level(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp ule i32 %5, 4
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = call i32 (...) @get_log_file()
%9 = load i32, i32* %3
%10 = call i8* @level_to_string(i32 %9)
%11 = load i8*, i8** %4
%12 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11)
br label %13
13: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"libpeggo [%s]: %s\0A\00"
define void @log_level(i32 %0, i8* %1) {
%3 = icmp ult i32 %0, 5
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 (...) @get_log_file()
%6 = tail call i8* @level_to_string(i32 %0)
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %1)
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ltrim(char *);
int /*<<< orphan*/ rtrim(char *);
char *trim(char *s) {
  if (!s)
    return NULL;
  ltrim(s);
  rtrim(s);
  return s;
}


x86 assembly (clang, -O0):
<trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1144 <trim+0x24>
movq   $0x0,-0x8(%rbp)
jmp    115e <trim+0x3e>
mov    -0x10(%rbp),%rdi
call   1040 <ltrim@plt>
mov    -0x10(%rbp),%rdi
call   1030 <rtrim@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     1139 <trim+0x19>
mov    %rbx,%rdi
call   1040 <ltrim@plt>
mov    %rbx,%rdi
call   1030 <rtrim@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @trim(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 %7, label %6
6: ; preds = %1
store i8* null, i8** %2
br label %13
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @ltrim(i8* %8)
%10 = load i8*, i8** %3
%11 = call i32 @rtrim(i8* %10)
%12 = load i8*, i8** %3
store i8* %12, i8** %2
br label %13
13: ; preds = %7, %6
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
define i8* @trim(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @ltrim(i8* %0)
%5 = tail call i32 @rtrim(i8* %0)
br label %6
6: ; preds = %1, %3
ret i8* %0
}
int nolog(const char *format, ...) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @nolog(i8* nocapture readnone %0, ...) {
ret i32 0
}
/* Variables and functions */
int istrsenvisx(char *, size_t *, char const *, size_t, int, char const *,
                int /*<<< orphan*/ *);
int strsnvisx(char *mbdst, size_t dlen, const char *mbsrc, size_t len,
              int flags, const char *mbextra) {
  return istrsenvisx(mbdst, &dlen, mbsrc, len, flags, mbextra, NULL);
}


x86 assembly (clang, -O0):
<strsnvisx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x30(%rbp),%r9
lea    -0x10(%rbp),%rsi
xor    %eax,%eax
movq   $0x0,(%rsp)
call   1030 <istrsenvisx@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsnvisx>:
sub    $0x18,%rsp
mov    %rsi,0x10(%rsp)
movq   $0x0,(%rsp)
lea    0x10(%rsp),%rsi
call   1030 <istrsenvisx@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @strsnvisx(i8* %0, i64 %1, i8* %2, i64 %3, i32 %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i8*
store i8* %0, i8** %7
store i64 %1, i64* %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i32 %4, i32* %11
store i8* %5, i8** %12
%13 = load i8*, i8** %7
%14 = load i8*, i8** %9
%15 = load i64, i64* %10
%16 = load i32, i32* %11
%17 = load i8*, i8** %12
%18 = call i32 @istrsenvisx(i8* %13, i64* %8, i8* %14, i64 %15, i32 %16, i8* %17, i32* null)
ret i32 %18
}

LLVM IR (-O2):
define i32 @strsnvisx(i8* %0, i64 %1, i8* %2, i64 %3, i32 %4, i8* %5) {
%7 = alloca i64
store i64 %1, i64* %7
%8 = call i32 @istrsenvisx(i8* %0, i64* %7, i8* %2, i64 %3, i32 %4, i8* %5, i32* null)
ret i32 %8
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t USBDMAChannelCountGet(uint32_t ui32Base, uint32_t ui32Channel) {
  ;
  ;
  return (
      (*((volatile uint32_t *)(ui32Base + 0x0000020C + (0x10 * ui32Channel)))));
}


x86 assembly (clang, -O0):
<USBDMAChannelCountGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20c,%eax
mov    -0x8(%rbp),%ecx
shl    $0x4,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBDMAChannelCountGet>:
movslq %edi,%rax
movslq %esi,%rcx
shl    $0x4,%rcx
mov    0x20c(%rax,%rcx,1),%eax
ret

LLVM IR (-O0):
define i32 @USBDMAChannelCountGet(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 = add nsw i32 %5, 524
%7 = load i32, i32* %4
%8 = mul nsw i32 16, %7
%9 = add nsw i32 %6, %8
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @USBDMAChannelCountGet(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 524
%4 = shl nsw i32 %1, 4
%5 = add nsw i32 %3, %4
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void wl(int len) {
  unsigned char c[4];
  c[0] = len & 0xff;
  c[1] = (len & 0xff00) >> 8;
  c[2] = (len & 0xff0000) >> 16;
  c[3] = (len & 0xff000000) >> 24;
  fwrite(c, 1, 4, stdout);
}


x86 assembly (clang, -O0):
<wl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,-0x7(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
mov    %al,-0x6(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    %al,-0x5(%rbp)
lea    -0x8(%rbp),%rdi
mov    0x2e85(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl>:
push   %rax
mov    %edi,0x4(%rsp)
mov    0x2ec4(%rip),%rax
mov    (%rax),%ecx
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fwrite@plt>
pop    %rax
ret

LLVM IR (-O0):
@stdout = global i32 0
define void @wl(i32 %0) {
%2 = alloca i32
%3 = alloca [4 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 255
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
store i8 %6, i8* %7
%8 = load i32, i32* %2
%9 = and i32 %8, 65280
%10 = ashr i32 %9, 8
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %11, i8* %12
%13 = load i32, i32* %2
%14 = and i32 %13, 16711680
%15 = ashr i32 %14, 16
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %16, i8* %17
%18 = load i32, i32* %2
%19 = and i32 %18, -16777216
%20 = lshr i32 %19, 24
%21 = trunc i32 %20 to i8
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 %21, i8* %22
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%24 = load i32, i32* @stdout
%25 = call i32 @fwrite(i8* %23, i32 1, i32 4, i32 %24)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @wl(i32 %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = lshr i32 %0, 8
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
store i8 %6, i8* %7
%8 = lshr i32 %0, 16
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
store i8 %9, i8* %10
%11 = lshr i32 %0, 24
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
store i8 %12, i8* %13
%14 = load i32, i32* @stdout
%15 = call i32 @fwrite(i8* %3, i32 1, i32 4, i32 %14)
ret void
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
pid_t getpid() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @getpid() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ max_heapify(void **, int, int, int (*)(void *, void *));
void build_max_heap(void **arr, int asz, int (*compare)(void *, void *)) {
  int i;
  for (i = asz / 2 - 1; i >= 0; i--)
    max_heapify(arr, i, asz, compare);
}


x86 assembly (clang, -O0):
<build_max_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     115f <build_max_heap+0x4f>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <max_heapify@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1134 <build_max_heap+0x24>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_max_heap>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%esi
jl     1148 <build_max_heap+0x38>
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%r15
mov    %esi,%ebx
shr    %ebx
add    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
lea    -0x2(%rbx),%esi
mov    %r15,%rdi
mov    %ebp,%edx
mov    %r14,%rcx
call   1030 <max_heapify@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1130 <build_max_heap+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @build_max_heap(i8** %0, i32 %1, i32 (i8*, i8*)* %2) {
%4 = icmp sgt i32 %1, 1
br i1 %4, label %5, label %12
5: ; preds = %3
%6 = lshr i32 %1, 1
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ %9, %7 ], [ %6, %5 ]
%9 = add nsw i32 %8, -1
%10 = tail call i32 @max_heapify(i8** %0, i32 %9, i32 %1, i32 (i8*, i8*)* %2)
%11 = icmp ugt i32 %8, 1
br i1 %11, label %7, label %12
12: ; preds = %7, %3
ret void
}
void *err_ptr(int err_code) { return (void *)-err_code; }


x86 assembly (clang, -O0):
<err_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<err_ptr>:
neg    %edi
movslq %edi,%rax
ret

LLVM IR (-O0):
define i8* @err_ptr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 0, %3
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
define i8* @err_ptr(i32 %0) {
%2 = sub nsw i32 0, %0
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
void xfrm_state_delete_tunnel(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<xfrm_state_delete_tunnel>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfrm_state_delete_tunnel>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.xfrm_state_delete_tunnel = [25 x i8] c"xfrm_state_delete_tunnel\00"
define void @xfrm_state_delete_tunnel() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__func__.xfrm_state_delete_tunnel, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.xfrm_state_delete_tunnel = [25 x i8] c"xfrm_state_delete_tunnel\00"
define void @xfrm_state_delete_tunnel() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__func__.xfrm_state_delete_tunnel, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int wprintw(int /*<<< orphan*/ *, char const *, int);
int i_wprintw(WINDOW *win, const char *fmt, int i) {
  return (wprintw(win, fmt, i));
}


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

x86 assembly (clang, -O2):
<i_wprintw>:
jmp    1030 <wprintw@plt>

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

LLVM IR (-O2):
define i32 @i_wprintw(i32* %0, i8* %1, i32 %2) {
%4 = tail call i32 @wprintw(i32* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Type definitions */
struct Ann {
  int dummy;
};

/* Variables and functions */
struct Ann *AnnCreateNet(int, int *);
struct Ann *AnnCreateNet4(int iunits, int hunits, int hunits2, int ounits) {
  int units[4];
  units[0] = ounits;
  units[1] = hunits2;
  units[2] = hunits;
  units[3] = iunits;
  return AnnCreateNet(4, units);
}


x86 assembly (clang, -O0):
<AnnCreateNet4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0x4,%edi
call   1030 <AnnCreateNet@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AnnCreateNet4>:
sub    $0x18,%rsp
mov    %ecx,(%rsp)
mov    %edx,0x4(%rsp)
mov    %esi,0x8(%rsp)
mov    %edi,0xc(%rsp)
mov    %rsp,%rsi
mov    $0x4,%edi
call   1030 <AnnCreateNet@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.Ann = type { i32 }
define %struct.Ann* @AnnCreateNet4(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [4 x i32]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
store i32 %10, i32* %11
%12 = load i32, i32* %7
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
store i32 %12, i32* %13
%14 = load i32, i32* %6
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 2
store i32 %14, i32* %15
%16 = load i32, i32* %5
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 3
store i32 %16, i32* %17
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%19 = call %struct.Ann* @AnnCreateNet(i32 4, i32* %18)
ret %struct.Ann* %19
}

LLVM IR (-O2):
%struct.Ann = type { i32 }
define %struct.Ann* @AnnCreateNet4(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [4 x i32]
%6 = bitcast [4 x i32]* %5 to i8*
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
store i32 %3, i32* %7
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 1
store i32 %2, i32* %8
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 2
store i32 %1, i32* %9
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 3
store i32 %0, i32* %10
%11 = call %struct.Ann* @AnnCreateNet(i32 4, i32* %7)
ret %struct.Ann* %11
}
float glmMax3f(float a, float b, float c) {
  if (a > b) {
    if (a > c)
      return a;
    else
      return c;
  } else {
    if (b > c)
      return b;
    else
      return c;
  }
}


x86 assembly (clang, -O0):
<glmMax3f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    114f <glmMax3f+0x4f>
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1140 <glmMax3f+0x40>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1177 <glmMax3f+0x77>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1177 <glmMax3f+0x77>
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    116d <glmMax3f+0x6d>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1177 <glmMax3f+0x77>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmMax3f>:
maxss  %xmm1,%xmm0
maxss  %xmm2,%xmm0
ret

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

LLVM IR (-O2):
define float @glmMax3f(float %0, float %1, float %2) {
%4 = fcmp ogt float %0, %1
%5 = fcmp ogt float %0, %2
%6 = select i1 %5, float %0, float %2
%7 = fcmp ogt float %1, %2
%8 = select i1 %7, float %1, float %2
%9 = select i1 %4, float %6, float %8
ret float %9
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_TYPE;

/* Variables and functions */
int /*<<< orphan*/ ASN1_ANY_it;
int ASN1_item_i2d(int /*<<< orphan*/ *, unsigned char **, int /*<<< orphan*/ *);
int i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **out) {
  return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ANY_it);
}


x86 assembly (clang, -O0):
<i2d_ASN1_TYPE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2eb1(%rip),%rdx
call   1030 <ASN1_item_i2d@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2d_ASN1_TYPE>:
mov    0x2ec9(%rip),%rdx
jmp    1030 <ASN1_item_i2d@plt>

LLVM IR (-O0):
@ASN1_ANY_it = global i32 0
define i32 @i2d_ASN1_TYPE(i32* %0, i8** %1) {
%3 = alloca i32*
%4 = alloca i8**
store i32* %0, i32** %3
store i8** %1, i8*** %4
%5 = load i32*, i32** %3
%6 = load i8**, i8*** %4
%7 = call i32 @ASN1_item_i2d(i32* %5, i8** %6, i32* @ASN1_ANY_it)
ret i32 %7
}

LLVM IR (-O2):
@ASN1_ANY_it = global i32 0
define i32 @i2d_ASN1_TYPE(i32* %0, i8** %1) {
%3 = tail call i32 @ASN1_item_i2d(i32* %0, i8** %1, i32* @ASN1_ANY_it)
ret i32 %3
}
int pct(int amount, int total) {
  float i = amount;
  i /= total;
  i *= 100;
  return (int)(i + .5);
}


x86 assembly (clang, -O0):
<pct>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xed9(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb6(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pct>:
cvtsi2ss %edi,%xmm0
cvtsi2ss %esi,%xmm1
divss  %xmm1,%xmm0
mulss  0xeec(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xee8(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @pct(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = sitofp i32 %6 to float
store float %7, float* %5
%8 = load i32, i32* %4
%9 = sitofp i32 %8 to float
%10 = load float, float* %5
%11 = fdiv float %10, %9
store float %11, float* %5
%12 = load float, float* %5
%13 = fmul float %12, 1.000000e+02
store float %13, float* %5
%14 = load float, float* %5
%15 = fpext float %14 to double
%16 = fadd double %15, 5.000000e-01
%17 = fptosi double %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @pct(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to float
%4 = sitofp i32 %1 to float
%5 = fdiv float %3, %4
%6 = fmul float %5, 1.000000e+02
%7 = fpext float %6 to double
%8 = fadd double %7, 5.000000e-01
%9 = fptosi double %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
void rand_init(void) { srand((unsigned)time(NULL)); }


x86 assembly (clang, -O0):
<rand_init>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_init>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <srand@plt>

LLVM IR (-O0):
define void @rand_init() {
%1 = call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = call i32 @srand(i32 %2)
ret void
}

LLVM IR (-O2):
define void @rand_init() {
%1 = tail call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @srand(i32 %2)
ret void
}
int test_imm_02int64_midword_reg(long long val) {
  return ((val >> 16) & (0x02 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_02int64_midword_reg(i64 %0) {
%2 = and i64 %0, 131072
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int fastrand();
void *realloc(void *, size_t);
void *hb_realloc_impl(void *ptr, size_t size) {
  return (fastrand() % 16) ? realloc(ptr, size) : NULL;
}


x86 assembly (clang, -O0):
<hb_realloc_impl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <fastrand@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     115e <hb_realloc_impl+0x3e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
jmp    1169 <hb_realloc_impl+0x49>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    1169 <hb_realloc_impl+0x49>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hb_realloc_impl>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <fastrand@plt>
test   $0xf,%al
je     1147 <hb_realloc_impl+0x27>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <realloc@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @hb_realloc_impl(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = call i32 (...) @fastrand()
%6 = srem i32 %5, 16
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = call i8* @realloc(i8* %9, i64 %10)
br label %13
12: ; preds = %2
br label %13
13: ; preds = %12, %8
%14 = phi i8* [ %11, %8 ], [ null, %12 ]
ret i8* %14
}

LLVM IR (-O2):
define noalias i8* @hb_realloc_impl(i8* nocapture %0, i64 %1) {
%3 = tail call i32 (...) @fastrand()
%4 = and i32 %3, 15
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i8* @realloc(i8* %0, i64 %1)
br label %8
8: ; preds = %2, %6
%9 = phi i8* [ %7, %6 ], [ null, %2 ]
ret i8* %9
}
/* Type definitions */
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ Button1;
int /*<<< orphan*/ SendMouseEvent(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                                  int, int);
int /*<<< orphan*/ usleep(int);
void pageForward(Display *display) {
  SendMouseEvent(display, Button1, 500, 300, true);
  usleep(10000);
  SendMouseEvent(display, Button1, 500, 300, false);
}


x86 assembly (clang, -O0):
<pageForward>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
mov    $0x1f4,%edx
mov    $0x12c,%ecx
mov    $0x1,%r8d
call   1030 <SendMouseEvent@plt>
mov    $0x2710,%edi
call   1040 <usleep@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e85(%rip),%rax
mov    (%rax),%esi
mov    $0x1f4,%edx
mov    $0x12c,%ecx
xor    %r8d,%r8d
call   1030 <SendMouseEvent@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pageForward>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eba(%rip),%r14
mov    (%r14),%esi
mov    $0x1f4,%edx
mov    $0x12c,%ecx
mov    $0x1,%r8d
call   1030 <SendMouseEvent@plt>
mov    $0x2710,%edi
call   1040 <usleep@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
mov    $0x1f4,%edx
mov    $0x12c,%ecx
xor    %r8d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <SendMouseEvent@plt>

LLVM IR (-O0):
@Button1 = global i32 0
define void @pageForward(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* @Button1
%5 = call i32 @SendMouseEvent(i32* %3, i32 %4, i32 500, i32 300, i32 1)
%6 = call i32 @usleep(i32 10000)
%7 = load i32*, i32** %2
%8 = load i32, i32* @Button1
%9 = call i32 @SendMouseEvent(i32* %7, i32 %8, i32 500, i32 300, i32 0)
ret void
}

LLVM IR (-O2):
@Button1 = global i32 0
define void @pageForward(i32* %0) {
%2 = load i32, i32* @Button1
%3 = tail call i32 @SendMouseEvent(i32* %0, i32 %2, i32 500, i32 300, i32 1)
%4 = tail call i32 @usleep(i32 10000)
%5 = load i32, i32* @Button1
%6 = tail call i32 @SendMouseEvent(i32* %0, i32 %5, i32 500, i32 300, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outop0str(char *);
void defbyte() { outop0str("FCB\t"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"FCB\09\00"
define void @defbyte() {
%1 = tail call i32 @outop0str(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
int dosyaj_graph_boolean_map_f(int x) {
  if (x > 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<dosyaj_graph_boolean_map_f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    111d <dosyaj_graph_boolean_map_f+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1124 <dosyaj_graph_boolean_map_f+0x24>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dosyaj_graph_boolean_map_f>:
xor    %eax,%eax
test   %edi,%edi
setg   %al
ret

LLVM IR (-O0):
define i32 @dosyaj_graph_boolean_map_f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @dosyaj_graph_boolean_map_f(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct vector {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ vector_clear(struct vector *);
struct vector *vector_new();
struct vector *vector_reuse(struct vector *vector) {
  if (vector == NULL)
    return vector_new();
  else {
    vector_clear(vector);
    return vector;
  }
}


x86 assembly (clang, -O0):
<vector_reuse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1147 <vector_reuse+0x27>
mov    $0x0,%al
call   1040 <vector_new@plt>
mov    %rax,-0x8(%rbp)
jmp    1158 <vector_reuse+0x38>
mov    -0x10(%rbp),%rdi
call   1030 <vector_clear@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_reuse>:
test   %rdi,%rdi
je     1133 <vector_reuse+0x13>
push   %rbx
mov    %rdi,%rbx
call   1030 <vector_clear@plt>
mov    %rbx,%rax
pop    %rbx
ret
xor    %eax,%eax
jmp    1040 <vector_new@plt>

LLVM IR (-O0):
%struct.vector = type { i32 }
define %struct.vector* @vector_reuse(%struct.vector* %0) {
%2 = alloca %struct.vector*
%3 = alloca %struct.vector*
store %struct.vector* %0, %struct.vector** %3
%4 = load %struct.vector*, %struct.vector** %3
%5 = icmp eq %struct.vector* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call %struct.vector* (...) @vector_new()
store %struct.vector* %7, %struct.vector** %2
br label %12
8: ; preds = %1
%9 = load %struct.vector*, %struct.vector** %3
%10 = call i32 @vector_clear(%struct.vector* %9)
%11 = load %struct.vector*, %struct.vector** %3
store %struct.vector* %11, %struct.vector** %2
br label %12
12: ; preds = %8, %6
%13 = load %struct.vector*, %struct.vector** %2
ret %struct.vector* %13
}

LLVM IR (-O2):
%struct.vector = type { i32 }
define %struct.vector* @vector_reuse(%struct.vector* %0) {
%2 = icmp eq %struct.vector* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call %struct.vector* (...) @vector_new()
br label %7
5: ; preds = %1
%6 = tail call i32 @vector_clear(%struct.vector* %0)
br label %7
7: ; preds = %5, %3
%8 = phi %struct.vector* [ %4, %3 ], [ %0, %5 ]
ret %struct.vector* %8
}
/* Type definitions */
typedef int /*<<< orphan*/ fpos_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int dll_fsetpos(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int __wrap_fsetpos(FILE *stream, fpos_t *pos) {
  return dll_fsetpos(stream, pos);
}


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

x86 assembly (clang, -O2):
<__wrap_fsetpos>:
jmp    1030 <dll_fsetpos@plt>

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

LLVM IR (-O2):
define i32 @__wrap_fsetpos(i32* %0, i32* %1) {
%3 = tail call i32 @dll_fsetpos(i32* %0, i32* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
scalar_t__ rat_mod_get_mvr(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/ *);
int rat_mod_requires_vid(uint16_t mid, uint16_t aid, uint16_t pid) {
  do {
  } while (0);
  if (rat_mod_get_mvr(mid, aid, pid, NULL, NULL) == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<rat_mod_requires_vid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
jmp    1126 <rat_mod_requires_vid+0x16>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rcx
call   1030 <rat_mod_get_mvr@plt>
cmp    $0x0,%rax
jne    1152 <rat_mod_requires_vid+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1159 <rat_mod_requires_vid+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rat_mod_requires_vid>:
push   %rax
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <rat_mod_get_mvr@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @rat_mod_requires_vid(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @rat_mod_get_mvr(i32 %0, i32 %1, i32 %2, i32* null, i32* null)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
unsigned int kbase_rk_dvfs_utilisation(struct kbase_device *kbdev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.kbase_device = type opaque
define i32 @kbase_rk_dvfs_utilisation(%struct.kbase_device* nocapture readnone %0) {
ret i32 0
}
load_log_page() {}


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

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

LLVM IR (-O0):
define i32 @load_log_page() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @load_log_page() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_third_greetings(void) {
  printf("Hello from PATCHED shared library!\n");
}


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

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

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

LLVM IR (-O2):
@str = [35 x i8] c"Hello from PATCHED shared library!\00"
define void @print_third_greetings() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ vprintf(char const *, int /*<<< orphan*/);
void Error(const char *fmt, va_list ap) {
  char dummy_string[30];
  printf("%6d Error callback:\n");
  vprintf(fmt, ap);
  printf("Please enter something to exit: ");
  fgets(dummy_string, 30, stdin);
  exit(1);
}


x86 assembly (clang, -O0):
<Error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <vprintf@plt>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    0x2e6a(%rip),%rax
mov    (%rax),%edx
mov    $0x1e,%esi
call   1040 <fgets@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<Error>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <vprintf@plt>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x1e,%esi
call   1040 <fgets@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"%6d Error callback:\0A\00"
@.str.1 = [33 x i8] c"Please enter something to exit: \00"
@stdin = global i32 0
define void @Error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [30 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i32 @vprintf(i8* %7, i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %11, i32 30, i32 %12)
%14 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [21 x i8] c"%6d Error callback:\0A\00"
@.str.1 = [33 x i8] c"Please enter something to exit: \00"
@stdin = global i32 0
define void @Error(i8* nocapture %0, i32 %1) {
%3 = alloca [30 x i8]
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @vprintf(i8* %0, i32 %1)
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %4, i32 30, i32 %8)
%10 = call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
void *rt_numa_numa_alloc_onnode(size_t s, int n, int c) { return NULL; }


x86 assembly (clang, -O0):
<rt_numa_numa_alloc_onnode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @rt_numa_numa_alloc_onnode(i64 %0, i32 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @rt_numa_numa_alloc_onnode(i64 %0, i32 %1, i32 %2) {
ret i8* null
}
void hpint_except() {}


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

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

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

LLVM IR (-O2):
define void @hpint_except() {
ret void
}
void functionExpr() {}


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

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

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

LLVM IR (-O2):
define void @functionExpr() {
ret void
}
long long fibo(long long n) {
  if (n == 0 || n == 1) {
    return n;
  } else {
    return fibo(n - 1) + fibo(n - 2);
  }
}


x86 assembly (clang, -O0):
<fibo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1132 <fibo+0x22>
cmpq   $0x1,-0x10(%rbp)
jne    113f <fibo+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116b <fibo+0x5b>
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <fibo@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x2,%rdi
call   1030 <fibo@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibo>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %r14d,%r14d
cmp    $0x2,%rdi
jb     1136 <fibo+0x26>
lea    -0x1(%rbx),%rdi
call   1030 <fibo@plt>
add    $0xfffffffffffffffe,%rbx
add    %rax,%r14
cmp    $0x1,%rbx
ja     1120 <fibo+0x10>
add    %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fibo(i64 %0) {
%2 = icmp ult i64 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ %0, %1 ]
%5 = phi i64 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i64 %4, -1
%7 = tail call i64 @fibo(i64 %6)
%8 = add nsw i64 %4, -2
%9 = add nsw i64 %7, %5
%10 = icmp ult i64 %8, 2
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i64 [ 0, %1 ], [ %9, %3 ]
%13 = phi i64 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i64 %13, %12
ret i64 %14
}