xunge/DecIR huggingface dataset:
void v2lin(float *restrict a, const float *b, const float c, const float *d,
           const float e) {
  a[0] = b[0] * c + d[0] * e;
  a[1] = b[1] * c + d[1] * e;
}


x86 assembly (clang, -O0):
<v2lin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movss  %xmm1,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x14(%rbp),%xmm2
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm1
mulss  -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  -0x14(%rbp),%xmm2
mov    -0x20(%rbp),%rax
movss  0x4(%rax),%xmm1
mulss  -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<v2lin>:
movss  (%rdx),%xmm2
mulss  %xmm1,%xmm2
movss  (%rsi),%xmm3
mulss  %xmm0,%xmm3
addss  %xmm2,%xmm3
movss  %xmm3,(%rdi)
mulss  0x4(%rdx),%xmm1
mulss  0x4(%rsi),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0x4(%rdi)
ret

LLVM IR (-O0):
define void @v2lin(float* noalias %0, float* %1, float %2, float* %3, float %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float
%9 = alloca float*
%10 = alloca float
store float* %0, float** %6
store float* %1, float** %7
store float %2, float* %8
store float* %3, float** %9
store float %4, float* %10
%11 = load float*, float** %7
%12 = getelementptr inbounds float, float* %11, i64 0
%13 = load float, float* %12
%14 = load float, float* %8
%15 = load float*, float** %9
%16 = getelementptr inbounds float, float* %15, i64 0
%17 = load float, float* %16
%18 = load float, float* %10
%19 = fmul float %17, %18
%20 = call float @llvm.fmuladd.f32(float %13, float %14, float %19)
%21 = load float*, float** %6
%22 = getelementptr inbounds float, float* %21, i64 0
store float %20, float* %22
%23 = load float*, float** %7
%24 = getelementptr inbounds float, float* %23, i64 1
%25 = load float, float* %24
%26 = load float, float* %8
%27 = load float*, float** %9
%28 = getelementptr inbounds float, float* %27, i64 1
%29 = load float, float* %28
%30 = load float, float* %10
%31 = fmul float %29, %30
%32 = call float @llvm.fmuladd.f32(float %25, float %26, float %31)
%33 = load float*, float** %6
%34 = getelementptr inbounds float, float* %33, i64 1
store float %32, float* %34
ret void
}

LLVM IR (-O2):
define void @v2lin(float* noalias nocapture writeonly %0, float* nocapture %1, float %2, float* nocapture %3, float %4) {
%6 = load float, float* %1
%7 = load float, float* %3
%8 = fmul float %7, %4
%9 = tail call float @llvm.fmuladd.f32(float %6, float %2, float %8)
store float %9, float* %0
%10 = getelementptr inbounds float, float* %1, i64 1
%11 = load float, float* %10
%12 = getelementptr inbounds float, float* %3, i64 1
%13 = load float, float* %12
%14 = fmul float %13, %4
%15 = tail call float @llvm.fmuladd.f32(float %11, float %2, float %14)
%16 = getelementptr inbounds float, float* %0, i64 1
store float %15, float* %16
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void s500_writel(uint32_t val, uint32_t *addr) { *addr = val; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @s500_writel(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
store i32 %5, i32* %6
ret void
}

LLVM IR (-O2):
define void @s500_writel(i32 %0, i32* nocapture writeonly %1) {
store i32 %0, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ deviceIf_getFrameBuffer(void **, int *, unsigned int *);
int /*<<< orphan*/ printf(char *);
void get_fbuf(void **start, unsigned int *used) {
  int length;
  printf("calling deviceIf_getFrameBuffer\n");
  deviceIf_getFrameBuffer(start, &length, used);
}


x86 assembly (clang, -O0):
<get_fbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rsi
call   1030 <deviceIf_getFrameBuffer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_fbuf>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1040 <deviceIf_getFrameBuffer@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [33 x i8] c"calling deviceIf_getFrameBuffer\0A\00"
define void @get_fbuf(i8** %0, i32* %1) {
%3 = alloca i8**
%4 = alloca i32*
%5 = alloca i32
store i8** %0, i8*** %3
store i32* %1, i32** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%7 = load i8**, i8*** %3
%8 = load i32*, i32** %4
%9 = call i32 @deviceIf_getFrameBuffer(i8** %7, i32* %5, i32* %8)
ret void
}

LLVM IR (-O2):
@str = [32 x i8] c"calling deviceIf_getFrameBuffer\00"
define void @get_fbuf(i8** %0, i32* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%6 = call i32 @deviceIf_getFrameBuffer(i8** %0, i32* %3, i32* %1)
ret void
}
void _no_params(void) { asm("nop"); }


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

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

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

LLVM IR (-O2):
define void @_no_params() {
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printbytes(unsigned char const *b) {
  for (int idx = 1; idx < 33; ++idx) {
    printf("%02x", b[idx - 1]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printbytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x21,-0xc(%rbp)
jge    115a <printbytes+0x4a>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <printbytes+0x13>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printbytes>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xed1(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    1140 <printbytes+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printbytes(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %3
br label %4
4: ; preds = %16, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 33
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %7
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %4
19: ; preds = %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
define void @printbytes(i8* nocapture %0) {
br label %4
2: ; preds = %4
%3 = tail call i32 @putchar(i32 10)
ret void
4: ; preds = %1, %4
%5 = phi i64 [ 1, %1 ], [ %11, %4 ]
%6 = add nsw i64 %5, -1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %5, 1
%12 = icmp eq i64 %11, 33
br i1 %12, label %2, label %4
}
/* Variables and functions */
int /*<<< orphan*/ inb(int);
void qemu_cfg_skip(int len) {
  while (len--)
    inb(0x0511);
}


x86 assembly (clang, -O0):
<qemu_cfg_skip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     113e <qemu_cfg_skip+0x2e>
mov    $0x511,%edi
call   1030 <inb@plt>
jmp    111b <qemu_cfg_skip+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qemu_cfg_skip>:
push   %rbx
test   %edi,%edi
je     112f <qemu_cfg_skip+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x511,%edi
call   1030 <inb@plt>
add    $0xffffffff,%ebx
jne    1120 <qemu_cfg_skip+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @qemu_cfg_skip(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
store i32 %5, i32* %2
%6 = icmp ne i32 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @inb(i32 1297)
br label %3
9: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @qemu_cfg_skip(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
%6 = tail call i32 @inb(i32 1297)
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Type definitions */
struct winsize {
  int ws_row;
  int ws_col;
};

/* Variables and functions */
int /*<<< orphan*/ TIOCSWINSZ;
scalar_t__ ioctl(int, int /*<<< orphan*/, struct winsize *);
int setwinsize(int fd, int row, int col) {
  struct winsize ws;
  ws.ws_row = row;
  ws.ws_col = col;
  if (ioctl(fd, TIOCSWINSZ, &ws) == 0) {
    return 0;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<setwinsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jne    1158 <setwinsize+0x48>
movl   $0x0,-0x4(%rbp)
jmp    115f <setwinsize+0x4f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setwinsize>:
push   %rax
mov    %esi,(%rsp)
mov    %edx,0x4(%rsp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
call   1030 <ioctl@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.winsize = type { i32, i32 }
@TIOCSWINSZ = global i32 0
define i32 @setwinsize(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.winsize
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %6
%10 = getelementptr inbounds %struct.winsize, %struct.winsize* %8, i32 0, i32 0
store i32 %9, i32* %10
%11 = load i32, i32* %7
%12 = getelementptr inbounds %struct.winsize, %struct.winsize* %8, i32 0, i32 1
store i32 %11, i32* %12
%13 = load i32, i32* %5
%14 = load i32, i32* @TIOCSWINSZ
%15 = call i64 @ioctl(i32 %13, i32 %14, %struct.winsize* %8)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %3
store i32 0, i32* %4
br label %19
18: ; preds = %3
store i32 -1, i32* %4
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
%struct.winsize = type { i32, i32 }
@TIOCSWINSZ = global i32 0
define i32 @setwinsize(i32 %0, i32 %1, i32 %2) {
%4 = alloca %struct.winsize
%5 = bitcast %struct.winsize* %4 to i8*
%6 = getelementptr inbounds %struct.winsize, %struct.winsize* %4, i64 0, i32 0
store i32 %1, i32* %6
%7 = getelementptr inbounds %struct.winsize, %struct.winsize* %4, i64 0, i32 1
store i32 %2, i32* %7
%8 = load i32, i32* @TIOCSWINSZ
%9 = call i64 @ioctl(i32 %0, i32 %8, %struct.winsize* %4)
%10 = icmp ne i64 %9, 0
%11 = sext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void got_libhdr(char *cp, int len) { printf("LIBHDR\n"); }


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

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

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

LLVM IR (-O2):
@str = [7 x i8] c"LIBHDR\00"
define void @got_libhdr(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
size_t json_parse_string(char const *, int /*<<< orphan*/ *,
                         int /*<<< orphan*/);
size_t strlen(char const *);
bool json_is_string(const char *str) {
  size_t len;
  len = strlen(str);
  if (!len)
    return false;
  return json_parse_string(str, NULL, 0) == len;
}


x86 assembly (clang, -O0):
<json_is_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1150 <json_is_string+0x30>
movl   $0x0,-0x4(%rbp)
jmp    116e <json_is_string+0x4e>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <json_parse_string@plt>
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_is_string>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rax,%rax
je     114d <json_is_string+0x2d>
mov    %rax,%r14
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <json_parse_string@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %r14,%rcx
sete   %al
jmp    114f <json_is_string+0x2f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @json_is_string(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i64 @json_parse_string(i8* %0, i32* null, i32 0)
%6 = icmp eq i64 %5, %2
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}
void TestAppP$Leds$led1On(void) { LedsP$Leds$led1On(); }


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

x86 assembly (clang, -O2):
<TestAppP$Leds$led1On>:
xor    %eax,%eax
jmp    1030 <LedsP$Leds$led1On@plt>

LLVM IR (-O0):
define void @"TestAppP$Leds$led1On"() {
%1 = call i32 (...) @"LedsP$Leds$led1On"()
ret void
}

LLVM IR (-O2):
define void @"TestAppP$Leds$led1On"() {
%1 = tail call i32 (...) @"LedsP$Leds$led1On"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void signal_handler(int signal) { printf("SIGINT received\n"); }


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

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

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

LLVM IR (-O2):
@str = [16 x i8] c"SIGINT received\00"
define void @signal_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int my_bcmp(char *str1, char *str2, size_t n) {
  unsigned long i;
  for (i = 0; i < n; i++)
    if (str1[i] != str2[i])
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<my_bcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1168 <my_bcmp+0x68>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1152 <my_bcmp+0x52>
movl   $0x1,-0x4(%rbp)
jmp    116f <my_bcmp+0x6f>
jmp    1157 <my_bcmp+0x57>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1118 <my_bcmp+0x18>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_bcmp>:
test   %rdx,%rdx
je     1122 <my_bcmp+0x22>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movzbl (%rdi,%rax,1),%ecx
cmp    (%rsi,%rax,1),%cl
jne    1125 <my_bcmp+0x25>
add    $0x1,%rax
cmp    %rax,%rdx
jne    1110 <my_bcmp+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @my_bcmp(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %15, label %7
5: ; preds = %7
%6 = icmp eq i64 %14, %2
br i1 %6, label %15, label %7
7: ; preds = %3, %5
%8 = phi i64 [ %14, %5 ], [ 0, %3 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %1, i64 %8
%12 = load i8, i8* %11
%13 = icmp eq i8 %10, %12
%14 = add nuw i64 %8, 1
br i1 %13, label %5, label %15
15: ; preds = %7, %5, %3
%16 = phi i32 [ 0, %3 ], [ 0, %5 ], [ 1, %7 ]
ret i32 %16
}
float EaseCubicIn(float t, float b, float c, float d) {
  t /= d;
  return (c * t * t * t + b);
}


x86 assembly (clang, -O0):
<EaseCubicIn>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x10(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<EaseCubicIn>:
divss  %xmm3,%xmm0
mulss  %xmm0,%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @EaseCubicIn(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %8
%10 = load float, float* %5
%11 = fdiv float %10, %9
store float %11, float* %5
%12 = load float, float* %7
%13 = load float, float* %5
%14 = fmul float %12, %13
%15 = load float, float* %5
%16 = fmul float %14, %15
%17 = load float, float* %5
%18 = load float, float* %6
%19 = call float @llvm.fmuladd.f32(float %16, float %17, float %18)
ret float %19
}

LLVM IR (-O2):
define float @EaseCubicIn(float %0, float %1, float %2, float %3) {
%5 = fdiv float %0, %3
%6 = fmul float %5, %2
%7 = fmul float %5, %6
%8 = tail call float @llvm.fmuladd.f32(float %7, float %5, float %1)
ret float %8
}
int test_imm_66uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x66 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_66uint64_highword_reg>:
movabs $0x6600000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_66uint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 102
%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_66uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 438086664192
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ hash(char *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char word[201];
  scanf("%s", word);
  printf("%ld", hash(word));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1050 <scanf@plt>
lea    -0xd0(%rbp),%rdi
call   1030 <hash@plt>
mov    %eax,%esi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xd0,%rsp
lea    0xec1(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <hash@plt>
lea    0xeaa(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%ld\00"
define i32 @main() {
%1 = alloca [201 x i8]
%2 = getelementptr inbounds [201 x i8], [201 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @hash(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ kbdclient_init(char *, int);
void kbdclient_init_default() { kbdclient_init("127.0.0.1", 53841); }


x86 assembly (clang, -O0):
<kbdclient_init_default>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0xd251,%esi
call   1030 <kbdclient_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kbdclient_init_default>:
lea    0xee9(%rip),%rdi
mov    $0xd251,%esi
jmp    1030 <kbdclient_init@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"127.0.0.1\00"
define void @kbdclient_init_default() {
%1 = tail call i32 @kbdclient_init(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 53841)
ret void
}
int fun686() { return 686; }


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

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

LLVM IR (-O0):
define i32 @fun686() {
ret i32 686
}

LLVM IR (-O2):
define i32 @fun686() {
ret i32 686
}
void calc_load_nohz_stop(void) {}


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

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

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

LLVM IR (-O2):
define void @calc_load_nohz_stop() {
ret void
}
void gtk_drag_dest_find_target() {}


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

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

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

LLVM IR (-O2):
define void @gtk_drag_dest_find_target() {
ret void
}
int is_valid_port(unsigned int port) { return port > 0 && port < 0xffff; }


x86 assembly (clang, -O0):
<is_valid_port>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jbe    1123 <is_valid_port+0x23>
cmpl   $0xffff,-0x4(%rbp)
setb   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_valid_port>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0xfffe,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @is_valid_port(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ugt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp ult i32 %6, 65535
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @is_valid_port(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 65534
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int sgIP_Hub_IPMaxMessageSize(unsigned long);
int sgIP_IP_RequiredHeaderSize();
int sgIP_IP_MaxContentsSize(unsigned long destip) {
  return sgIP_Hub_IPMaxMessageSize(destip) - sgIP_IP_RequiredHeaderSize();
}


x86 assembly (clang, -O0):
<sgIP_IP_MaxContentsSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sgIP_Hub_IPMaxMessageSize@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <sgIP_IP_RequiredHeaderSize@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgIP_IP_MaxContentsSize>:
push   %rbx
call   1030 <sgIP_Hub_IPMaxMessageSize@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <sgIP_IP_RequiredHeaderSize@plt>
sub    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sgIP_IP_MaxContentsSize(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @sgIP_Hub_IPMaxMessageSize(i64 %3)
%5 = call i32 (...) @sgIP_IP_RequiredHeaderSize()
%6 = sub nsw i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @sgIP_IP_MaxContentsSize(i64 %0) {
%2 = tail call i32 @sgIP_Hub_IPMaxMessageSize(i64 %0)
%3 = tail call i32 (...) @sgIP_IP_RequiredHeaderSize()
%4 = sub nsw i32 %2, %3
ret i32 %4
}
/* Variables and functions */
int getchar();
int /*<<< orphan*/ putchar(int);
int main() {
  int c;
  while ((c = getchar()) != '\n')
    putchar(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xa,%eax
je     114f <main+0x2f>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
je     1145 <main+0x25>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    1130 <main+0x10>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = icmp eq i32 %1, 10
br i1 %2, label %8, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %6, %3 ], [ %1, %0 ]
%5 = tail call i32 @putchar(i32 %4)
%6 = tail call i32 (...) @getchar()
%7 = icmp eq i32 %6, 10
br i1 %7, label %8, label %3
8: ; preds = %3, %0
ret i32 0
}
void create_file(const char *path_name) { (void)path_name; }


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

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

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

LLVM IR (-O2):
define void @create_file(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, int *);
void console_ESC_B(char *esc_param) {
  int p[1];
  sscanf(esc_param, "%d", &p[0]);
}


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

x86 assembly (clang, -O2):
<console_ESC_B>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
pop    %rax
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @console_ESC_B(i8* nocapture %0) {
%2 = alloca [1 x i32]
%3 = bitcast [1 x i32]* %2 to i8*
%4 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%5 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
ret void
}
int __attribute__((no, noclone)) foo(unsigned long addr) {
  unsigned long *p = (unsigned long *)((addr & 0xffff83fffffffff8UL) * 4);
  unsigned long xxx = (unsigned long)(p + 1);
  return xxx >= 0x3c000000000UL;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movabs $0xffff83fffffffff8,%rax
83 ff ff
and    -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
movabs $0x3c000000000,%rax
cmp    %rax,-0x18(%rbp)
setae  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
shr    $0x24,%rdi
and    $0x3fff83f,%edi
xor    %eax,%eax
cmp    $0xf,%edi
setae  %al
ret

LLVM IR (-O0):
define i32 @foo(i64 %0) {
%2 = alloca i64
%3 = alloca i64*
%4 = alloca i64
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = and i64 %5, -136339441844232
%7 = mul i64 %6, 4
%8 = inttoptr i64 %7 to i64*
store i64* %8, i64** %3
%9 = load i64*, i64** %3
%10 = getelementptr inbounds i64, i64* %9, i64 1
%11 = ptrtoint i64* %10 to i64
store i64 %11, i64* %4
%12 = load i64, i64* %4
%13 = icmp uge i64 %12, 4123168604160
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @foo(i64 %0) {
%2 = shl i64 %0, 2
%3 = and i64 %2, -545357767376928
%4 = inttoptr i64 %3 to i64*
%5 = getelementptr inbounds i64, i64* %4, i64 1
%6 = icmp ugt i64* %5, inttoptr (i64 4123168604159 to i64*)
%7 = zext i1 %6 to i32
ret i32 %7
}
int test_imm_52int16_reg(short val) {
  return ((val) & (0x52 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_52int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0x52,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_52int16_reg>:
test   $0x52,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_52int16_reg(i16 signext %0) {
%2 = and i16 %0, 82
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct itimerspec {
  int dummy;
};

/* Variables and functions */
int syscall(int, int, struct itimerspec *);
int timerfd_gettime(int fd, struct itimerspec *cur) {
  return syscall(354, fd, cur);
}


x86 assembly (clang, -O0):
<timerfd_gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    $0x162,%edi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timerfd_gettime>:
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x162,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.itimerspec = type { i32 }
define i32 @timerfd_gettime(i32 %0, %struct.itimerspec* %1) {
%3 = alloca i32
%4 = alloca %struct.itimerspec*
store i32 %0, i32* %3
store %struct.itimerspec* %1, %struct.itimerspec** %4
%5 = load i32, i32* %3
%6 = load %struct.itimerspec*, %struct.itimerspec** %4
%7 = call i32 @syscall(i32 354, i32 %5, %struct.itimerspec* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.itimerspec = type { i32 }
define i32 @timerfd_gettime(i32 %0, %struct.itimerspec* %1) {
%3 = tail call i32 @syscall(i32 354, i32 %0, %struct.itimerspec* %1)
ret i32 %3
}
void foo299() {}


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

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

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

LLVM IR (-O2):
define void @foo299() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vfork();
int main(void) {
  vfork();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = call i32 @vfork()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ build_message_buffer(char *, void *, void *, void *);
void printf_to_message_buffer(char *format, void *arg1, void *arg2,
                              void *arg3) {
  build_message_buffer(format, arg1, arg2, arg3);
}


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

x86 assembly (clang, -O2):
<printf_to_message_buffer>:
jmp    1030 <build_message_buffer@plt>

LLVM IR (-O0):
define void @printf_to_message_buffer(i8* %0, i8* %1, i8* %2, i8* %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 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i8*, i8** %8
%13 = call i32 @build_message_buffer(i8* %9, i8* %10, i8* %11, i8* %12)
ret void
}

LLVM IR (-O2):
define void @printf_to_message_buffer(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @build_message_buffer(i8* %0, i8* %1, i8* %2, i8* %3)
ret void
}
/* Type definitions */
typedef unsigned int uint64_t;

/* Variables and functions */
uint64_t pcg_output_rxs_m_xs_64_64(uint64_t state) {
  uint64_t word =
      ((state >> ((state >> 59u) + 5u)) ^ state) * 12605985483714917081ull;
  return (word >> 43u) ^ word;
}


x86 assembly (clang, -O0):
<pcg_output_rxs_m_xs_64_64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%edx
mov    $0x3b,%ecx
shr    %cl,%edx
mov    %edx,%ecx
add    $0x5,%ecx
shr    %cl,%eax
xor    -0x4(%rbp),%eax
mov    %eax,%eax
movabs $0xaef17502108ef2d9,%rcx
75 f1 ae
imul   %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2b,%ecx
shr    %cl,%eax
xor    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @pcg_output_rxs_m_xs_64_64(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = lshr i32 %5, 59
%7 = add i32 %6, 5
%8 = lshr i32 %4, %7
%9 = load i32, i32* %2
%10 = xor i32 %8, %9
%11 = zext i32 %10 to i64
%12 = mul i64 %11, -5840758589994634535
%13 = trunc i64 %12 to i32
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = lshr i32 %14, 43
%16 = load i32, i32* %3
%17 = xor i32 %15, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @pcg_output_rxs_m_xs_64_64(i32 %0) {
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ stacktrace_pop();
double stacktrace_dpop(double val) {
  stacktrace_pop();
  return val;
}


x86 assembly (clang, -O0):
<stacktrace_dpop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <stacktrace_pop@plt>
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stacktrace_dpop>:
push   %rax
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <stacktrace_pop@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define double @stacktrace_dpop(double returned %0) {
%2 = tail call i32 (...) @stacktrace_pop()
ret double %0
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *, int *);
void read_header(int *num_pages, int *num_frames) {
  scanf("%d %d\n", num_pages, num_frames);
}


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

x86 assembly (clang, -O2):
<read_header>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <scanf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
define void @read_header(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 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define void @read_header(i32* %0, i32* %1) {
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %0, i32* %1)
ret void
}
/* Variables and functions */
char *strchr(char *, char);
char *replace_char(char *str, char find, char replace) {
  char *current_pos = strchr(str, find);
  while (current_pos) {
    *current_pos = replace;
    current_pos = strchr(current_pos, find);
  }
  return str;
}


x86 assembly (clang, -O0):
<replace_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1162 <replace_char+0x52>
mov    -0xa(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
jmp    1138 <replace_char+0x28>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace_char>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
call   1030 <strchr@plt>
test   %rax,%rax
je     1141 <replace_char+0x31>
movsbl %bpl,%ebp
nopl   0x0(%rax)
mov    %bl,(%rax)
mov    %rax,%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1130 <replace_char+0x20>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @replace_char(i8* returned %0, i8 signext %1, i8 signext %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %8, %6 ], [ %4, %3 ]
store i8 %2, i8* %7
%8 = tail call i8* @strchr(i8* %7, i8 signext %1)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %6
10: ; preds = %6, %3
ret i8* %0
}
double milesToCentimetres(double miles) { return miles * 160934; }


x86 assembly (clang, -O0):
<milesToCentimetres>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<milesToCentimetres>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @milesToCentimetres(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 1.609340e+05
ret double %4
}

LLVM IR (-O2):
define double @milesToCentimetres(double %0) {
%2 = fmul double %0, 1.609340e+05
ret double %2
}
/* Variables and functions */
int strverscmp(char *, char *);
int compare(const void *p1, const void *p2) {
  return strverscmp(*((char **)p1), *((char **)p2));
}


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

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strverscmp@plt>

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strverscmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strverscmp(i8* %4, i8* %6)
ret i32 %7
}
char *to_lower(char string[]) {
  int i = 0;
  do
    if (string[i] >= 'A' && string[i] <= 'Z')
      string[i] |= 0x60;
  while (string[i++] != '\0');
  return string;
}


x86 assembly (clang, -O0):
<to_lower>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x41,%eax
jl     114b <to_lower+0x4b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5a,%eax
jg     114b <to_lower+0x4b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
or     $0x60,%edx
mov    %dl,(%rax,%rcx,1)
jmp    1150 <to_lower+0x50>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    110f <to_lower+0xf>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_lower>:
mov    %rdi,%rax
mov    %rdi,%rcx
jmp    1118 <to_lower+0x18>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rcx
test   %dl,%dl
je     112d <to_lower+0x2d>
movzbl (%rcx),%edx
lea    -0x41(%rdx),%esi
cmp    $0x19,%sil
ja     1110 <to_lower+0x10>
or     $0x60,%dl
mov    %dl,(%rcx)
mov    $0x1,%dl
jmp    1110 <to_lower+0x10>
ret

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

LLVM IR (-O2):
define i8* @to_lower(i8* returned %0) {
br label %2
2: ; preds = %10, %1
%3 = phi i64 [ %12, %10 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = add i8 %5, -65
%7 = icmp ult i8 %6, 26
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = or i8 %5, 96
store i8 %9, i8* %4
br label %10
10: ; preds = %2, %8
%11 = phi i8 [ %5, %2 ], [ 1, %8 ]
%12 = add nuw i64 %3, 1
%13 = icmp eq i8 %11, 0
br i1 %13, label %14, label %2
14: ; preds = %10
ret i8* %0
}