xunge/DecIR huggingface dataset:
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ timeval_subtract(struct timeval *, struct timeval *,
                                    struct timeval *);
long diffMilli(struct timeval from, struct timeval to) {
  struct timeval diff;
  timeval_subtract(&diff, &to, &from);
  return (long)(diff.tv_sec * 1000 + diff.tv_usec / 1000);
}


x86 assembly (clang, -O0):
<diffMilli>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <timeval_subtract@plt>
imul   $0x3e8,-0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
cltq
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diffMilli>:
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1030 <timeval_subtract@plt>
movslq (%rsp),%rax
imul   $0x3e8,%rax,%rcx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
cltq
add    %rcx,%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i64 @diffMilli(i64 %0, i64 %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
%6 = bitcast %struct.timeval* %3 to i64*
store i64 %0, i64* %6
%7 = bitcast %struct.timeval* %4 to i64*
store i64 %1, i64* %7
%8 = call i32 @timeval_subtract(%struct.timeval* %5, %struct.timeval* %4, %struct.timeval* %3)
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, 1000
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%13 = load i32, i32* %12
%14 = sdiv i32 %13, 1000
%15 = add nsw i32 %11, %14
%16 = sext i32 %15 to i64
ret i64 %16
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i64 @diffMilli(i64 %0, i64 %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to %struct.timeval*
%5 = alloca i64
%6 = bitcast i64* %5 to %struct.timeval*
%7 = alloca %struct.timeval
store i64 %0, i64* %3
store i64 %1, i64* %5
%8 = bitcast %struct.timeval* %7 to i8*
%9 = call i32 @timeval_subtract(%struct.timeval* %7, %struct.timeval* %6, %struct.timeval* %4)
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 0
%11 = load i32, i32* %10
%12 = mul nsw i32 %11, 1000
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 1
%14 = load i32, i32* %13
%15 = sdiv i32 %14, 1000
%16 = add nsw i32 %15, %12
%17 = sext i32 %16 to i64
ret i64 %17
}
/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
void VM_getline(char *buf, int size) { fgets(buf, size, stdin); }


x86 assembly (clang, -O0):
<VM_getline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
call   1030 <fgets@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VM_getline>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edx
jmp    1030 <fgets@plt>

LLVM IR (-O0):
@stdin = global i32 0
define void @VM_getline(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %5, i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
define void @VM_getline(i8* %0, i32 %1) {
%3 = load i32, i32* @stdin
%4 = tail call i32 @fgets(i8* %0, i32 %1, i32 %3)
ret void
}
float flerp(float a, float b, float t) { return a + ((b - a) * t); }


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

x86 assembly (clang, -O2):
<flerp>:
subss  %xmm0,%xmm1
mulss  %xmm2,%xmm1
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @flerp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %4
%10 = fsub float %8, %9
%11 = load float, float* %6
%12 = call float @llvm.fmuladd.f32(float %10, float %11, float %7)
ret float %12
}

LLVM IR (-O2):
define float @flerp(float %0, float %1, float %2) {
%4 = fsub float %1, %0
%5 = tail call float @llvm.fmuladd.f32(float %4, float %2, float %0)
ret float %5
}
void insl(short port, void *buf, int size) {
  __asm__("rep insl" ::"D"(buf), "d"(port), "c"(size >> 2));
}


x86 assembly (clang, -O0):
<insl>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x2(%rbp),%dx
mov    -0x14(%rbp),%ecx
sar    $0x2,%ecx
rep insl (%dx),%es:(%rdi)
pop    %rbp
ret

x86 assembly (clang, -O2):
<insl>:
mov    %edx,%ecx
mov    %edi,%edx
sar    $0x2,%ecx
mov    %rsi,%rdi
rep insl (%dx),%es:(%rdi)
ret

LLVM IR (-O0):
define void @insl(i16 signext %0, i8* %1, i32 %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i32
store i16 %0, i16* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = load i16, i16* %4
%9 = load i32, i32* %6
%10 = ashr i32 %9, 2
ret void
}

LLVM IR (-O2):
define void @insl(i16 signext %0, i8* %1, i32 %2) {
%4 = ashr i32 %2, 2
tail call void asm sideeffect "rep insl", "{di},{dx},{cx},~{dirflag},~{fpsr},~{flags}"(i8* %1, i16 %0, i32 %4)
ret void
}
/* Type definitions */
struct ttfinfo {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void gsubContextSubTable(FILE *ttf, int which, int stoffset,
                         struct ttfinfo *info) {}


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

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

LLVM IR (-O0):
%struct.ttfinfo = type { i32 }
define void @gsubContextSubTable(i32* %0, i32 %1, i32 %2, %struct.ttfinfo* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.ttfinfo*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store %struct.ttfinfo* %3, %struct.ttfinfo** %8
ret void
}

LLVM IR (-O2):
%struct.ttfinfo = type { i32 }
define void @gsubContextSubTable(i32* nocapture %0, i32 %1, i32 %2, %struct.ttfinfo* nocapture %3) {
ret void
}
void swap_bwords(register unsigned char *p, int n) {
  register unsigned char c;
  n /= 2;
  for (; n > 0; n--, p += 2) {
    c = p[0];
    p[0] = p[1];
    p[1] = c;
  }
}


x86 assembly (clang, -O0):
<swap_bwords>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    115d <swap_bwords+0x5d>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xd(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
jmp    1119 <swap_bwords+0x19>
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_bwords>:
cmp    $0x2,%esi
jl     1120 <swap_bwords+0x20>
shr    %esi
add    $0x1,%esi
nopw   0x0(%rax,%rax,1)
rolw   $0x8,(%rdi)
add    $0xffffffff,%esi
add    $0x2,%rdi
cmp    $0x1,%esi
ja     1110 <swap_bwords+0x10>
ret

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

LLVM IR (-O2):
define void @swap_bwords(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = lshr i32 %1, 1
br label %6
6: ; preds = %4, %6
%7 = phi i8* [ %13, %6 ], [ %0, %4 ]
%8 = phi i32 [ %12, %6 ], [ %5, %4 ]
%9 = load i8, i8* %7
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %10
store i8 %11, i8* %7
store i8 %9, i8* %10
%12 = add nsw i32 %8, -1
%13 = getelementptr inbounds i8, i8* %7, i64 2
%14 = icmp ugt i32 %8, 1
br i1 %14, label %6, label %15
15: ; preds = %6, %2
ret void
}
/* Variables and functions */
int tunemu_write(int, char *, int);
int tun_write(int fd, char *buf, int len) { return tunemu_write(fd, buf, len); }


x86 assembly (clang, -O0):
<tun_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <tunemu_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tun_write>:
jmp    1030 <tunemu_write@plt>

LLVM IR (-O0):
define i32 @tun_write(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 @tunemu_write(i32 %7, i8* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @tun_write(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @tunemu_write(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ OutC(unsigned char);
void OutXByte(unsigned char byte) {
  unsigned char nibble;
  nibble = (byte >> 4);
  OutC(nibble + (nibble < 10 ? '0' : '7'));
  nibble = (byte & 0xf);
  OutC(nibble + (nibble < 10 ? '0' : '7'));
}


x86 assembly (clang, -O0):
<OutXByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
movzbl -0x2(%rbp),%esi
mov    $0x37,%ecx
mov    $0x30,%edx
cmp    $0xa,%esi
cmovl  %edx,%ecx
add    %ecx,%eax
movzbl %al,%edi
call   1030 <OutC@plt>
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
movzbl -0x2(%rbp),%esi
mov    $0x37,%ecx
mov    $0x30,%edx
cmp    $0xa,%esi
cmovl  %edx,%ecx
add    %ecx,%eax
movzbl %al,%edi
call   1030 <OutC@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OutXByte>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    %ebx,%eax
shr    $0x4,%al
cmp    $0xa0,%bl
mov    $0x30,%r14d
mov    $0x37,%ebp
mov    $0x37,%ecx
cmovb  %r14d,%ecx
add    %al,%cl
movzbl %cl,%edi
call   1030 <OutC@plt>
and    $0xf,%bl
cmp    $0xa,%bl
cmovb  %r14d,%ebp
add    %bl,%bpl
movzbl %bpl,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <OutC@plt>

LLVM IR (-O0):
define void @OutXByte(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = ashr i32 %5, 4
%7 = trunc i32 %6 to i8
store i8 %7, i8* %3
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = icmp slt i32 %11, 10
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 48, i32 55
%15 = add nsw i32 %9, %14
%16 = trunc i32 %15 to i8
%17 = call i32 @OutC(i8 zeroext %16)
%18 = load i8, i8* %2
%19 = zext i8 %18 to i32
%20 = and i32 %19, 15
%21 = trunc i32 %20 to i8
store i8 %21, i8* %3
%22 = load i8, i8* %3
%23 = zext i8 %22 to i32
%24 = load i8, i8* %3
%25 = zext i8 %24 to i32
%26 = icmp slt i32 %25, 10
%27 = zext i1 %26 to i64
%28 = select i1 %26, i32 48, i32 55
%29 = add nsw i32 %23, %28
%30 = trunc i32 %29 to i8
%31 = call i32 @OutC(i8 zeroext %30)
ret void
}

LLVM IR (-O2):
define void @OutXByte(i8 zeroext %0) {
%2 = lshr i8 %0, 4
%3 = icmp ult i8 %0, -96
%4 = select i1 %3, i8 48, i8 55
%5 = add nuw nsw i8 %4, %2
%6 = tail call i32 @OutC(i8 zeroext %5)
%7 = and i8 %0, 15
%8 = icmp ult i8 %7, 10
%9 = select i1 %8, i8 48, i8 55
%10 = add nuw nsw i8 %9, %7
%11 = tail call i32 @OutC(i8 zeroext %10)
ret void
}
callrts(sname) char *sname;
{
  debug_ol("; callrts");
  ot("jsr	rt_");
  outasm(sname);
  nl();
}


x86 assembly (clang, -O0):
<callrts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1060 <debug_ol@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1050 <ot@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <outasm@plt>
mov    $0x0,%al
call   1030 <nl@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callrts>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1060 <debug_ol@plt>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1050 <ot@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outasm@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <nl@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"; callrts\00"
@.str.1 = [8 x i8] c"jsr\09rt_\00"
define i32 @callrts(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @debug_ol to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @ot to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @outasm to i32 (i8*, ...)*)(i8* %6)
%8 = call i32 (...) @nl()
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
@.str = [10 x i8] c"; callrts\00"
@.str.1 = [8 x i8] c"jsr\09rt_\00"
define i32 @callrts(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @debug_ol to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @ot to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @outasm to i32 (i8*, ...)*)(i8* %0)
%5 = tail call i32 (...) @nl()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int __sapi_sock_set_optint(int, int /*<<< orphan*/, int /*<<< orphan*/);
int sapi_sock_set_reuseaddr(int sock) {
  return __sapi_sock_set_optint(sock, SOL_SOCKET, SO_REUSEADDR);
}


x86 assembly (clang, -O0):
<sapi_sock_set_reuseaddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
mov    0x2eaa(%rip),%rax
mov    (%rax),%edx
call   1030 <__sapi_sock_set_optint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sapi_sock_set_reuseaddr>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
mov    0x2eb8(%rip),%rax
mov    (%rax),%edx
jmp    1030 <__sapi_sock_set_optint@plt>

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @sapi_sock_set_reuseaddr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SOL_SOCKET
%5 = load i32, i32* @SO_REUSEADDR
%6 = call i32 @__sapi_sock_set_optint(i32 %3, i32 %4, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @sapi_sock_set_reuseaddr(i32 %0) {
%2 = load i32, i32* @SOL_SOCKET
%3 = load i32, i32* @SO_REUSEADDR
%4 = tail call i32 @__sapi_sock_set_optint(i32 %0, i32 %2, i32 %3)
ret i32 %4
}
unsigned int next_power_of_two(unsigned int v) {
  v--;
  v |= v >> 1;
  v |= v >> 2;
  v |= v >> 4;
  v |= v >> 8;
  v |= v >> 16;
  v++;
  v += (v == 0);
  return v;
}


x86 assembly (clang, -O0):
<next_power_of_two>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_power_of_two>:
lea    -0x1(%rdi),%eax
mov    %eax,%ecx
shr    %ecx
or     %eax,%ecx
mov    %ecx,%eax
shr    $0x2,%eax
or     %ecx,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
or     %eax,%ecx
mov    %ecx,%edx
shr    $0x8,%edx
or     %ecx,%edx
mov    %edx,%eax
shr    $0x10,%eax
or     %edx,%eax
add    $0x1,%eax
adc    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @next_power_of_two(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, -1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = lshr i32 %5, 1
%7 = load i32, i32* %2
%8 = or i32 %7, %6
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = lshr i32 %9, 2
%11 = load i32, i32* %2
%12 = or i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = lshr i32 %13, 4
%15 = load i32, i32* %2
%16 = or i32 %15, %14
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = lshr i32 %17, 8
%19 = load i32, i32* %2
%20 = or i32 %19, %18
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = lshr i32 %21, 16
%23 = load i32, i32* %2
%24 = or i32 %23, %22
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = add i32 %25, 1
store i32 %26, i32* %2
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 0
%29 = zext i1 %28 to i32
%30 = load i32, i32* %2
%31 = add i32 %30, %29
store i32 %31, i32* %2
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @next_power_of_two(i32 %0) {
%2 = add i32 %0, -1
%3 = lshr i32 %2, 1
%4 = or i32 %3, %2
%5 = lshr i32 %4, 2
%6 = or i32 %5, %4
%7 = lshr i32 %6, 4
%8 = or i32 %7, %6
%9 = lshr i32 %8, 8
%10 = or i32 %9, %8
%11 = lshr i32 %10, 16
%12 = or i32 %11, %10
%13 = add i32 %12, 1
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = add i32 %13, %15
ret i32 %16
}
/* Variables and functions */
scalar_t__ _U_Qfcmp(long double, long double, int);
int _U_Qfge(long double a, long double b) { return (_U_Qfcmp(a, b, 21) != 0); }


x86 assembly (clang, -O0):
<_U_Qfge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
mov    $0x15,%edi
call   1030 <_U_Qfcmp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_U_Qfge>:
sub    $0x28,%rsp
fldt   0x30(%rsp)
fldt   0x40(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
mov    $0x15,%edi
call   1030 <_U_Qfcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @_U_Qfge(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80, x86_fp80* %4
%7 = call i64 @_U_Qfcmp(x86_fp80 %5, x86_fp80 %6, i32 21)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @_U_Qfge(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call i64 @_U_Qfcmp(x86_fp80 %0, x86_fp80 %1, i32 21)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void usage(char *name) {
  printf("conf2db v0.1\n(C) 2014 Alexandru Naiman\nConvert GLaDOS 0.6.x "
         "configuration files to 0.7.0 database format\n\nUsage:\n\t%s -d "
         "<device file> -u <user file> -v <vcmd file> -o <output file>\n",
         name);
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [182 x i8] c"conf2db v0.1\0A(C) 2014 Alexandru Naiman\0AConvert GLaDOS 0.6.x configuration files to 0.7.0 database format\0A\0AUsage:\0A\09%s -d <device file> -u <user file> -v <vcmd file> -o <output file>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([182 x i8], [182 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [182 x i8] c"conf2db v0.1\0A(C) 2014 Alexandru Naiman\0AConvert GLaDOS 0.6.x configuration files to 0.7.0 database format\0A\0AUsage:\0A\09%s -d <device file> -u <user file> -v <vcmd file> -o <output file>\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([182 x i8], [182 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int echo();
int wrap_echo(void) { return echo(); }


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

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

LLVM IR (-O0):
define i32 @wrap_echo() {
%1 = call i32 (...) @echo()
ret i32 %1
}

LLVM IR (-O2):
define i32 @wrap_echo() {
%1 = tail call i32 (...) @echo()
ret i32 %1
}
/* Variables and functions */
long gcd(long, long);
long lcm(long x, long y) {
  long r;
  if (x == 0 || y == 0)
    return (0);
  r = x * y / gcd(x, y);
  return (r < 0 ? -r : r);
}


x86 assembly (clang, -O0):
<lcm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <lcm+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1143 <lcm+0x33>
movq   $0x0,-0x8(%rbp)
jmp    1197 <lcm+0x87>
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <gcd@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    1187 <lcm+0x77>
xor    %eax,%eax
sub    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    118f <lcm+0x7f>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm>:
test   %rdi,%rdi
je     113d <lcm+0x2d>
test   %rsi,%rsi
je     113d <lcm+0x2d>
push   %rbx
mov    %rsi,%rbx
imul   %rdi,%rbx
call   1030 <gcd@plt>
mov    %rax,%rcx
or     %rbx,%rax
shr    $0x20,%rax
je     1140 <lcm+0x30>
mov    %rbx,%rax
cqto
idiv   %rcx
jmp    1146 <lcm+0x36>
xor    %eax,%eax
ret
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
mov    %rax,%rcx
neg    %rcx
cmovs  %rax,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @lcm(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%7 = load i64, i64* %4
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i64, i64* %5
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9, %2
store i64 0, i64* %3
br label %30
13: ; preds = %9
%14 = load i64, i64* %4
%15 = load i64, i64* %5
%16 = mul nsw i64 %14, %15
%17 = load i64, i64* %4
%18 = load i64, i64* %5
%19 = call i64 @gcd(i64 %17, i64 %18)
%20 = sdiv i64 %16, %19
store i64 %20, i64* %6
%21 = load i64, i64* %6
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %13
%24 = load i64, i64* %6
%25 = sub nsw i64 0, %24
br label %28
26: ; preds = %13
%27 = load i64, i64* %6
br label %28
28: ; preds = %26, %23
%29 = phi i64 [ %25, %23 ], [ %27, %26 ]
store i64 %29, i64* %3
br label %30
30: ; preds = %28, %12
%31 = load i64, i64* %3
ret i64 %31
}

LLVM IR (-O2):
define i64 @lcm(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 0
%4 = icmp eq i64 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = mul nsw i64 %1, %0
%8 = tail call i64 @gcd(i64 %0, i64 %1)
%9 = sdiv i64 %7, %8
%10 = tail call i64 @llvm.abs.i64(i64 %9, i1 true)
br label %11
11: ; preds = %2, %6
%12 = phi i64 [ %10, %6 ], [ 0, %2 ]
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ test_failure();
bool _expect_true(bool condition, const char *message) {
  if (condition)
    return true;
  test_failure();
  printf(" \x1b[1;31mFAILED:\x1b[m %s\n", message);
  return false;
}


x86 assembly (clang, -O0):
<_expect_true>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1145 <_expect_true+0x25>
movl   $0x1,-0x4(%rbp)
jmp    1163 <_expect_true+0x43>
mov    $0x0,%al
call   1040 <test_failure@plt>
mov    -0x10(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_expect_true>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
test   %edi,%edi
jne    1148 <_expect_true+0x28>
mov    %rsi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <test_failure@plt>
lea    0xec0(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c" \1B[1;31mFAILED:\1B[m %s\0A\00"
define i32 @_expect_true(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 1, i32* %3
br label %13
9: ; preds = %2
%10 = call i32 (...) @test_failure()
%11 = load i8*, i8** %5
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %11)
store i32 0, i32* %3
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@.str = [23 x i8] c" \1B[1;31mFAILED:\1B[m %s\0A\00"
define i32 @_expect_true(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 (...) @test_failure()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %7
7: ; preds = %2, %4
%8 = phi i32 [ 0, %4 ], [ 1, %2 ]
ret i32 %8
}
/* Variables and functions */
int strlen(char *);
int /*<<< orphan*/ unGetch(char);
void ungets(char *s) {
  int length = strlen(s);
  while (length > 0) {
    unGetch(s[--length]);
  }
  return;
}


x86 assembly (clang, -O0):
<ungets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1160 <ungets+0x40>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <unGetch@plt>
jmp    1138 <ungets+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ungets>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    1157 <ungets+0x37>
mov    %eax,%ebx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
movsbl (%r14,%rax,1),%edi
call   1040 <unGetch@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1140 <ungets+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ungets(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
br label %6
6: ; preds = %9, %1
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i8*, i8** %2
%11 = load i32, i32* %3
%12 = add nsw i32 %11, -1
store i32 %12, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
%15 = load i8, i8* %14
%16 = call i32 @unGetch(i8 signext %15)
br label %6
17: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @ungets(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %14
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ %5, %4 ], [ %8, %6 ]
%8 = add nsw i64 %7, -1
%9 = and i64 %8, 4294967295
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = tail call i32 @unGetch(i8 signext %11)
%13 = icmp ugt i64 %7, 1
br i1 %13, label %6, label %14
14: ; preds = %6, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int /*<<< orphan*/, int);
main() {
  int i = 10;
  printf(" %d %d %d \n", ++i, i++, ++i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xb,%esi
mov    $0xb,%edx
mov    $0xd,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c" %d %d %d \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 11, i32 11, i32 13)
ret i32 0
}
unsigned dynmap_strhash(const char *s) {
  unsigned hash = 5381;
  for (; *s; s++)
    hash = ((hash << 5) + hash) + *s;
  return hash;
}


x86 assembly (clang, -O0):
<dynmap_strhash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1505,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <dynmap_strhash+0x42>
mov    -0xc(%rbp),%eax
shl    $0x5,%eax
add    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <dynmap_strhash+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dynmap_strhash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <dynmap_strhash+0x28>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %eax,%edx
shl    $0x5,%edx
add    %eax,%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <dynmap_strhash+0x10>
ret
mov    $0x1505,%eax
ret

LLVM IR (-O0):
define i32 @dynmap_strhash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 5381, i32* %3
br label %4
4: ; preds = %17, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %4
%9 = load i32, i32* %3
%10 = shl i32 %9, 5
%11 = load i32, i32* %3
%12 = add i32 %10, %11
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = add i32 %12, %15
store i32 %16, i32* %3
br label %17
17: ; preds = %8
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %2
br label %4
20: ; preds = %4
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @dynmap_strhash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 5381, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = mul i32 %6, 33
%9 = sext i8 %5 to i32
%10 = add i32 %8, %9
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 5381, %1 ], [ %10, %4 ]
ret i32 %15
}
void draw_2d_axes() {}


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

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

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

LLVM IR (-O2):
define void @draw_2d_axes() {
ret void
}
void etk_display_init() {}


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

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

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

LLVM IR (-O2):
define void @etk_display_init() {
ret void
}
void Quaternion_Conjugate(float *r, float *a) {
  r[0] = a[0];
  r[1] = -a[1];
  r[2] = -a[2];
  r[3] = -a[3];
}


x86 assembly (clang, -O0):
<Quaternion_Conjugate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Quaternion_Conjugate>:
movss  (%rsi),%xmm0
movss  %xmm0,(%rdi)
movss  0x4(%rsi),%xmm0
movaps 0xeec(%rip),%xmm1
xorps  %xmm1,%xmm0
movss  %xmm0,0x4(%rdi)
movss  0x8(%rsi),%xmm0
xorps  %xmm1,%xmm0
movss  %xmm0,0x8(%rdi)
movss  0xc(%rsi),%xmm0
xorps  %xmm1,%xmm0
movss  %xmm0,0xc(%rdi)
ret

LLVM IR (-O0):
define void @Quaternion_Conjugate(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %4
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %3
%9 = getelementptr inbounds float, float* %8, i64 0
store float %7, float* %9
%10 = load float*, float** %4
%11 = getelementptr inbounds float, float* %10, i64 1
%12 = load float, float* %11
%13 = fneg float %12
%14 = load float*, float** %3
%15 = getelementptr inbounds float, float* %14, i64 1
store float %13, float* %15
%16 = load float*, float** %4
%17 = getelementptr inbounds float, float* %16, i64 2
%18 = load float, float* %17
%19 = fneg float %18
%20 = load float*, float** %3
%21 = getelementptr inbounds float, float* %20, i64 2
store float %19, float* %21
%22 = load float*, float** %4
%23 = getelementptr inbounds float, float* %22, i64 3
%24 = load float, float* %23
%25 = fneg float %24
%26 = load float*, float** %3
%27 = getelementptr inbounds float, float* %26, i64 3
store float %25, float* %27
ret void
}

LLVM IR (-O2):
define void @Quaternion_Conjugate(float* nocapture writeonly %0, float* nocapture %1) {
%3 = load float, float* %1
store float %3, float* %0
%4 = getelementptr inbounds float, float* %1, i64 1
%5 = load float, float* %4
%6 = fneg float %5
%7 = getelementptr inbounds float, float* %0, i64 1
store float %6, float* %7
%8 = getelementptr inbounds float, float* %1, i64 2
%9 = load float, float* %8
%10 = fneg float %9
%11 = getelementptr inbounds float, float* %0, i64 2
store float %10, float* %11
%12 = getelementptr inbounds float, float* %1, i64 3
%13 = load float, float* %12
%14 = fneg float %13
%15 = getelementptr inbounds float, float* %0, i64 3
store float %14, float* %15
ret void
}
/* Variables and functions */
int is_power_of_2(unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  unsigned int x = 128;
  unsigned int y = 2;
  int q = is_power_of_2(x, y);
  if (q == 1) {
    printf("is_power_of_2(%d) = true \n", x);
  } else {
    printf("is_power_of_2(%d) = False \n", x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x80,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <is_power_of_2@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    1169 <main+0x49>
mov    -0x8(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
jmp    1178 <main+0x58>
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x80,%edi
mov    $0x2,%esi
call   1040 <is_power_of_2@plt>
cmp    $0x1,%eax
lea    0xec6(%rip),%rax
lea    0xeda(%rip),%rdi
cmove  %rax,%rdi
mov    $0x80,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [27 x i8] c"is_power_of_2(%d) = true \0A\00"
@.str.1 = [28 x i8] c"is_power_of_2(%d) = False \0A\00"
define i32 @main() {
%1 = tail call i32 @is_power_of_2(i32 128, i32 2)
%2 = icmp eq i32 %1, 1
%3 = select i1 %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* %3, i32 128)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ busopen();
void busopenP() { busopen(); }


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

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

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

LLVM IR (-O2):
define void @busopenP() {
%1 = tail call i32 (...) @busopen()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ GLuint;
typedef int /*<<< orphan*/ GLint;
typedef int /*<<< orphan*/ GLenum;

/* Variables and functions */
int /*<<< orphan*/ glStencilFunc(int /*<<< orphan*/, int /*<<< orphan*/,
                                 int /*<<< orphan*/);
void StencilFunc(GLenum func, GLint ref, GLuint mask) {
  glStencilFunc(func, ref, mask);
}


x86 assembly (clang, -O0):
<StencilFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <glStencilFunc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StencilFunc>:
jmp    1030 <glStencilFunc@plt>

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

LLVM IR (-O2):
define void @StencilFunc(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @glStencilFunc(i32 %0, i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("test_atomic_ops skipped\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"test_atomic_ops skipped\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [24 x i8] c"test_atomic_ops skipped\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int read_int(FILE *f) {
  int i;
  if (fscanf(f, "%d", &i) != 1) {
    fprintf(stderr, "read_int: error reading from file\n");
    perror("read_int");
  }
  return i;
}


x86 assembly (clang, -O0):
<read_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
je     117a <read_int+0x4a>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xeb1(%rip),%rdi
call   1050 <perror@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_int>:
push   %rax
lea    0xec8(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
jne    114d <read_int+0x1d>
mov    0x4(%rsp),%eax
pop    %rcx
ret
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xebd(%rip),%rdi
call   1050 <perror@plt>
jmp    1147 <read_int+0x17>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.1 = [35 x i8] c"read_int: error reading from file\0A\00"
@.str.2 = [9 x i8] c"read_int\00"
define i32 @read_int(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = icmp ne i32 %5, 1
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %7, %1
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.1 = [35 x i8] c"read_int: error reading from file\0A\00"
@.str.2 = [9 x i8] c"read_int\00"
define i32 @read_int(i32* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = icmp eq i32 %4, 1
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %6, %1
%11 = load i32, i32* %2
ret i32 %11
}
void STEAM_Shutdown(void) {}


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

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

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

LLVM IR (-O2):
define void @STEAM_Shutdown() {
ret void
}
/* Variables and functions */
int __builtin_HEXAGON_S6_rol_i_r(unsigned int, int);
unsigned builtin_needs_v60(unsigned Rs) {
  return __builtin_HEXAGON_S6_rol_i_r(Rs, 3);
}


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

x86 assembly (clang, -O2):
<builtin_needs_v60>:
mov    $0x3,%esi
jmp    1030 <__builtin_HEXAGON_S6_rol_i_r@plt>

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

LLVM IR (-O2):
define i32 @builtin_needs_v60(i32 %0) {
%2 = tail call i32 @__builtin_HEXAGON_S6_rol_i_r(i32 %0, i32 3)
ret i32 %2
}
int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *pdev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.pci_dev = type opaque
define i32 @pci_cleanup_aer_uncorrect_error_status(%struct.pci_dev* nocapture readnone %0) {
ret i32 0
}
char bin2hex(unsigned char b) { return (b > 9) ? ((b - 10) + 'A') : (b + '0'); }


x86 assembly (clang, -O0):
<bin2hex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x9,%eax
jle    1129 <bin2hex+0x29>
movzbl -0x1(%rbp),%eax
sub    $0xa,%eax
add    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <bin2hex+0x33>
movzbl -0x1(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin2hex>:
cmp    $0xa,%dil
mov    $0x37,%ecx
mov    $0x30,%eax
cmovae %ecx,%eax
add    %dil,%al
ret

LLVM IR (-O0):
define signext i8 @bin2hex(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp sgt i32 %4, 9
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = sub nsw i32 %8, 10
%10 = add nsw i32 %9, 65
br label %15
11: ; preds = %1
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = add nsw i32 %13, 48
br label %15
15: ; preds = %11, %6
%16 = phi i32 [ %10, %6 ], [ %14, %11 ]
%17 = trunc i32 %16 to i8
ret i8 %17
}

LLVM IR (-O2):
define signext i8 @bin2hex(i8 zeroext %0) {
%2 = icmp ugt i8 %0, 9
%3 = select i1 %2, i8 55, i8 48
%4 = add i8 %3, %0
ret i8 %4
}
void f(void) { char buf[4] = {0, 1, 2, 3}; }


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

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

LLVM IR (-O0):
@__const.f.buf = [4 x i8] c"\00\01\02\03"
define void @f() {
%1 = alloca [4 x i8]
%2 = bitcast [4 x i8]* %1 to i8*
ret void
}

LLVM IR (-O2):
define void @f() {
ret void
}
/* Variables and functions */
scalar_t__ readchr();
void kb_flushinp() {
  while (readchr())
    ;
}


x86 assembly (clang, -O0):
<kb_flushinp>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <kb_flushinp+0x9>
mov    $0x0,%al
call   1030 <readchr@plt>
cmp    $0x0,%rax
je     112f <kb_flushinp+0x1f>
jmp    1119 <kb_flushinp+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kb_flushinp>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <readchr@plt>
test   %rax,%rax
jne    1120 <kb_flushinp+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @kb_flushinp() {
br label %1
1: ; preds = %4, %0
%2 = call i64 (...) @readchr()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1
br label %1
5: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @kb_flushinp() {
br label %1
1: ; preds = %1, %0
%2 = tail call i64 (...) @readchr()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %1
4: ; preds = %1
ret void
}