xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ CloseHTMSocket(void *);
int /*<<< orphan*/ SendHTMSocket(void *, int, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void SendData(void *htmsocket, int size, char *data) {
  if (!SendHTMSocket(htmsocket, size, data)) {
    perror("Couldn't send out socket: ");
    CloseHTMSocket(htmsocket);
    exit(3);
  }
}


x86 assembly (clang, -O0):
<SendData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <SendHTMSocket@plt>
cmp    $0x0,%eax
jne    118b <SendData+0x4b>
lea    0xe8d(%rip),%rdi
call   1040 <perror@plt>
mov    -0x8(%rbp),%rdi
call   1060 <CloseHTMSocket@plt>
mov    $0x3,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendData>:
push   %rbx
mov    %rdi,%rbx
call   1030 <SendHTMSocket@plt>
test   %eax,%eax
je     114f <SendData+0xf>
pop    %rbx
ret
lea    0xeaa(%rip),%rdi
call   1040 <perror@plt>
mov    %rbx,%rdi
call   1060 <CloseHTMSocket@plt>
mov    $0x3,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Couldn't send out socket: \00"
define void @SendData(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i32 @SendHTMSocket(i8* %7, i32 %8, i8* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %3
%13 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %4
%15 = call i32 @CloseHTMSocket(i8* %14)
%16 = call i32 @exit(i32 3)
unreachable
17: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Couldn't send out socket: \00"
define void @SendData(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @SendHTMSocket(i8* %0, i32 %1, i8* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @CloseHTMSocket(i8* %0)
%9 = tail call i32 @exit(i32 3)
unreachable
10: ; preds = %3
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int evenly_divisible(uint32_t a, uint32_t max_divis) {
  for (int i = max_divis; i > 2; i--) {
    if (a % i != 0) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<evenly_divisible>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
jle    1149 <evenly_divisible+0x49>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
je     1136 <evenly_divisible+0x36>
movl   $0x0,-0x4(%rbp)
jmp    1150 <evenly_divisible+0x50>
jmp    113b <evenly_divisible+0x3b>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1110 <evenly_divisible+0x10>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<evenly_divisible>:
mov    $0x1,%ecx
cmp    $0x3,%esi
jl     1123 <evenly_divisible+0x23>
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    1126 <evenly_divisible+0x26>
lea    -0x1(%rsi),%eax
cmp    $0x4,%esi
mov    %eax,%esi
jge    1110 <evenly_divisible+0x10>
mov    %ecx,%eax
ret
xor    %ecx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @evenly_divisible(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 2
br i1 %3, label %7, label %11
4: ; preds = %7
%5 = add nsw i32 %8, -1
%6 = icmp sgt i32 %8, 3
br i1 %6, label %7, label %11
7: ; preds = %2, %4
%8 = phi i32 [ %5, %4 ], [ %1, %2 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %4, %7, %2
%12 = phi i32 [ 1, %2 ], [ 0, %7 ], [ 1, %4 ]
ret i32 %12
}
main() {
  int i;
  int *j = 10;
  i = j + 19;
  printf("\n%d", i);
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 86)
ret i32 0
}
int cmp_long(const long *const a, const long *const b) {
  long res = *a - *b;
  return (res < 0) ? -1 : ((res > 0) ? 1 : 0);
}


x86 assembly (clang, -O0):
<cmp_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    1136 <cmp_long+0x36>
mov    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <cmp_long+0x4b>
mov    -0x18(%rbp),%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovg  %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_long>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
setne  %cl
mov    $0xffffffff,%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp_long(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i64
store i64* %0, i64** %3
store i64* %1, i64** %4
%6 = load i64*, i64** %3
%7 = load i64, i64* %6
%8 = load i64*, i64** %4
%9 = load i64, i64* %8
%10 = sub nsw i64 %7, %9
store i64 %10, i64* %5
%11 = load i64, i64* %5
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
br label %19
14: ; preds = %2
%15 = load i64, i64* %5
%16 = icmp sgt i64 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, i32 1, i32 0
br label %19
19: ; preds = %14, %13
%20 = phi i32 [ -1, %13 ], [ %18, %14 ]
ret i32 %20
}

LLVM IR (-O2):
define i32 @cmp_long(i64* nocapture %0, i64* nocapture %1) {
%3 = load i64, i64* %0
%4 = load i64, i64* %1
%5 = sub nsw i64 %3, %4
%6 = icmp slt i64 %5, 0
%7 = icmp ne i64 %5, 0
%8 = zext i1 %7 to i32
%9 = select i1 %6, i32 -1, i32 %8
ret i32 %9
}
int do_480() { return 480; }


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

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

LLVM IR (-O0):
define i32 @do_480() {
ret i32 480
}

LLVM IR (-O2):
define i32 @do_480() {
ret i32 480
}
int f_le_mm2(float *a1, float *a2) { return !(((*a1) <= (*a2))); }


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

x86 assembly (clang, -O2):
<f_le_mm2>:
movss  (%rsi),%xmm0
xor    %eax,%eax
ucomiss (%rdi),%xmm0
setb   %al
ret

LLVM IR (-O0):
define i32 @f_le_mm2(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* %5
%7 = load float*, float** %4
%8 = load float, float* %7
%9 = fcmp ole float %6, %8
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @f_le_mm2(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = fcmp ugt float %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  int i;
  char str[8];
  i = 10;
  strcpy(str, "ABC");
  printf("i = %d\n", i);
  printf("str = %s\n", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
lea    0xebf(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%esi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x10(%rbp),%rsi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xec4(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"ABC\00"
@.str.1 = [8 x i8] c"i = %d\0A\00"
@.str.2 = [10 x i8] c"str = %s\0A\00"
define i32 @main() {
%1 = alloca [8 x i8]
%2 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 10)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
__attribute__((warn_unused_result)) uint16_t modbusRLE(const uint8_t *p) {
  uint8_t lo = *p;
  uint8_t hi = *(p + 1);
  return (uint16_t)lo | ((uint16_t)hi << 8);
}


x86 assembly (clang, -O0):
<modbusRLE>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<modbusRLE>:
mov    0x8(%rdi),%eax
shl    $0x8,%eax
or     (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @modbusRLE(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
%4 = alloca i64
store i64* %0, i64** %2
%5 = load i64*, i64** %2
%6 = load i64, i64* %5
store i64 %6, i64* %3
%7 = load i64*, i64** %2
%8 = getelementptr inbounds i64, i64* %7, i64 1
%9 = load i64, i64* %8
store i64 %9, i64* %4
%10 = load i64, i64* %3
%11 = trunc i64 %10 to i32
%12 = load i64, i64* %4
%13 = trunc i64 %12 to i32
%14 = shl i32 %13, 8
%15 = or i32 %11, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @modbusRLE(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = getelementptr inbounds i64, i64* %0, i64 1
%4 = load i64, i64* %3
%5 = trunc i64 %2 to i32
%6 = trunc i64 %4 to i32
%7 = shl i32 %6, 8
%8 = or i32 %7, %5
ret i32 %8
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int strlen(char *);
char *concatenate(char *str1, char *str2) {
  int len = strlen(str1) + strlen(str2);
  char *str = (char *)malloc(len + 1);
  sprintf(str, "%s%s", str1, str2);
  return str;
}


x86 assembly (clang, -O0):
<concatenate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe7f(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concatenate>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    (%r15,%rax,1),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xe9c(%rip),%rsi
mov    %rax,%rdi
mov    %r12,%rdx
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
define i8* @concatenate(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = load i8*, i8** %4
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %8, %10
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 1
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = load i8*, i8** %3
%18 = load i8*, i8** %4
%19 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %18)
%20 = load i8*, i8** %6
ret i8* %20
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
define i8* @concatenate(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = add i32 %3, 1
%6 = add i32 %5, %4
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @sprintf(i8* dereferenceable(1) %8, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret i8* %8
}
/* Variables and functions */
int dxl_get_result();
unsigned char getCommandStatus(void) {
  int result = dxl_get_result();
  switch (result) {
  case (7):
    return (2);
  case (1):
  case (0):
    return (0);
  case (6):
    return (1);
  case (4):
    return (5);
  default:
    return (3);
  }
}


x86 assembly (clang, -O0):
<getCommandStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <dxl_get_result@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x7,%rax
ja     116b <getCommandStatus+0x5b>
mov    -0x10(%rbp),%rax
lea    0xec2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x2,-0x1(%rbp)
jmp    116f <getCommandStatus+0x5f>
movb   $0x0,-0x1(%rbp)
jmp    116f <getCommandStatus+0x5f>
movb   $0x1,-0x1(%rbp)
jmp    116f <getCommandStatus+0x5f>
movb   $0x5,-0x1(%rbp)
jmp    116f <getCommandStatus+0x5f>
movb   $0x3,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCommandStatus>:
push   %rax
xor    %eax,%eax
call   1030 <dxl_get_result@plt>
lea    0x0(,%rax,8),%ecx
movabs $0x201030503030000,%rdx
03 01 02
shr    %cl,%rdx
cmp    $0x8,%eax
mov    $0x3,%eax
cmovb  %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @getCommandStatus() {
%1 = alloca i8
%2 = alloca i32
%3 = call i32 (...) @dxl_get_result()
store i32 %3, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %9 [
i32 7, label %5
i32 1, label %6
i32 0, label %6
i32 6, label %7
i32 4, label %8
]
5: ; preds = %0
store i8 2, i8* %1
br label %10
6: ; preds = %0, %0
store i8 0, i8* %1
br label %10
7: ; preds = %0
store i8 1, i8* %1
br label %10
8: ; preds = %0
store i8 5, i8* %1
br label %10
9: ; preds = %0
store i8 3, i8* %1
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i8, i8* %1
ret i8 %11
}

LLVM IR (-O2):
define zeroext i8 @getCommandStatus() {
%1 = tail call i32 (...) @dxl_get_result()
%2 = icmp ult i32 %1, 8
%3 = zext i32 %1 to i64
%4 = shl nuw nsw i64 %3, 3
%5 = lshr i64 144399983112814592, %4
%6 = trunc i64 %5 to i8
%7 = select i1 %2, i8 %6, i8 3
ret i8 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
int random();
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int res;
  srandom(time(NULL));
  res = random() % 3;
  printf("%s: %d\n", argv[0], res);
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
mov    $0x0,%al
call   1060 <random@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x14(%rbp),%edx
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
xor    %eax,%eax
call   1060 <random@plt>
movslq %eax,%rbx
imul   $0x55555556,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ebx
mov    (%r14),%rsi
lea    0xe7e(%rip),%rdi
mov    %ebx,%edx
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @time(i32* null)
%8 = call i32 @srandom(i32 %7)
%9 = call i32 (...) @random()
%10 = srem i32 %9, 3
store i32 %10, i32* %6
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = load i32, i32* %6
%15 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14)
%16 = load i32, i32* %6
ret i32 %16
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srandom(i32 %3)
%5 = tail call i32 (...) @random()
%6 = srem i32 %5, 3
%7 = load i8*, i8** %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %6)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char input_string[105];
  scanf("%[^\n]", input_string);
  printf("Hello, World.\n");
  printf("%s", input_string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1040 <scanf@plt>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xec4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%[^\0A]\00"
@.str.2 = [3 x i8] c"%s\00"
@str = [14 x i8] c"Hello, World.\00"
define i32 @main() {
%1 = alloca [105 x i8]
%2 = getelementptr inbounds [105 x i8], [105 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int sqrt(int);
double EDacos(double x) { return (-1. / sqrt(1. - x * x)); }


x86 assembly (clang, -O0):
<EDacos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xebe(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe9d(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EDacos>:
push   %rax
mulsd  %xmm0,%xmm0
movsd  0xee3(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sqrt@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0xecf(%rip),%xmm0
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @EDacos(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fneg double %3
%6 = call double @llvm.fmuladd.f64(double %5, double %4, double 1.000000e+00)
%7 = fptosi double %6 to i32
%8 = call i32 @sqrt(i32 %7)
%9 = sitofp i32 %8 to double
%10 = fdiv double -1.000000e+00, %9
ret double %10
}

LLVM IR (-O2):
define double @EDacos(double %0) {
%2 = fneg double %0
%3 = tail call double @llvm.fmuladd.f64(double %2, double %0, double 1.000000e+00)
%4 = fptosi double %3 to i32
%5 = tail call i32 @sqrt(i32 %4)
%6 = sitofp i32 %5 to double
%7 = fdiv double -1.000000e+00, %6
ret double %7
}
int my_func(int stat_loc) {
  return ((union {
           __typeof__(stat_loc) __in;
           int __i;
         }){.__in = (stat_loc)})
      .__i;
}


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

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

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @my_func(i32 %0) {
%2 = alloca i32
%3 = alloca %union.anon
store i32 %0, i32* %2
%4 = bitcast %union.anon* %3 to i32*
%5 = load i32, i32* %2
store i32 %5, i32* %4
%6 = bitcast %union.anon* %3 to i32*
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @my_func(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
scalar_t__ memcmp(char const *, char *, int);
int has_id3v2tag(const char *raw_header) {
  return (memcmp(raw_header, "ID3", 3) == 0);
}


x86 assembly (clang, -O0):
<has_id3v2tag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x3,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_id3v2tag>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x3,%edx
call   1030 <memcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"ID3\00"
define i32 @has_id3v2tag(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @memcmp(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [4 x i8] c"ID3\00"
define i32 @has_id3v2tag(i8* %0) {
%2 = tail call i64 @memcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void version(void) {
  printf("shuffle version 1.18.6\n");
  printf("Copyright (c) 2000-2018 Ruda Moura <ruda.moura@gmail.com>\n");
}


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

x86 assembly (clang, -O2):
<version>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"shuffle version 1.18.6\0A\00"
@.str.1 = [59 x i8] c"Copyright (c) 2000-2018 Ruda Moura <ruda.moura@gmail.com>\0A\00"
define void @version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [23 x i8] c"shuffle version 1.18.6\00"
@str.2 = [58 x i8] c"Copyright (c) 2000-2018 Ruda Moura <ruda.moura@gmail.com>\00"
define void @version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int rand();
void roll(void) {
  extern int die1, die2;
  die1 = (rand() >> 8) % 6 + 1;
  die2 = (rand() >> 8) % 6 + 1;
}


x86 assembly (clang, -O0):
<roll>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
sar    $0x8,%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    0x2eb8(%rip),%rax
mov    %edx,(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
sar    $0x8,%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    0x2e8a(%rip),%rax
mov    %edx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<roll>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
sar    $0x8,%eax
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    0x2ea4(%rip),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
call   1030 <rand@plt>
sar    $0x8,%eax
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    0x2e5f(%rip),%rcx
mov    %eax,(%rcx)
pop    %rax
ret

LLVM IR (-O0):
@die1 = external global i32
@die2 = external global i32
define void @roll() {
%1 = call i32 (...) @rand()
%2 = ashr i32 %1, 8
%3 = srem i32 %2, 6
%4 = add nsw i32 %3, 1
store i32 %4, i32* @die1
%5 = call i32 (...) @rand()
%6 = ashr i32 %5, 8
%7 = srem i32 %6, 6
%8 = add nsw i32 %7, 1
store i32 %8, i32* @die2
ret void
}

LLVM IR (-O2):
@die1 = external global i32
@die2 = external global i32
define void @roll() {
%1 = tail call i32 (...) @rand()
%2 = ashr i32 %1, 8
%3 = srem i32 %2, 6
%4 = add nsw i32 %3, 1
store i32 %4, i32* @die1
%5 = tail call i32 (...) @rand()
%6 = ashr i32 %5, 8
%7 = srem i32 %6, 6
%8 = add nsw i32 %7, 1
store i32 %8, i32* @die2
ret void
}
int main(void) {
  return (!((((((((((0)) > ((1))) ? ((0)) : ((1)))) < ((3)))
                   ? (((((0)) > ((1))) ? ((0)) : ((1))))
                   : ((3)))) == 1) &&
            (((((((((1)) > ((1))) ? ((1)) : ((1)))) < ((3)))
                   ? (((((1)) > ((1))) ? ((1)) : ((1))))
                   : ((3)))) == 1) &&
            (((((((((2)) > ((1))) ? ((2)) : ((1)))) < ((3)))
                   ? (((((2)) > ((1))) ? ((2)) : ((1))))
                   : ((3)))) == 2) &&
            (((((((((3)) > ((1))) ? ((3)) : ((1)))) < ((3)))
                   ? (((((3)) > ((1))) ? ((3)) : ((1))))
                   : ((3)))) == 3) &&
            (((((((((4)) > ((1))) ? ((4)) : ((1)))) < ((3)))
                   ? (((((4)) > ((1))) ? ((4)) : ((1))))
                   : ((3)))) == 3) &&
            (((((((((5)) > ((1))) ? ((5)) : ((1)))) < ((3)))
                   ? (((((5)) > ((1))) ? ((5)) : ((1))))
                   : ((3)))) == 3)));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct mmc_host {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mmc_resume_host(struct mmc_host *);
int /*<<< orphan*/ printk(char *);
void resume_host_debug(struct mmc_host *mmc) {
  printk(" resume :");
  mmc_resume_host(mmc);
}


x86 assembly (clang, -O0):
<resume_host_debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printk@plt>
mov    -0x8(%rbp),%rdi
call   1040 <mmc_resume_host@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resume_host_debug>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <printk@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <mmc_resume_host@plt>

LLVM IR (-O0):
%struct.mmc_host = type { i32 }
@.str = [10 x i8] c" resume :\00"
define void @resume_host_debug(%struct.mmc_host* %0) {
%2 = alloca %struct.mmc_host*
store %struct.mmc_host* %0, %struct.mmc_host** %2
%3 = call i32 @printk(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = load %struct.mmc_host*, %struct.mmc_host** %2
%5 = call i32 @mmc_resume_host(%struct.mmc_host* %4)
ret void
}

LLVM IR (-O2):
%struct.mmc_host = type { i32 }
@.str = [10 x i8] c" resume :\00"
define void @resume_host_debug(%struct.mmc_host* %0) {
%2 = tail call i32 @printk(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @mmc_resume_host(%struct.mmc_host* %0)
ret void
}
int np_mount(char *mntpt, int mntflags, char *opts) { return -1; }


x86 assembly (clang, -O0):
<np_mount>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @np_mount(i8* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void error(char *str) {
  perror(str);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
call   1030 <perror@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @error(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
int fmult(int x, int y) { return (x * y); }


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

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

LLVM IR (-O0):
define i32 @fmult(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
ret i32 %7
}

LLVM IR (-O2):
define i32 @fmult(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
int fun796() { return 796; }


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

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

LLVM IR (-O0):
define i32 @fun796() {
ret i32 796
}

LLVM IR (-O2):
define i32 @fun796() {
ret i32 796
}
/* Variables and functions */
int /*<<< orphan*/ LoadEngineProc(int /*<<< orphan*/, char *);
void LoadEngine1Proc() { LoadEngineProc(0, ("Load first engine")); }


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"Load first engine\00"
define void @LoadEngine1Proc() {
%1 = call i32 @LoadEngineProc(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Load first engine\00"
define void @LoadEngine1Proc() {
%1 = tail call i32 @LoadEngineProc(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}
int f(int a, int b, int c) {
  if (c == 0)
    goto temp;
  if (a == 0)
    return 0;
temp:
  if (a == b)
    return a;
  return a;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    111c <f+0x1c>
jmp    1137 <f+0x37>
cmpl   $0x0,-0x8(%rbp)
jne    1132 <f+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1154 <f+0x54>
jmp    1137 <f+0x37>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    114e <f+0x4e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1154 <f+0x54>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xor    %eax,%eax
test   %edx,%edx
cmove  %edi,%eax
test   %edi,%edi
cmovne %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = icmp ne i32 %2, 0
%5 = icmp eq i32 %0, 0
%6 = and i1 %5, %4
%7 = select i1 %6, i32 0, i32 %0
ret i32 %7
}
/* Variables and functions */
double errcheck(int /*<<< orphan*/, char *);
int /*<<< orphan*/ sqrt(double);
double Sqrt(double x) { return errcheck(sqrt(x), "sqrt"); }


x86 assembly (clang, -O0):
<Sqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <sqrt@plt>
mov    %eax,%edi
lea    0xec0(%rip),%rsi
call   1030 <errcheck@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sqrt>:
push   %rax
call   1040 <sqrt@plt>
lea    0xed3(%rip),%rsi
mov    %eax,%edi
pop    %rax
jmp    1030 <errcheck@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"sqrt\00"
define double @Sqrt(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @sqrt(double %3)
%5 = call double @errcheck(i32 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret double %5
}

LLVM IR (-O2):
@.str = [5 x i8] c"sqrt\00"
define double @Sqrt(double %0) {
%2 = tail call i32 @sqrt(double %0)
%3 = tail call double @errcheck(i32 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret double %3
}
void g_cclosure_marshal_VOID__STRING() {}


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

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

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

LLVM IR (-O2):
define void @g_cclosure_marshal_VOID__STRING() {
ret void
}
reg0regx1_set(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{ r0 = (p1[x1]); }


x86 assembly (clang, -O0):
<reg0regx1_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @reg0regx1_set(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32* %5, i32** %13
%14 = load i32*, i32** %13
%15 = load i32, i32* %11
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
store i32 %18, i32* %8
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
define i32 @reg0regx1_set(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture readnone %4, i32* nocapture readnone %5) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ setup_parent(char *, int, char **);
int main(int argc, char *argv[]) { setup_parent("shm", argc, argv); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xed3(%rip),%rdi
call   1030 <setup_parent@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsi,%rdx
mov    %edi,%esi
lea    0xee3(%rip),%rdi
call   1030 <setup_parent@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"shm\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @setup_parent(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0, i8** %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ heapify(int *, int, int (*)(int, int));
void buildheap(int *heap, int (*CFun)(int, int)) {
  int i;
  for (i = heap[0] / 2; i >= 1; i--)
    heapify(heap, i, CFun);
}


x86 assembly (clang, -O0):
<buildheap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     1159 <buildheap+0x49>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <heapify@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <buildheap+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildheap>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%ebx
cmp    $0x2,%ebx
jl     1147 <buildheap+0x37>
mov    %rsi,%r14
mov    %rdi,%r15
shr    %ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <heapify@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
ja     1130 <buildheap+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @buildheap(i32* %0, i32 (i32, i32)* %1) {
%3 = load i32, i32* %0
%4 = icmp sgt i32 %3, 1
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = lshr i32 %3, 1
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ %10, %7 ], [ %6, %5 ]
%9 = tail call i32 @heapify(i32* %0, i32 %8, i32 (i32, i32)* %1)
%10 = add nsw i32 %8, -1
%11 = icmp ugt i32 %8, 1
br i1 %11, label %7, label %12
12: ; preds = %7, %2
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int mode;
};
typedef TYPE_1__ XFocusInEvent;

/* Variables and functions */
void set_XFocusInEvent_mode(void *_p, int _v) {
  ((XFocusInEvent *)_p)->mode = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XFocusInEvent_mode>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XFocusInEvent_mode(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XFocusInEvent_mode(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UART_DEB_UartPostEnable();
void UART_DEB_ScbModePostEnable(void) { UART_DEB_UartPostEnable(); }


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

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

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

LLVM IR (-O2):
define void @UART_DEB_ScbModePostEnable() {
%1 = tail call i32 (...) @UART_DEB_UartPostEnable()
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
bool SHAREMIND_MAP_KEY_COPY_uint8_t(uint8_t *const dest, uint8_t const src) {
  return (((*dest) = src), true);
}


x86 assembly (clang, -O0):
<SHAREMIND_MAP_KEY_COPY_uint8_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @SHAREMIND_MAP_KEY_COPY_uint8_t(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 = load i32*, i32** %3
store i32 %5, i32* %6
ret i32 1
}

LLVM IR (-O2):
define i32 @SHAREMIND_MAP_KEY_COPY_uint8_t(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
ret i32 1
}
int test_imm_BEint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xBE << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_BEint64_midword_mem>:
testb  $0xbe,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_BEint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 12451840
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned char mem_Close(void) { return (1); }


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

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

LLVM IR (-O0):
define zeroext i8 @mem_Close() {
ret i8 1
}

LLVM IR (-O2):
define zeroext i8 @mem_Close() {
ret i8 1
}
/* Variables and functions */
int rand();
int random2(int dd) { return rand() % (dd + 1); }


x86 assembly (clang, -O0):
<random2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random2>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
add    $0x1,%ebx
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @random2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
%6 = srem i32 %3, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @random2(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = add nsw i32 %0, 1
%4 = srem i32 %2, %3
ret i32 %4
}
__typeof__(strchr(1, 1)) test_strchr_176(void) { return strchr(1, 1); }


x86 assembly (clang, -O0):
<test_strchr_176>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <strchr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strchr_176>:
mov    $0x1,%edi
mov    $0x1,%esi
jmp    1030 <strchr@plt>

LLVM IR (-O0):
define i8* @test_strchr_176() {
%1 = call i8* @strchr(i8* inttoptr (i64 1 to i8*), i32 1)
ret i8* %1
}

LLVM IR (-O2):
define i8* @test_strchr_176() {
%1 = tail call i8* @strchr(i8* inttoptr (i64 1 to i8*), i32 1)
ret i8* %1
}