xunge/DecIR huggingface dataset:
int add1(int a, int b) { return a + b; }


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

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

LLVM IR (-O0):
define i32 @add1(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @add1(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int GCD(int, int);
int LCM(int a, int b) { return a / GCD(a, b) * b; }


x86 assembly (clang, -O0):
<LCM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <GCD@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
imul   -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCM>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <GCD@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
imul   %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @LCM(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* %3
%7 = load i32, i32* %4
%8 = call i32 @GCD(i32 %6, i32 %7)
%9 = sdiv i32 %5, %8
%10 = load i32, i32* %4
%11 = mul nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @LCM(i32 %0, i32 %1) {
%3 = tail call i32 @GCD(i32 %0, i32 %1)
%4 = sdiv i32 %0, %3
%5 = mul nsw i32 %4, %1
ret i32 %5
}
void av_format_get_control_message_cb() {}


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

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

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

LLVM IR (-O2):
define void @av_format_get_control_message_cb() {
ret void
}
/* Type definitions */
typedef size_t uint32_t;

/* Variables and functions */
void init_zero(uint32_t t, uint32_t *A) {
  uint32_t i;
  for (i = 0; i < t; i++) {
    A[i] = 0;
  }
}


x86 assembly (clang, -O0):
<init_zero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1143 <init_zero+0x43>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <init_zero+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_zero>:
test   %rdi,%rdi
je     112b <init_zero+0x1b>
push   %rax
mov    %rdi,%rdx
shl    $0x3,%rdx
mov    %rsi,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @init_zero(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64*
%5 = alloca i64
store i64 %0, i64* %3
store i64* %1, i64** %4
store i64 0, i64* %5
br label %6
6: ; preds = %14, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %3
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i64*, i64** %4
%12 = load i64, i64* %5
%13 = getelementptr inbounds i64, i64* %11, i64 %12
store i64 0, i64* %13
br label %14
14: ; preds = %10
%15 = load i64, i64* %5
%16 = add i64 %15, 1
store i64 %16, i64* %5
br label %6
17: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @init_zero(i64 %0, i64* nocapture writeonly %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = bitcast i64* %1 to i8*
%6 = shl nuw i64 %0, 3
br label %7
7: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int readSInt8(int /*<<< orphan*/ *);
int readUInt8(int /*<<< orphan*/ *);
int readSInt16(FILE *f) { return readUInt8(f) + readSInt8(f) * 256; }


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

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

LLVM IR (-O0):
define i32 @readSInt16(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @readUInt8(i32* %3)
%5 = load i32*, i32** %2
%6 = call i32 @readSInt8(i32* %5)
%7 = mul nsw i32 %6, 256
%8 = add nsw i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @readSInt16(i32* %0) {
%2 = tail call i32 @readUInt8(i32* %0)
%3 = tail call i32 @readSInt8(i32* %0)
%4 = shl nsw i32 %3, 8
%5 = add nsw i32 %4, %2
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ opt;

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char const *,
                      int);
int os_set_reuseaddr(int fd) {
  unsigned int opt = 1;
  return (0 == setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt,
                          sizeof(opt)));
}


x86 assembly (clang, -O0):
<os_set_reuseaddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_set_reuseaddr>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @os_set_reuseaddr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @SOL_SOCKET
%6 = load i32, i32* @SO_REUSEADDR
%7 = bitcast i32* %3 to i8*
%8 = call i64 @setsockopt(i32 %4, i32 %5, i32 %6, i8* %7, i32 4)
%9 = icmp eq i64 0, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @os_set_reuseaddr(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @SOL_SOCKET
%5 = load i32, i32* @SO_REUSEADDR
%6 = call i64 @setsockopt(i32 %0, i32 %4, i32 %5, i8* %3, i32 4)
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}
float *vec3_subtract(float *result, float *a, float *b) {
  result[0] = a[0] - b[0];
  result[1] = a[1] - b[1];
  result[2] = a[2] - b[2];
  return result;
}


x86 assembly (clang, -O0):
<vec3_subtract>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
subss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x18(%rbp),%rax
subss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
subss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3_subtract>:
mov    %rdi,%rax
movss  (%rsi),%xmm0
subss  (%rdx),%xmm0
movss  %xmm0,(%rdi)
movss  0x4(%rsi),%xmm0
subss  0x4(%rdx),%xmm0
movss  %xmm0,0x4(%rdi)
movss  0x8(%rsi),%xmm0
subss  0x8(%rdx),%xmm0
movss  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
define float* @vec3_subtract(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** %5
%8 = getelementptr inbounds float, float* %7, i64 0
%9 = load float, float* %8
%10 = load float*, float** %6
%11 = getelementptr inbounds float, float* %10, i64 0
%12 = load float, float* %11
%13 = fsub float %9, %12
%14 = load float*, float** %4
%15 = getelementptr inbounds float, float* %14, i64 0
store float %13, float* %15
%16 = load float*, float** %5
%17 = getelementptr inbounds float, float* %16, i64 1
%18 = load float, float* %17
%19 = load float*, float** %6
%20 = getelementptr inbounds float, float* %19, i64 1
%21 = load float, float* %20
%22 = fsub float %18, %21
%23 = load float*, float** %4
%24 = getelementptr inbounds float, float* %23, i64 1
store float %22, float* %24
%25 = load float*, float** %5
%26 = getelementptr inbounds float, float* %25, i64 2
%27 = load float, float* %26
%28 = load float*, float** %6
%29 = getelementptr inbounds float, float* %28, i64 2
%30 = load float, float* %29
%31 = fsub float %27, %30
%32 = load float*, float** %4
%33 = getelementptr inbounds float, float* %32, i64 2
store float %31, float* %33
%34 = load float*, float** %4
ret float* %34
}

LLVM IR (-O2):
define float* @vec3_subtract(float* returned writeonly %0, float* nocapture %1, float* nocapture %2) {
%4 = load float, float* %1
%5 = load float, float* %2
%6 = fsub float %4, %5
store float %6, float* %0
%7 = getelementptr inbounds float, float* %1, i64 1
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %2, i64 1
%10 = load float, float* %9
%11 = fsub float %8, %10
%12 = getelementptr inbounds float, float* %0, i64 1
store float %11, float* %12
%13 = getelementptr inbounds float, float* %1, i64 2
%14 = load float, float* %13
%15 = getelementptr inbounds float, float* %2, i64 2
%16 = load float, float* %15
%17 = fsub float %14, %16
%18 = getelementptr inbounds float, float* %0, i64 2
store float %17, float* %18
ret float* %0
}
int myStrcmpII(char *s1, char *s2) {
  while (*s1 == *s2) {
    if (*s1) {
      return (0);
    } else {
      s1++;
      s2++;
    }
  }
  return (*s1 - *s2);
}


x86 assembly (clang, -O0):
<myStrcmpII>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1158 <myStrcmpII+0x58>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     113b <myStrcmpII+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    116b <myStrcmpII+0x6b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <myStrcmpII+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myStrcmpII>:
mov    (%rdi),%al
mov    (%rsi),%dl
cmp    %dl,%al
jne    1124 <myStrcmpII+0x24>
mov    $0x1,%ecx
nopl   (%rax)
test   %al,%al
jne    112d <myStrcmpII+0x2d>
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%edx
add    $0x1,%rcx
cmp    %dl,%al
je     1110 <myStrcmpII+0x10>
movsbl %dl,%ecx
movsbl %al,%eax
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @myStrcmpII(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %3, %4
br i1 %5, label %6, label %17
6: ; preds = %2, %11
%7 = phi i8 [ %14, %11 ], [ %3, %2 ]
%8 = phi i8* [ %13, %11 ], [ %1, %2 ]
%9 = phi i8* [ %12, %11 ], [ %0, %2 ]
%10 = icmp eq i8 %7, 0
br i1 %10, label %11, label %23
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %12
%15 = load i8, i8* %13
%16 = icmp eq i8 %14, %15
br i1 %16, label %6, label %17
17: ; preds = %11, %2
%18 = phi i8 [ %3, %2 ], [ %14, %11 ]
%19 = phi i8 [ %4, %2 ], [ %15, %11 ]
%20 = sext i8 %19 to i32
%21 = sext i8 %18 to i32
%22 = sub nsw i32 %21, %20
br label %23
23: ; preds = %6, %17
%24 = phi i32 [ %22, %17 ], [ 0, %6 ]
ret i32 %24
}
void Float32_To_UInt8_Dither(
    void *destinationBuffer, signed int destinationStride, void *sourceBuffer,
    signed int sourceStride, unsigned int count,
    struct PaUtilTriangularDitherGenerator *ditherGenerator) {
  float *src = (float *)sourceBuffer;
  unsigned char *dest = (unsigned char *)destinationBuffer;
  (void)ditherGenerator;
  while (count--) {
    src += sourceStride;
    dest += destinationStride;
  }
}


x86 assembly (clang, -O0):
<Float32_To_UInt8_Dither>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x20(%rbp)
cmp    $0x0,%eax
je     1169 <Float32_To_UInt8_Dither+0x69>
mov    -0x1c(%rbp),%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
jmp    112a <Float32_To_UInt8_Dither+0x2a>
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.PaUtilTriangularDitherGenerator = type opaque
define void @Float32_To_UInt8_Dither(i8* nocapture %0, i32 %1, i8* nocapture %2, i32 %3, i32 %4, %struct.PaUtilTriangularDitherGenerator* nocapture %5) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_MAKE_ONE_WIRE_INPUT() { clear_io_bit(0x72, 5); }


x86 assembly (clang, -O0):
<TOSH_MAKE_ONE_WIRE_INPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0x72,%edi
mov    $0x5,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_ONE_WIRE_INPUT>:
mov    $0x72,%edi
mov    $0x5,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_ONE_WIRE_INPUT() {
%1 = call i32 @clear_io_bit(i32 114, i32 5)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_ONE_WIRE_INPUT() {
%1 = tail call i32 @clear_io_bit(i32 114, i32 5)
ret void
}
void clearTempStringsToNull(char *str) {
  for (int index = 0; str[index]; index++) {
    str[index] = 0;
  }
}


x86 assembly (clang, -O0):
<clearTempStringsToNull>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     113b <clearTempStringsToNull+0x3b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <clearTempStringsToNull+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearTempStringsToNull>:
cmpb   $0x0,(%rdi)
je     111d <clearTempStringsToNull+0x1d>
add    $0x1,%rdi
nopl   0x0(%rax)
movb   $0x0,-0x1(%rdi)
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <clearTempStringsToNull+0x10>
ret

LLVM IR (-O0):
define void @clearTempStringsToNull(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %16, %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 = icmp ne i8 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %4
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
store i8 0, i8* %15
br label %16
16: ; preds = %11
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %4
19: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @clearTempStringsToNull(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %1
ret void
5: ; preds = %1, %5
%6 = phi i64 [ %8, %5 ], [ 0, %1 ]
%7 = phi i8* [ %9, %5 ], [ %0, %1 ]
store i8 0, i8* %7
%8 = add nuw nsw i64 %6, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %4, label %5
}
int align4(int size) {
  if (size % 4 == 0)
    return 0;
  return (4 - size % 4);
}


x86 assembly (clang, -O0):
<align4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1127 <align4+0x27>
movl   $0x0,-0x4(%rbp)
jmp    113c <align4+0x3c>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    $0x4,%eax
sub    %edx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align4>:
lea    0x3(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
and    $0xfffffffc,%eax
sub    %eax,%edi
mov    $0x4,%eax
sub    %edi,%eax
test   %edi,%edi
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @align4(i32 %0) {
%2 = srem i32 %0, 4
%3 = icmp eq i32 %2, 0
%4 = sub nsw i32 4, %2
%5 = select i1 %3, i32 0, i32 %4
ret i32 %5
}
int test_imm_42int16_reg(short val) {
  return ((val) & (0x42 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_42int16_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, 66
%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_42int16_reg(i16 signext %0) {
%2 = and i16 %0, 66
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ MdmIFlush();
void k_flush() { MdmIFlush(); }


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

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

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

LLVM IR (-O2):
define void @k_flush() {
%1 = tail call i32 (...) @MdmIFlush()
ret void
}
char const *bool_name(int value) { return value ? "true" : "false"; }


x86 assembly (clang, -O0):
<bool_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xef4(%rip),%rax
lea    0xee8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bool_name>:
test   %edi,%edi
lea    0xefc(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define i8* @bool_name(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define i8* @bool_name(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
char *memmove(char *, char *, int);
void memmove0() {
  char src[] = {1, 2, 3, 4};
  char dst[4] = {0};
  memmove(dst, src, 4);
  if (memmove(dst, src, 4) != dst) {
    (void)*(char *)0;
  }
  if (dst[0] != 0)
    (void)*(char *)0;
}


x86 assembly (clang, -O0):
<memmove0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
lea    -0x8(%rbp),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memmove@plt>
lea    -0x8(%rbp),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memmove@plt>
lea    -0x8(%rbp),%rcx
cmp    %rcx,%rax
je     1172 <memmove0+0x52>
movsbl -0x8(%rbp),%eax
cmp    $0x0,%eax
je     117f <memmove0+0x5f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memmove0>:
push   %r14
push   %rbx
push   %rax
movl   $0x4030201,0x4(%rsp)
04
movl   $0x0,(%rsp)
mov    %rsp,%rbx
lea    0x4(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <memmove@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <memmove@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.memmove0.src = [4 x i8] c"\01\02\03\04"
define void @memmove0() {
%1 = alloca [4 x i8]
%2 = alloca [4 x i8]
%3 = bitcast [4 x i8]* %1 to i8*
%4 = bitcast [4 x i8]* %2 to i8*
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%7 = call i8* @memmove(i8* %5, i8* %6, i32 4)
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%10 = call i8* @memmove(i8* %8, i8* %9, i32 4)
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%12 = icmp ne i8* %10, %11
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = load i8, i8* null
br label %15
15: ; preds = %13, %0
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = load i8, i8* null
br label %22
22: ; preds = %20, %15
ret void
}

LLVM IR (-O2):
define void @memmove0() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 67305985, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i8* @memmove(i8* %4, i8* %3, i32 4)
%6 = call i8* @memmove(i8* %4, i8* %3, i32 4)
ret void
}
long int _hashmap_hash(const char *key) {
  long int hash_value;
  for (hash_value = 0; *key; key++)
    hash_value = *key + (hash_value << 6) + (hash_value << 16) - hash_value;
  return (hash_value);
}


x86 assembly (clang, -O0):
<_hashmap_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1154 <_hashmap_hash+0x54>
mov    -0x8(%rbp),%rax
movsbq (%rax),%rax
mov    -0x10(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
shl    $0x10,%rcx
add    %rcx,%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <_hashmap_hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_hashmap_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112a <_hashmap_hash+0x2a>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbq %cl,%rcx
imul   $0x1003f,%rax,%rax
add    %rcx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <_hashmap_hash+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @_hashmap_hash(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 i64 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i64
%9 = mul i64 %6, 65599
%10 = add i64 %9, %8
%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 i64 [ 0, %1 ], [ %10, %4 ]
ret i64 %15
}
double minver_fabs(double n) {
  double f;
  if (n >= 0)
    f = n;
  else
    f = -n;
  return f;
}


x86 assembly (clang, -O0):
<minver_fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     112a <minver_fabs+0x2a>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    114b <minver_fabs+0x4b>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<minver_fabs>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm1,%xmm1
cmpnlesd %xmm0,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @minver_fabs(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load double, double* %2
store double %7, double* %3
br label %11
8: ; preds = %1
%9 = load double, double* %2
%10 = fneg double %9
store double %10, double* %3
br label %11
11: ; preds = %8, %6
%12 = load double, double* %3
ret double %12
}

LLVM IR (-O2):
define double @minver_fabs(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}
int child(int nodeidx) { return 2 * nodeidx + 1; }


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

x86 assembly (clang, -O2):
<child>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @child(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
/* Variables and functions */
#define ARPHRD_ARCNET 137
#define ARPHRD_ETHER 136
#define ARPHRD_FDDI 135
#define ARPHRD_IEEE802 134
#define ARPHRD_IEEE80211 133
#define ARPHRD_IEEE802_TR 132
#define ARPHRD_IPGRE 131
#define ARPHRD_PPP 130
#define ARPHRD_SIT 129
#define ARPHRD_TUNNEL6 128
short nd_get_l2addr_len(unsigned short iface_type) {
  switch (iface_type) {
  case ARPHRD_ETHER:
  case ARPHRD_IEEE802:
  case ARPHRD_IEEE802_TR:
  case ARPHRD_IEEE80211:
  case ARPHRD_FDDI:
    return 6;
  case ARPHRD_ARCNET:
    return 1;
  case ARPHRD_SIT:
  case ARPHRD_TUNNEL6:
  case ARPHRD_PPP:
  case ARPHRD_IPGRE:
    return 0;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<nd_get_l2addr_len>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
add    $0xffffff80,%eax
sub    $0x4,%eax
jb     1162 <nd_get_l2addr_len+0x62>
jmp    1123 <nd_get_l2addr_len+0x23>
mov    -0x8(%rbp),%eax
add    $0xffffff7c,%eax
sub    $0x5,%eax
jb     114c <nd_get_l2addr_len+0x4c>
jmp    1139 <nd_get_l2addr_len+0x39>
mov    -0x8(%rbp),%eax
sub    $0x89,%eax
je     1157 <nd_get_l2addr_len+0x57>
jmp    116d <nd_get_l2addr_len+0x6d>
movw   $0x6,-0x2(%rbp)
jmp    1173 <nd_get_l2addr_len+0x73>
movw   $0x1,-0x2(%rbp)
jmp    1173 <nd_get_l2addr_len+0x73>
movw   $0x0,-0x2(%rbp)
jmp    1173 <nd_get_l2addr_len+0x73>
movw   $0xffff,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nd_get_l2addr_len>:
add    $0xffffff80,%edi
mov    $0xffff,%ax
cmp    $0x9,%di
ja     111c <nd_get_l2addr_len+0x1c>
movswq %di,%rax
lea    0xee8(%rip),%rcx
movzwl (%rcx,%rax,2),%eax
ret

LLVM IR (-O0):
define signext i16 @nd_get_l2addr_len(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %3
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
switch i32 %5, label %9 [
i32 136, label %6
i32 134, label %6
i32 132, label %6
i32 133, label %6
i32 135, label %6
i32 137, label %7
i32 129, label %8
i32 128, label %8
i32 130, label %8
i32 131, label %8
]
6: ; preds = %1, %1, %1, %1, %1
store i16 6, i16* %2
br label %10
7: ; preds = %1
store i16 1, i16* %2
br label %10
8: ; preds = %1, %1, %1, %1
store i16 0, i16* %2
br label %10
9: ; preds = %1
store i16 -1, i16* %2
br label %10
10: ; preds = %9, %8, %7, %6
%11 = load i16, i16* %2
ret i16 %11
}

LLVM IR (-O2):
@switch.table.nd_get_l2addr_len = [10 x i16] [i16 0, i16 0, i16 0, i16 0, i16 6, i16 6, i16 6, i16 6, i16 6, i16 1]
define signext i16 @nd_get_l2addr_len(i16 zeroext %0) {
%2 = add i16 %0, -128
%3 = icmp ult i16 %2, 10
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i16 %2 to i64
%6 = getelementptr inbounds [10 x i16], [10 x i16]* @switch.table.nd_get_l2addr_len, i64 0, i64 %5
%7 = load i16, i16* %6
br label %8
8: ; preds = %1, %4
%9 = phi i16 [ %7, %4 ], [ -1, %1 ]
ret i16 %9
}
double hilo2dbl(unsigned long high, unsigned long low) {
  return (double)high * 4294967296.0 + (double)low;
}


x86 assembly (clang, -O0):
<hilo2dbl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movaps 0xefd(%rip),%xmm3
movq   -0x8(%rbp),%xmm0
punpckldq %xmm3,%xmm0
movapd 0xefc(%rip),%xmm2
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movq   -0x10(%rbp),%xmm1
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  0xead(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<hilo2dbl>:
movq   %rdi,%xmm1
movdqa 0xef3(%rip),%xmm2
punpckldq %xmm2,%xmm1
movapd 0xef7(%rip),%xmm3
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movq   %rsi,%xmm1
punpckldq %xmm2,%xmm1
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
mulsd  0xed6(%rip),%xmm0
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @hilo2dbl(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = uitofp i64 %5 to double
%7 = load i64, i64* %4
%8 = uitofp i64 %7 to double
%9 = call double @llvm.fmuladd.f64(double %6, double 0x41F0000000000000, double %8)
ret double %9
}

LLVM IR (-O2):
define double @hilo2dbl(i64 %0, i64 %1) {
%3 = uitofp i64 %0 to double
%4 = uitofp i64 %1 to double
%5 = tail call double @llvm.fmuladd.f64(double %3, double 0x41F0000000000000, double %4)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void console_line_overflow(int overflow) {
  putchar(0x1b);
  if (overflow) {
    putchar('v');
  } else {
    putchar('w');
  }
}


x86 assembly (clang, -O0):
<console_line_overflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1b,%edi
call   1030 <putchar@plt>
cmpl   $0x0,-0x4(%rbp)
je     113e <console_line_overflow+0x2e>
mov    $0x76,%edi
call   1030 <putchar@plt>
jmp    1148 <console_line_overflow+0x38>
mov    $0x77,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_line_overflow>:
push   %rbx
mov    %edi,%ebx
mov    $0x1b,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
test   %ebx,%ebx
sete   %dil
or     $0x76,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @console_line_overflow(i32 %0) {
%2 = tail call i32 @putchar(i8 signext 27)
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i8 119, i8 118
%5 = tail call i32 @putchar(i8 signext %4)
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t rev_short(uint16_t val) {
  return ((val & 0xff) << 8) | ((val >> 8) & 0xff);
}


x86 assembly (clang, -O0):
<rev_short>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev_short>:
rol    $0x8,%di
movzwl %di,%eax
ret

LLVM IR (-O0):
define i32 @rev_short(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 8
%6 = load i32, i32* %2
%7 = ashr i32 %6, 8
%8 = and i32 %7, 255
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @rev_short(i32 %0) {
%2 = trunc i32 %0 to i16
%3 = tail call i16 @llvm.bswap.i16(i16 %2)
%4 = zext i16 %3 to i32
ret i32 %4
}
void wrtintz(n) int n;
{}


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

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

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

LLVM IR (-O2):
define void @wrtintz(i32 %0) {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  uint16_t x = 0x00AB;
  uint8_t *p = (uint8_t *)&x;
  if (0xAB == *p)
    printf("Little Endian\n");
  else
    printf("Big Endian\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xab,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    $0xab,%eax
cmp    (%rcx),%eax
jne    1150 <main+0x40>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
jmp    115c <main+0x4c>
lea    0xeb8(%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 = [15 x i8] c"Little Endian\0A\00"
@.str.1 = [12 x i8] c"Big Endian\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
store i32 171, i32* %2
store i32* %2, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = icmp eq i32 171, %5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
ret i32 0
}

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

/* Variables and functions */
int /*<<< orphan*/ _wall_Sleep(int /*<<< orphan*/, int);
void wall_Sleep(uint64_t i_delay) { _wall_Sleep(i_delay, false); }


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

x86 assembly (clang, -O2):
<wall_Sleep>:
xor    %esi,%esi
jmp    1030 <_wall_Sleep@plt>

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

LLVM IR (-O2):
define void @wall_Sleep(i32 %0) {
%2 = tail call i32 @_wall_Sleep(i32 %0, i32 0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int rand_uint32();
uint32_t rand_uint32_mod(uint32_t mod) {
  uint32_t rmod, rnd;
  if (!mod)
    return rand_uint32();
  rmod = ((-mod) / mod + 1) * mod;
  do {
    rnd = rand_uint32();
  } while (rmod && rnd >= rmod);
  return rnd % mod;
}


x86 assembly (clang, -O0):
<rand_uint32_mod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1134 <rand_uint32_mod+0x24>
mov    $0x0,%al
call   1030 <rand_uint32@plt>
mov    %eax,-0x4(%rbp)
jmp    1181 <rand_uint32_mod+0x71>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
cltd
idivl  -0x8(%rbp)
add    $0x1,%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand_uint32@plt>
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     116c <rand_uint32_mod+0x5c>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
setge  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <rand_uint32_mod+0x37>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_uint32_mod>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand_uint32@plt>
test   %ebx,%ebx
je     1123 <rand_uint32_mod+0x13>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rand_uint32_mod(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 (...) @rand_uint32()
store i32 %9, i32* %2
br label %33
10: ; preds = %1
%11 = load i32, i32* %3
%12 = sub nsw i32 0, %11
%13 = load i32, i32* %3
%14 = sdiv i32 %12, %13
%15 = add nsw i32 %14, 1
%16 = load i32, i32* %3
%17 = mul nsw i32 %15, %16
store i32 %17, i32* %4
br label %18
18: ; preds = %27, %10
%19 = call i32 (...) @rand_uint32()
store i32 %19, i32* %5
br label %20
20: ; preds = %18
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32, i32* %5
%25 = load i32, i32* %4
%26 = icmp sge i32 %24, %25
br label %27
27: ; preds = %23, %20
%28 = phi i1 [ false, %20 ], [ %26, %23 ]
br i1 %28, label %18, label %29
29: ; preds = %27
%30 = load i32, i32* %5
%31 = load i32, i32* %3
%32 = srem i32 %30, %31
store i32 %32, i32* %2
br label %33
33: ; preds = %29, %8
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @rand_uint32_mod(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = tail call i32 (...) @rand_uint32()
br i1 %2, label %6, label %4
4: ; preds = %1
%5 = srem i32 %3, %0
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %3, %1 ]
ret i32 %7
}
int digitalPinToInterrupt(int pin) { return pin; }


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

x86 assembly (clang, -O2):
<digitalPinToInterrupt>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @digitalPinToInterrupt(i32 returned %0) {
ret i32 %0
}
int nop_process_label_set(const char *label, struct lxc_conf *conf,
                          int use_default, int on_exec) {
  return 0;
}


x86 assembly (clang, -O0):
<nop_process_label_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.lxc_conf = type opaque
define i32 @nop_process_label_set(i8* nocapture readnone %0, %struct.lxc_conf* nocapture readnone %1, i32 %2, i32 %3) {
ret i32 0
}
void voidFuncNoArgs(void) {}


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

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

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

LLVM IR (-O2):
define void @voidFuncNoArgs() {
ret void
}
int p1strchr(char buf[], char c) {
  int i;
  for (i = 0; buf[i] != '\0'; i++)
    if (buf[i] == c)
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<p1strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1160 <p1strchr+0x60>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    114d <p1strchr+0x4d>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <p1strchr+0x67>
jmp    1152 <p1strchr+0x52>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <p1strchr+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<p1strchr>:
mov    (%rdi),%dl
mov    $0xffffffff,%eax
test   %dl,%dl
je     1122 <p1strchr+0x22>
xor    %ecx,%ecx
nopl   (%rax)
cmp    %sil,%dl
je     1123 <p1strchr+0x23>
movzbl 0x1(%rdi,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <p1strchr+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @p1strchr(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %9
%6 = phi i64 [ %10, %9 ], [ 0, %2 ]
%7 = phi i8 [ %12, %9 ], [ %3, %2 ]
%8 = icmp eq i8 %7, %1
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = add nuw i64 %6, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %16, label %5
14: ; preds = %5
%15 = trunc i64 %6 to i32
br label %16
16: ; preds = %9, %14, %2
%17 = phi i32 [ -1, %2 ], [ %15, %14 ], [ -1, %9 ]
ret i32 %17
}
/* Type definitions */
struct _reent {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
int _read_r(struct _reent *r, int file, char *ptr, int len) {
  (void)r;
  (void)file;
  (void)ptr;
  (void)len;
  errno = EINVAL;
  return -1;
}


x86 assembly (clang, -O0):
<_read_r>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    0x2ebf(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebe(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_read_r>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct._reent = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @_read_r(%struct._reent* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca %struct._reent*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store %struct._reent* %0, %struct._reent** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load %struct._reent*, %struct._reent** %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = load i32, i32* @EINVAL
store i32 %13, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct._reent = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @_read_r(%struct._reent* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i32 %3) {
%5 = load i32, i32* @EINVAL
store i32 %5, i32* @errno
ret i32 -1
}
/* Type definitions */
struct fh_input {
  int dummy;
};

/* Variables and functions */
struct fh_input *fh_open_input_file(char const *);
struct fh_input *file_open(struct fh_input *in, const char *filename) {
  (void)in;
  return fh_open_input_file(filename);
}


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

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

LLVM IR (-O0):
%struct.fh_input = type { i32 }
define %struct.fh_input* @file_open(%struct.fh_input* %0, i8* %1) {
%3 = alloca %struct.fh_input*
%4 = alloca i8*
store %struct.fh_input* %0, %struct.fh_input** %3
store i8* %1, i8** %4
%5 = load %struct.fh_input*, %struct.fh_input** %3
%6 = load i8*, i8** %4
%7 = call %struct.fh_input* @fh_open_input_file(i8* %6)
ret %struct.fh_input* %7
}

LLVM IR (-O2):
%struct.fh_input = type { i32 }
define %struct.fh_input* @file_open(%struct.fh_input* nocapture readnone %0, i8* %1) {
%3 = tail call %struct.fh_input* @fh_open_input_file(i8* %1)
ret %struct.fh_input* %3
}