xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ heights;

/* Variables and functions */
int *malloc(int const);
int /*<<< orphan*/ printf(char *, int, int);
void test3() {
  const int NUM_HEIGHTS = 10;
  int *heights = malloc(NUM_HEIGHTS * sizeof(*heights));
  for (int i = 0; i < NUM_HEIGHTS; i++) {
    if ((heights = NULL)) {
      heights = malloc(NUM_HEIGHTS * sizeof(heights));
      printf("%d: %d", i, heights[i]);
    }
  }
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0xa,-0x4(%rbp)
mov    $0x28,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11a0 <test3+0x80>
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    1165 <test3+0x45>
jmp    118d <test3+0x6d>
mov    $0x50,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
jmp    1192 <test3+0x72>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <test3+0x24>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
mov    $0x28,%edi
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define void @test3() {
%1 = tail call i32* @malloc(i32 40)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ __get_unaligned_le64(int /*<<< orphan*/ const *);
uint64_t get_unaligned_le64(const void *p) {
  return __get_unaligned_le64((const uint8_t *)p);
}


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

x86 assembly (clang, -O2):
<get_unaligned_le64>:
jmp    1030 <__get_unaligned_le64@plt>

LLVM IR (-O0):
define i32 @get_unaligned_le64(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = call i32 @__get_unaligned_le64(i32* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @get_unaligned_le64(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @__get_unaligned_le64(i32* %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char *, size_t);
void strncpy_NULL(char *dest, char *src, size_t n) {
  strncpy(dest, src, n);
  dest[n] = '\0';
}


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

x86 assembly (clang, -O2):
<strncpy_NULL>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <strncpy@plt>
movb   $0x0,(%rbx,%r14,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @strncpy_NULL(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @strncpy(i8* %7, i8* %8, i64 %9)
%11 = load i8*, i8** %4
%12 = load i64, i64* %6
%13 = getelementptr inbounds i8, i8* %11, i64 %12
store i8 0, i8* %13
ret void
}

LLVM IR (-O2):
define void @strncpy_NULL(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @strncpy(i8* %0, i8* %1, i64 %2)
%5 = getelementptr inbounds i8, i8* %0, i64 %2
store i8 0, i8* %5
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *dbd_get_basename(const char *file_name) {
  char *slash;
  if (!file_name)
    return file_name;
  slash = strrchr(file_name, '/');
  if (slash == NULL || slash[1] == '\0')
    return file_name;
  return slash + 1;
}


x86 assembly (clang, -O0):
<dbd_get_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <dbd_get_basename+0x24>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117b <dbd_get_basename+0x6b>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1162 <dbd_get_basename+0x52>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    116f <dbd_get_basename+0x5f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117b <dbd_get_basename+0x6b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbd_get_basename>:
push   %rbx
test   %rdi,%rdi
je     1139 <dbd_get_basename+0x29>
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     113b <dbd_get_basename+0x2b>
mov    %rax,%rcx
add    $0x1,%rcx
cmpb   $0x0,0x1(%rax)
cmovne %rcx,%rbx
jmp    113b <dbd_get_basename+0x2b>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @dbd_get_basename(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i8* @strrchr(i8* %0, i8 signext 47)
%5 = icmp eq i8* %4, null
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %4, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
%10 = select i1 %9, i8* %0, i8* %7
br label %11
11: ; preds = %6, %3, %1
%12 = phi i8* [ null, %1 ], [ %0, %3 ], [ %10, %6 ]
ret i8* %12
}
float kmMax(float lhs, float rhs) { return (lhs > rhs) ? lhs : rhs; }


x86 assembly (clang, -O0):
<kmMax>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    112c <kmMax+0x2c>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1136 <kmMax+0x36>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @kmMax(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp ogt float %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load float, float* %3
br label %12
10: ; preds = %2
%11 = load float, float* %4
br label %12
12: ; preds = %10, %8
%13 = phi float [ %9, %8 ], [ %11, %10 ]
ret float %13
}

LLVM IR (-O2):
define float @kmMax(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
double feetToKilometres(double feet) { return feet * 0.0003048; }


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

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

LLVM IR (-O0):
define double @feetToKilometres(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 3.048000e-04
ret double %4
}

LLVM IR (-O2):
define double @feetToKilometres(double %0) {
%2 = fmul double %0, 3.048000e-04
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ assert_int_equal(int /*<<< orphan*/, int);
int /*<<< orphan*/ north_span(unsigned long);
void north_span_test(void **state) {
  assert_int_equal(north_span(1ul),
                   0x0101010101010101ul & ~0x00000000000000FFul);
}


x86 assembly (clang, -O0):
<north_span_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <north_span@plt>
mov    %eax,%edi
mov    $0x1010100,%esi
call   1040 <assert_int_equal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<north_span_test>:
push   %rax
mov    $0x1,%edi
call   1030 <north_span@plt>
mov    %eax,%edi
mov    $0x1010100,%esi
pop    %rax
jmp    1040 <assert_int_equal@plt>

LLVM IR (-O0):
define void @north_span_test(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @north_span(i64 1)
%4 = call i32 @assert_int_equal(i32 %3, i32 16843008)
ret void
}

LLVM IR (-O2):
define void @north_span_test(i8** nocapture readnone %0) {
%2 = tail call i32 @north_span(i64 1)
%3 = tail call i32 @assert_int_equal(i32 %2, i32 16843008)
ret void
}
/* Variables and functions */
char *strrchr(const char *s, int c) {
  const char *result = NULL;
  do {
    if (*s == (char)c) {
      result = s;
    }
  } while (*s++);
  return (char *)result;
}


x86 assembly (clang, -O0):
<strrchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0xc(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    1130 <strrchr+0x30>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1135 <strrchr+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
jne    1113 <strrchr+0x13>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrchr>:
movsbl %sil,%ecx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
movsbl (%rdi),%edx
cmp    %edx,%ecx
cmove  %rdi,%rax
add    $0x1,%rdi
test   %edx,%edx
jne    1110 <strrchr+0x10>
ret

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

LLVM IR (-O2):
define i8* @strrchr(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
br label %5
5: ; preds = %5, %2
%6 = phi i8* [ %0, %2 ], [ %12, %5 ]
%7 = phi i8* [ null, %2 ], [ %11, %5 ]
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %4, %9
%11 = select i1 %10, i8* %6, i8* %7
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = icmp eq i8 %8, 0
br i1 %13, label %14, label %5
14: ; preds = %5
ret i8* %11
}
/* Type definitions */
struct forth_instance {
  int dummy;
};

/* Variables and functions */
scalar_t__ st_pop(struct forth_instance *);
int /*<<< orphan*/ st_push(struct forth_instance *, uintptr_t);
void urshift(struct forth_instance *fi) {
  uintptr_t tp;
  tp = (uintptr_t)st_pop(fi);
  st_push(fi, (uintptr_t)st_pop(fi) >> tp);
}


x86 assembly (clang, -O0):
<urshift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <st_pop@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <st_pop@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
mov    -0x10(%rbp),%rcx
shr    %cl,%rsi
call   1040 <st_push@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<urshift>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <st_pop@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <st_pop@plt>
mov    %r14d,%ecx
shr    %cl,%rax
mov    %rbx,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <st_push@plt>

LLVM IR (-O0):
%struct.forth_instance = type { i32 }
define void @urshift(%struct.forth_instance* %0) {
%2 = alloca %struct.forth_instance*
%3 = alloca i64
store %struct.forth_instance* %0, %struct.forth_instance** %2
%4 = load %struct.forth_instance*, %struct.forth_instance** %2
%5 = call i64 @st_pop(%struct.forth_instance* %4)
store i64 %5, i64* %3
%6 = load %struct.forth_instance*, %struct.forth_instance** %2
%7 = load %struct.forth_instance*, %struct.forth_instance** %2
%8 = call i64 @st_pop(%struct.forth_instance* %7)
%9 = load i64, i64* %3
%10 = lshr i64 %8, %9
%11 = call i32 @st_push(%struct.forth_instance* %6, i64 %10)
ret void
}

LLVM IR (-O2):
%struct.forth_instance = type { i32 }
define void @urshift(%struct.forth_instance* %0) {
%2 = tail call i64 @st_pop(%struct.forth_instance* %0)
%3 = tail call i64 @st_pop(%struct.forth_instance* %0)
%4 = lshr i64 %3, %2
%5 = tail call i32 @st_push(%struct.forth_instance* %0, i64 %4)
ret void
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t SSIClockSourceGet(uint32_t ui32Base) {
  ;
  return ((*((volatile unsigned long *)(ui32Base + 0x00000FC8))));
}


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

x86 assembly (clang, -O2):
<SSIClockSourceGet>:
mov    %rdi,-0x8(%rsp)
mov    -0x8(%rsp),%rax
mov    0xfc8(%rax),%rax
ret

LLVM IR (-O0):
define i64 @SSIClockSourceGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add i64 %3, 4040
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @SSIClockSourceGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add i64 %3, 4040
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
ret i64 %6
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
scalar_t__ fstat(int, struct stat *);
int /*<<< orphan*/ perror(char *);
int get_file_size(int fd) {
  struct stat stat_ressource;
  if (fstat(fd, &stat_ressource)) {
    perror("fstat");
    return -1;
  }
  return stat_ressource.st_size;
}


x86 assembly (clang, -O0):
<get_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <fstat@plt>
cmp    $0x0,%rax
je     1159 <get_file_size+0x39>
lea    0xeb8(%rip),%rdi
call   1030 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <get_file_size+0x3f>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_size>:
push   %rax
mov    %rsp,%rsi
call   1040 <fstat@plt>
test   %rax,%rax
jne    1133 <get_file_size+0x13>
mov    (%rsp),%eax
pop    %rcx
ret
lea    0xec6(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [6 x i8] c"fstat\00"
define i32 @get_file_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.stat
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i64 @fstat(i32 %5, %struct.stat* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %13
10: ; preds = %1
%11 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%12 = load i32, i32* %11
store i32 %12, i32* %2
br label %13
13: ; preds = %10, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [6 x i8] c"fstat\00"
define i32 @get_file_size(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%10 = load i32, i32* %9
br label %11
11: ; preds = %8, %6
%12 = phi i32 [ -1, %6 ], [ %10, %8 ]
ret i32 %12
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int readByte(int);
int digitalReadPiFace(int pin) {
  uint8_t mask = 1 << pin;
  if ((readByte(0x13) & mask) != 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<digitalReadPiFace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    $0x13,%edi
call   1030 <readByte@plt>
and    -0xc(%rbp),%eax
cmp    $0x0,%eax
je     114a <digitalReadPiFace+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <digitalReadPiFace+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<digitalReadPiFace>:
push   %rbx
mov    %edi,%ebx
mov    $0x13,%edi
call   1030 <readByte@plt>
mov    %ebx,%ecx
shr    %cl,%eax
and    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @digitalReadPiFace(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = shl i32 1, %5
store i32 %6, i32* %4
%7 = call i32 @readByte(i32 19)
%8 = load i32, i32* %4
%9 = and i32 %7, %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 1, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @digitalReadPiFace(i32 %0) {
%2 = tail call i32 @readByte(i32 19)
%3 = lshr i32 %2, %0
%4 = and i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int dbar(double, double);
int sb(double, double);
int ubar(double, double);
int uv(double, double);
double F3_nc_n(double xx, double Q2) {
  return 2 * (uv(xx, Q2) + sb(xx, Q2) + ubar(xx, Q2) - dbar(xx, Q2)) / xx;
}


x86 assembly (clang, -O0):
<F3_nc_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1040 <uv@plt>
mov    %eax,-0x1c(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <sb@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1050 <ubar@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1060 <dbar@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
divsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<F3_nc_n>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1040 <uv@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <sb@plt>
mov    %eax,%ebp
add    %ebx,%ebp
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1050 <ubar@plt>
mov    %eax,%ebx
add    %ebp,%ebx
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1060 <dbar@plt>
sub    %eax,%ebx
add    %ebx,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @F3_nc_n(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call i32 @uv(double %5, double %6)
%8 = load double, double* %3
%9 = load double, double* %4
%10 = call i32 @sb(double %8, double %9)
%11 = add nsw i32 %7, %10
%12 = load double, double* %3
%13 = load double, double* %4
%14 = call i32 @ubar(double %12, double %13)
%15 = add nsw i32 %11, %14
%16 = load double, double* %3
%17 = load double, double* %4
%18 = call i32 @dbar(double %16, double %17)
%19 = sub nsw i32 %15, %18
%20 = mul nsw i32 2, %19
%21 = sitofp i32 %20 to double
%22 = load double, double* %3
%23 = fdiv double %21, %22
ret double %23
}

LLVM IR (-O2):
define double @F3_nc_n(double %0, double %1) {
%3 = tail call i32 @uv(double %0, double %1)
%4 = tail call i32 @sb(double %0, double %1)
%5 = add nsw i32 %4, %3
%6 = tail call i32 @ubar(double %0, double %1)
%7 = add nsw i32 %5, %6
%8 = tail call i32 @dbar(double %0, double %1)
%9 = sub i32 %7, %8
%10 = shl nsw i32 %9, 1
%11 = sitofp i32 %10 to double
%12 = fdiv double %11, %0
ret double %12
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
uint32_t mpu_ll_id_to_addr(unsigned id) { return id * 0x20000000U; }


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

x86 assembly (clang, -O2):
<mpu_ll_id_to_addr>:
mov    %edi,%eax
shl    $0x1d,%eax
ret

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

LLVM IR (-O2):
define i32 @mpu_ll_id_to_addr(i32 %0) {
%2 = shl i32 %0, 29
ret i32 %2
}
unsigned getval_330() { return 3221802633U; }


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

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

LLVM IR (-O0):
define i32 @getval_330() {
ret i32 -1073164663
}

LLVM IR (-O2):
define i32 @getval_330() {
ret i32 -1073164663
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *strndup(const char *src, size_t len) {
  char *dest = (char *)malloc(len + 1);
  strncpy(dest, src, len);
  dest[len] = 0;
  return dest;
}


x86 assembly (clang, -O0):
<strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strndup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x1(%rsi),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <strncpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = add i64 %6, 1
%8 = call i64 @malloc(i64 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i8*, i8** %3
%12 = load i64, i64* %4
%13 = call i32 @strncpy(i8* %10, i8* %11, i64 %12)
%14 = load i8*, i8** %5
%15 = load i64, i64* %4
%16 = getelementptr inbounds i8, i8* %14, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
define i8* @strndup(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strncpy(i8* %5, i8* %0, i64 %1)
%7 = getelementptr inbounds i8, i8* %5, i64 %1
store i8 0, i8* %7
ret i8* %5
}
int foo(int a, int b) { return a * b ^ 0xff; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
xor    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
imul   %esi,%eax
xor    $0xff,%eax
ret

LLVM IR (-O0):
define i32 @foo(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 = mul nsw i32 %5, %6
%8 = xor i32 %7, 255
ret i32 %8
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = xor i32 %3, 255
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ str_replace(char *, char, char);
int /*<<< orphan*/ strcpy(char *, char const *);
void convPath(char *buff, const char *path) {
  strcpy(buff, path);
  str_replace(buff, ']', '/');
}


x86 assembly (clang, -O0):
<convPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    $0x5d,%esi
mov    $0x2f,%edx
call   1040 <str_replace@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convPath>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x5d,%esi
mov    $0x2f,%edx
pop    %rbx
jmp    1040 <str_replace@plt>

LLVM IR (-O0):
define void @convPath(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @strcpy(i8* %5, i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @str_replace(i8* %8, i8 signext 93, i8 signext 47)
ret void
}

LLVM IR (-O2):
define void @convPath(i8* %0, i8* %1) {
%3 = tail call i32 @strcpy(i8* %0, i8* %1)
%4 = tail call i32 @str_replace(i8* %0, i8 signext 93, i8 signext 47)
ret void
}
/* Variables and functions */
int posix_reader(char *);
int /*<<< orphan*/ verify_valid_date(int, int, int);
int main() {
  int day;
  int month;
  int year;
  day = posix_reader("day");
  month = posix_reader("month");
  year = posix_reader("year");
  verify_valid_date(day, month, year);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <posix_reader@plt>
mov    %eax,-0x8(%rbp)
lea    0xebf(%rip),%rdi
call   1030 <posix_reader@plt>
mov    %eax,-0xc(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <posix_reader@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <verify_valid_date@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
call   1030 <posix_reader@plt>
mov    %eax,%ebx
lea    0xecc(%rip),%rdi
call   1030 <posix_reader@plt>
mov    %eax,%ebp
lea    0xec4(%rip),%rdi
call   1030 <posix_reader@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1040 <verify_valid_date@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"day\00"
@.str.1 = [6 x i8] c"month\00"
@.str.2 = [5 x i8] c"year\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @posix_reader(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %5, i32* %2
%6 = call i32 @posix_reader(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 %6, i32* %3
%7 = call i32 @posix_reader(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @verify_valid_date(i32 %8, i32 %9, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"day\00"
@.str.1 = [6 x i8] c"month\00"
@.str.2 = [5 x i8] c"year\00"
define i32 @main() {
%1 = tail call i32 @posix_reader(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @posix_reader(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @posix_reader(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @verify_valid_date(i32 %1, i32 %2, i32 %3)
ret i32 0
}
int is_prime(unsigned int i) {
  unsigned int j;
  for (j = 2; j * j < i + 1; j++) {
    if (!(i % j)) {
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jae    1153 <is_prime+0x53>
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
cmp    $0x0,%edx
jne    1140 <is_prime+0x40>
movl   $0xffffffff,-0x4(%rbp)
jmp    115a <is_prime+0x5a>
jmp    1145 <is_prime+0x45>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <is_prime+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
lea    0x1(%rdi),%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
jb     112e <is_prime+0x2e>
mov    $0x2,%esi
nop
mov    %edi,%eax
xor    %edx,%edx
div    %esi
test   %edx,%edx
je     1129 <is_prime+0x29>
add    $0x1,%esi
mov    %esi,%eax
imul   %esi,%eax
cmp    %ecx,%eax
jb     1110 <is_prime+0x10>
xor    %eax,%eax
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @is_prime(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 2, i32* %4
br label %5
5: ; preds = %19, %1
%6 = load i32, i32* %4
%7 = load i32, i32* %4
%8 = mul i32 %6, %7
%9 = load i32, i32* %3
%10 = add i32 %9, 1
%11 = icmp ult i32 %8, %10
br i1 %11, label %12, label %22
12: ; preds = %5
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = urem i32 %13, %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %12
store i32 -1, i32* %2
br label %23
18: ; preds = %12
br label %19
19: ; preds = %18
%20 = load i32, i32* %4
%21 = add i32 %20, 1
store i32 %21, i32* %4
br label %5
22: ; preds = %5
store i32 0, i32* %2
br label %23
23: ; preds = %22, %17
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = add i32 %0, 1
%3 = icmp ugt i32 %2, 4
br i1 %3, label %7, label %12
4: ; preds = %7
%5 = mul i32 %11, %11
%6 = icmp ult i32 %5, %2
br i1 %6, label %7, label %12
7: ; preds = %1, %4
%8 = phi i32 [ %11, %4 ], [ 2, %1 ]
%9 = urem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add i32 %8, 1
br i1 %10, label %12, label %4
12: ; preds = %7, %4, %1
%13 = phi i32 [ 0, %1 ], [ 0, %4 ], [ -1, %7 ]
ret i32 %13
}
unsigned char SIO1_readData8(void) { return 0; }


x86 assembly (clang, -O0):
<SIO1_readData8>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i8 @SIO1_readData8() {
ret i8 0
}

LLVM IR (-O2):
define zeroext i8 @SIO1_readData8() {
ret i8 0
}
/* Variables and functions */
scalar_t__ round(double);
long double roundl(long double x) { return (long double)round((double)x); }


x86 assembly (clang, -O0):
<roundl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <round@plt>
mov    %rax,-0x18(%rbp)
fildll -0x18(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundl>:
sub    $0x18,%rsp
fldt   0x20(%rsp)
fstpl  0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <round@plt>
mov    %rax,0x10(%rsp)
fildll 0x10(%rsp)
add    $0x18,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @roundl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fptrunc x86_fp80 %3 to double
%5 = call i64 @round(double %4)
%6 = sitofp i64 %5 to x86_fp80
ret x86_fp80 %6
}

LLVM IR (-O2):
define x86_fp80 @roundl(x86_fp80 %0) {
%2 = fptrunc x86_fp80 %0 to double
%3 = tail call i64 @round(double %2)
%4 = sitofp i64 %3 to x86_fp80
ret x86_fp80 %4
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
int /*<<< orphan*/ writeInt(char **, int);
void writeUTF(char **pptr, char *string) {
  int len = strlen(string);
  writeInt(pptr, len);
  memcpy(*pptr, string, len);
  *pptr += len;
}


x86 assembly (clang, -O0):
<writeUTF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <writeInt@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeUTF>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <writeInt@plt>
mov    (%rbx),%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1050 <memcpy@plt>
movslq %ebp,%rax
add    %rax,(%rbx)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @writeUTF(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i32
store i8** %0, i8*** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i8**, i8*** %3
%9 = load i32, i32* %5
%10 = call i32 @writeInt(i8** %8, i32 %9)
%11 = load i8**, i8*** %3
%12 = load i8*, i8** %11
%13 = load i8*, i8** %4
%14 = load i32, i32* %5
%15 = call i32 @memcpy(i8* %12, i8* %13, i32 %14)
%16 = load i32, i32* %5
%17 = load i8**, i8*** %3
%18 = load i8*, i8** %17
%19 = sext i32 %16 to i64
%20 = getelementptr inbounds i8, i8* %18, i64 %19
store i8* %20, i8** %17
ret void
}

LLVM IR (-O2):
define void @writeUTF(i8** %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @writeInt(i8** %0, i32 %3)
%5 = load i8*, i8** %0
%6 = tail call i32 @memcpy(i8* %5, i8* %1, i32 %3)
%7 = load i8*, i8** %0
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i8, i8* %7, i64 %8
store i8* %9, i8** %0
ret void
}
int main() {
  int a[3] = {12, 11, 9};
  int *p;
  p = &a[2];
  return *p;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    0xeee(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeec(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.a = [3 x i32] [i32 12, i32 11, i32 9]
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32*
store i32 0, i32* %1
%4 = bitcast [3 x i32]* %2 to i8*
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
ret i32 9
}
int test_imm_50int16_reg(short val) {
  return ((val) & (-0x50 << 0)) ? -20 : -40;
}


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

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

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


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

x86 assembly (clang, -O2):
<longjerr>:
mov    $0x5,%edi
jmp    1030 <e@plt>

LLVM IR (-O0):
define void @longjerr() {
%1 = call i32 @e(i32 5)
ret void
}

LLVM IR (-O2):
define void @longjerr() {
%1 = tail call i32 @e(i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ functionWithBreak(int);
int functionWithBreak_test() {
  int n = 20;
  functionWithBreak(n);
}


x86 assembly (clang, -O0):
<functionWithBreak_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x14,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <functionWithBreak@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<functionWithBreak_test>:
mov    $0x14,%edi
jmp    1030 <functionWithBreak@plt>

LLVM IR (-O0):
define i32 @functionWithBreak_test() {
%1 = alloca i32
%2 = alloca i32
store i32 20, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @functionWithBreak(i32 %3)
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
define i32 @functionWithBreak_test() {
%1 = tail call i32 @functionWithBreak(i32 20)
ret i32 undef
}
int LaoAi_XieWuShi_cost(struct Ability *self) { return 125; }


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

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

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

LLVM IR (-O2):
%struct.Ability = type opaque
define i32 @LaoAi_XieWuShi_cost(%struct.Ability* nocapture readnone %0) {
ret i32 125
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void lock_trc(char const *str, int id) {
  static int n;
  if (0) {
    printf("%s%d ", str, id - 1);
    if (++n > 16) {
      n = 0;
      printf("\n");
    }
  }
}


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

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

LLVM IR (-O0):
@lock_trc.n = internal global i32 0
define void @lock_trc(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @lock_trc(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int close(int);
int /*<<< orphan*/ die(char *);
void do_close(int fd) {
  int status = close(fd);
  if (status == -1)
    die("close failed");
}


x86 assembly (clang, -O0):
<do_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    114c <do_close+0x2c>
lea    0xeb9(%rip),%rdi
call   1040 <die@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_close>:
push   %rax
call   1030 <close@plt>
cmp    $0xffffffff,%eax
je     112d <do_close+0xd>
pop    %rax
ret
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1040 <die@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"close failed\00"
define void @do_close(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @close(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @die(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"close failed\00"
define void @do_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @die(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
int ExprConvert(int no_bits, int value) {
  if (value < 0) {
    value = -value;
    value--;
    value = ~value;
  }
  return value & ((1 << no_bits) - 1);
}


x86 assembly (clang, -O0):
<ExprConvert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    112e <ExprConvert+0x2e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExprConvert>:
mov    %edi,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
and    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @ExprConvert(i32 %0, i32 %1) {
%3 = shl nsw i32 -1, %0
%4 = xor i32 %3, -1
%5 = and i32 %4, %1
ret i32 %5
}
void listitem_free(void *p) { (void)p; }


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

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

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

LLVM IR (-O2):
define void @listitem_free(i8* nocapture %0) {
ret void
}
int m_register_pid(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @m_register_pid() {
ret i32 0
}

LLVM IR (-O2):
define i32 @m_register_pid() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void errout(const char *msg) {
  fprintf(stderr, "%s\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<errout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<errout>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @errout(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @errout(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ printf(char *, char const *, int, char const *);
void private_abort(const char *msg, const char *func, int line) {
  (void)msg;
  (void)func;
  (void)line;
  printf("%s FATAL ERROR [%d]: %s\n", func, line, msg);
  abort();
}


x86 assembly (clang, -O0):
<private_abort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rcx
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<private_abort>:
push   %rax
mov    %rdi,%rcx
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"%s FATAL ERROR [%d]: %s\0A\00"
define void @private_abort(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = load i8*, i8** %4
%13 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11, i8* %12)
%14 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [25 x i8] c"%s FATAL ERROR [%d]: %s\0A\00"
define void @private_abort(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2, i8* %0)
%5 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ clearControllerMapping(void *);
int /*<<< orphan*/ resetRegisteredControlFunctions(void *);
void initControllerTable(void *mcfg) {
  resetRegisteredControlFunctions(mcfg);
  clearControllerMapping(mcfg);
}


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

x86 assembly (clang, -O2):
<initControllerTable>:
push   %rbx
mov    %rdi,%rbx
call   1030 <resetRegisteredControlFunctions@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <clearControllerMapping@plt>

LLVM IR (-O0):
define void @initControllerTable(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @resetRegisteredControlFunctions(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @clearControllerMapping(i8* %5)
ret void
}

LLVM IR (-O2):
define void @initControllerTable(i8* %0) {
%2 = tail call i32 @resetRegisteredControlFunctions(i8* %0)
%3 = tail call i32 @clearControllerMapping(i8* %0)
ret void
}
void iwl_setup_spectrum_handlers(struct iwl_priv *priv) {}


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

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

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

LLVM IR (-O2):
%struct.iwl_priv = type opaque
define void @iwl_setup_spectrum_handlers(%struct.iwl_priv* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t getProtoFunction(uint8_t *data) { return data[0] & 0x0F; }


x86 assembly (clang, -O0):
<getProtoFunction>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xf,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getProtoFunction>:
mov    (%rdi),%eax
and    $0xf,%eax
ret

LLVM IR (-O0):
define i32 @getProtoFunction(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = and i32 %5, 15
ret i32 %6
}

LLVM IR (-O2):
define i32 @getProtoFunction(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 15
ret i32 %3
}