xunge/DecIR huggingface dataset:
/* Type definitions */
struct vec4i {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ vec4i_max(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/ *);
__attribute__((always_)) struct vec4i *
psvec4i_max(struct vec4i *result, struct vec4i *a, struct vec4i *b) {
  vec4i_max((int32_t *)result, (int32_t *)a, (int32_t *)b);
  return result;
}


x86 assembly (clang, -O0):
<psvec4i_max>:
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 <vec4i_max@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psvec4i_max>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec4i_max@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec4i = type { i32 }
define %struct.vec4i* @psvec4i_max(%struct.vec4i* %0, %struct.vec4i* %1, %struct.vec4i* %2) {
%4 = alloca %struct.vec4i*
%5 = alloca %struct.vec4i*
%6 = alloca %struct.vec4i*
store %struct.vec4i* %0, %struct.vec4i** %4
store %struct.vec4i* %1, %struct.vec4i** %5
store %struct.vec4i* %2, %struct.vec4i** %6
%7 = load %struct.vec4i*, %struct.vec4i** %4
%8 = bitcast %struct.vec4i* %7 to i32*
%9 = load %struct.vec4i*, %struct.vec4i** %5
%10 = bitcast %struct.vec4i* %9 to i32*
%11 = load %struct.vec4i*, %struct.vec4i** %6
%12 = bitcast %struct.vec4i* %11 to i32*
%13 = call i32 @vec4i_max(i32* %8, i32* %10, i32* %12)
%14 = load %struct.vec4i*, %struct.vec4i** %4
ret %struct.vec4i* %14
}

LLVM IR (-O2):
%struct.vec4i = type { i32 }
define %struct.vec4i* @psvec4i_max(%struct.vec4i* returned %0, %struct.vec4i* %1, %struct.vec4i* %2) {
%4 = getelementptr %struct.vec4i, %struct.vec4i* %0, i64 0, i32 0
%5 = getelementptr %struct.vec4i, %struct.vec4i* %1, i64 0, i32 0
%6 = getelementptr %struct.vec4i, %struct.vec4i* %2, i64 0, i32 0
%7 = tail call i32 @vec4i_max(i32* %4, i32* %5, i32* %6)
ret %struct.vec4i* %0
}
void foo810() {}


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

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

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

LLVM IR (-O2):
define void @foo810() {
ret void
}
int item_customer_hash(void *key, int M) {
  char *k = (char *)key;
  int h = 0;
  for (; *k != '\0'; k++)
    h = (127 * h + *k) % M;
  return h;
}


x86 assembly (clang, -O0):
<item_customer_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     114f <item_customer_hash+0x4f>
imul   $0x7f,-0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111a <item_customer_hash+0x1a>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<item_customer_hash>:
mov    (%rdi),%al
test   %al,%al
je     112d <item_customer_hash+0x2d>
add    $0x1,%rdi
xor    %edx,%edx
nopl   0x0(%rax)
movsbl %al,%ecx
mov    %edx,%eax
shl    $0x7,%eax
sub    %edx,%eax
add    %ecx,%eax
cltd
idiv   %esi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <item_customer_hash+0x10>
mov    %edx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @item_customer_hash(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %14, %5 ], [ %3, %2 ]
%7 = phi i32 [ %12, %5 ], [ 0, %2 ]
%8 = phi i8* [ %13, %5 ], [ %0, %2 ]
%9 = sext i8 %6 to i32
%10 = mul nsw i32 %7, 127
%11 = add nsw i32 %10, %9
%12 = srem i32 %11, %1
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32 [ 0, %2 ], [ %12, %5 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printArr(int *arr, int len) {
  int i;
  for (i = 0; i < len; ++i) {
    printf("%d ", arr[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printArr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printArr+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArr+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <printArr+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printArr+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @printArr(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
int ascending(int num0, int num1) { return num0 > num1 ? 0 : 1; }


x86 assembly (clang, -O0):
<ascending>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%esi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmovg  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascending>:
xor    %eax,%eax
cmp    %esi,%edi
setle  %al
ret

LLVM IR (-O0):
define i32 @ascending(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 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 0, i32 1
ret i32 %9
}

LLVM IR (-O2):
define i32 @ascending(i32 %0, i32 %1) {
%3 = icmp sle i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
char *__ulltoa_internal__(unsigned long, char *, int, int /*<<< orphan*/, int);
char *ultoa(unsigned long value, char *str, int base) {
  return __ulltoa_internal__(value, str, base, 0,
                             (sizeof(long) == 8) ? 0 : 0xFFFFFFFF);
}


x86 assembly (clang, -O0):
<ultoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1030 <__ulltoa_internal__@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ultoa>:
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <__ulltoa_internal__@plt>

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

LLVM IR (-O2):
define i8* @ultoa(i64 %0, i8* %1, i32 %2) {
%4 = tail call i8* @__ulltoa_internal__(i64 %0, i8* %1, i32 %2, i32 0, i32 0)
ret i8* %4
}
void gtk_radio_action_get_current_value() {}


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

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

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

LLVM IR (-O2):
define void @gtk_radio_action_get_current_value() {
ret void
}
void FanChannelRPMSet(unsigned long ulBase, unsigned long ulChannel,
                      unsigned long ulRPM) {
  ;
  ;
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000014 + (ulChannel * 0x10)))) =
      ulRPM;
}


x86 assembly (clang, -O0):
<FanChannelRPMSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    $0x14,%rax
mov    -0x10(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<FanChannelRPMSet>:
shl    $0x4,%rsi
mov    %rdx,0x14(%rdi,%rsi,1)
ret

LLVM IR (-O0):
define void @FanChannelRPMSet(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = load i64, i64* %4
%9 = add i64 %8, 20
%10 = load i64, i64* %5
%11 = mul i64 %10, 16
%12 = add i64 %9, %11
%13 = inttoptr i64 %12 to i64*
store volatile i64 %7, i64* %13
ret void
}

LLVM IR (-O2):
define void @FanChannelRPMSet(i64 %0, i64 %1, i64 %2) {
%4 = add i64 %0, 20
%5 = shl i64 %1, 4
%6 = add i64 %4, %5
%7 = inttoptr i64 %6 to i64*
store volatile i64 %2, i64* %7
ret void
}
unsigned int call_unlink(unsigned int descriptor) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @call_unlink(i32 %0) {
ret i32 0
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
int /*<<< orphan*/ stat(char const *, struct stat *);
int GetFileSize(const char *fname) {
  struct stat s;
  stat(fname, &s);
  return s.st_size;
}


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

x86 assembly (clang, -O2):
<GetFileSize>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @GetFileSize(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @stat(i8* %4, %struct.stat* %3)
%6 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @GetFileSize(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%6 = load i32, i32* %5
ret i32 %6
}
/* Variables and functions */
scalar_t__ sfd_islower(char const);
scalar_t__ sfd_isupper(char const);
int sfd_isalpha(const char c) { return (sfd_islower(c) || sfd_isupper(c)); }


x86 assembly (clang, -O0):
<sfd_isalpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <sfd_islower@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    115c <sfd_isalpha+0x3c>
movsbl -0x1(%rbp),%edi
call   1030 <sfd_isupper@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sfd_isalpha>:
push   %rbx
mov    %edi,%ebx
call   1040 <sfd_islower@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <sfd_isalpha+0x17>
pop    %rbx
ret
movsbl %bl,%edi
call   1030 <sfd_isupper@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sfd_isalpha(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @sfd_islower(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @sfd_isupper(i8 signext %7)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @sfd_isalpha(i8 signext %0) {
%2 = tail call i64 @sfd_islower(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @sfd_isupper(i8 signext %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *, char *, int /*<<< orphan*/);
void int_06(void) { panic("Invalid Opcode", "#UD", 0); }


x86 assembly (clang, -O0):
<int_06>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeed(%rip),%rsi
xor    %edx,%edx
call   1030 <panic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_06>:
lea    0xee9(%rip),%rdi
lea    0xef1(%rip),%rsi
xor    %edx,%edx
jmp    1030 <panic@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Invalid Opcode\00"
@.str.1 = [4 x i8] c"#UD\00"
define void @int_06() {
%1 = call i32 @panic(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Invalid Opcode\00"
@.str.1 = [4 x i8] c"#UD\00"
define void @int_06() {
%1 = tail call i32 @panic(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}
int test_imm_E2uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xE2 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_E2uint64_highword_mem>:
testb  $0xe2,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_E2uint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 226
%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_E2uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 970662608896
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int delta(int a, int b, int c) { return b * b - 4 * a * c; }


x86 assembly (clang, -O0):
<delta>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
imul   -0xc(%rbp),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<delta>:
mov    %esi,%eax
imul   %esi,%eax
imul   %edx,%edi
shl    $0x2,%edi
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @delta(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %5
%9 = mul nsw i32 %7, %8
%10 = load i32, i32* %4
%11 = mul nsw i32 4, %10
%12 = load i32, i32* %6
%13 = mul nsw i32 %11, %12
%14 = sub nsw i32 %9, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @delta(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %1, %1
%5 = mul i32 %0, -4
%6 = mul i32 %5, %2
%7 = add i32 %6, %4
ret i32 %7
}
/* Variables and functions */
size_t b64_decodedLength(size_t length) { return length * 3 / 4; }


x86 assembly (clang, -O0):
<b64_decodedLength>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
imul   $0x3,-0x8(%rbp),%rax
shr    $0x2,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b64_decodedLength>:
lea    (%rdi,%rdi,2),%rax
shr    $0x2,%rax
ret

LLVM IR (-O0):
define i64 @b64_decodedLength(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul i64 %3, 3
%5 = udiv i64 %4, 4
ret i64 %5
}

LLVM IR (-O2):
define i64 @b64_decodedLength(i64 %0) {
%2 = mul i64 %0, 3
%3 = lshr i64 %2, 2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ lseek(int, long, int /*<<< orphan*/);
void File_rewind(int fd) { lseek(fd, 0L, SEEK_SET); }


x86 assembly (clang, -O0):
<File_rewind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <lseek@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<File_rewind>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
jmp    1030 <lseek@plt>

LLVM IR (-O0):
@SEEK_SET = global i32 0
define void @File_rewind(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SEEK_SET
%5 = call i32 @lseek(i32 %3, i64 0, i32 %4)
ret void
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define void @File_rewind(i32 %0) {
%2 = load i32, i32* @SEEK_SET
%3 = tail call i32 @lseek(i32 %0, i64 0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_2d(int n) {
  if (n < 10) {
    printf(" %d", n);
  } else {
    printf("%d", n);
  }
}


x86 assembly (clang, -O0):
<print_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1139 <print_2d+0x29>
mov    -0x4(%rbp),%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
jmp    1148 <print_2d+0x38>
mov    -0x4(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_2d>:
mov    %edi,%esi
cmp    $0xa,%edi
lea    0xee4(%rip),%rax
lea    0xede(%rip),%rdi
cmovl  %rax,%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
@.str.1 = [3 x i8] c"%d\00"
define void @print_2d(i32 %0) {
%2 = icmp slt i32 %0, 10
%3 = select i1 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* %3, i32 %0)
ret void
}
/* Variables and functions */
double *memalign(int, size_t);
int /*<<< orphan*/ memset(double *, int /*<<< orphan*/, size_t);
double *zeros(size_t n) {
  double *buf;
  buf = memalign(4096, n * sizeof(double));
  memset(buf, 0, n * sizeof(double));
  return buf;
}


x86 assembly (clang, -O0):
<zeros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
shl    $0x3,%rsi
mov    $0x1000,%edi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
shl    $0x3,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zeros>:
push   %r14
push   %rbx
push   %rax
lea    0x0(,%rdi,8),%r14
mov    $0x1000,%edi
mov    %r14,%rsi
call   1040 <memalign@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double* @zeros(i64 %0) {
%2 = alloca i64
%3 = alloca double*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = mul i64 %4, 8
%6 = call double* @memalign(i32 4096, i64 %5)
store double* %6, double** %3
%7 = load double*, double** %3
%8 = load i64, i64* %2
%9 = mul i64 %8, 8
%10 = call i32 @memset(double* %7, i32 0, i64 %9)
%11 = load double*, double** %3
ret double* %11
}

LLVM IR (-O2):
define double* @zeros(i64 %0) {
%2 = shl i64 %0, 3
%3 = tail call double* @memalign(i32 4096, i64 %2)
%4 = tail call i32 @memset(double* %3, i32 0, i64 %2)
ret double* %3
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned short red;
};
typedef TYPE_1__ XColor;

/* Variables and functions */
void set_XColor_red(void *_p, unsigned short _v) {
  ((XColor *)_p)->red = (unsigned short)_v;
}


x86 assembly (clang, -O0):
<set_XColor_red>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XColor_red>:
mov    %si,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i16 }
define void @set_XColor_red(i8* %0, i16 zeroext %1) {
%3 = alloca i8*
%4 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
%5 = load i16, i16* %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 i16 %5, i16* %8
ret void
}

LLVM IR (-O2):
define void @set_XColor_red(i8* nocapture writeonly %0, i16 zeroext %1) {
%3 = bitcast i8* %0 to i16*
store i16 %1, i16* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void init_pic() {
  outb(0x20, 0x11);
  outb(0xA0, 0x11);
  outb(0x21, 0xE0);
  outb(0xA1, 0xE8);
  outb(0x21, 0x04);
  outb(0xA1, 0x02);
  outb(0x21, 0x01);
  outb(0xA1, 0x01);
  outb(0x21, 0xFF);
  outb(0xA1, 0xFF);
}


x86 assembly (clang, -O0):
<init_pic>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0xe0,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0xe8,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0xff,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
call   1030 <outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_pic>:
push   %rax
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0xe0,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0xe8,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0xff,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
pop    %rax
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @init_pic() {
%1 = call i32 @outb(i32 32, i32 17)
%2 = call i32 @outb(i32 160, i32 17)
%3 = call i32 @outb(i32 33, i32 224)
%4 = call i32 @outb(i32 161, i32 232)
%5 = call i32 @outb(i32 33, i32 4)
%6 = call i32 @outb(i32 161, i32 2)
%7 = call i32 @outb(i32 33, i32 1)
%8 = call i32 @outb(i32 161, i32 1)
%9 = call i32 @outb(i32 33, i32 255)
%10 = call i32 @outb(i32 161, i32 255)
ret void
}

LLVM IR (-O2):
define void @init_pic() {
%1 = tail call i32 @outb(i32 32, i32 17)
%2 = tail call i32 @outb(i32 160, i32 17)
%3 = tail call i32 @outb(i32 33, i32 224)
%4 = tail call i32 @outb(i32 161, i32 232)
%5 = tail call i32 @outb(i32 33, i32 4)
%6 = tail call i32 @outb(i32 161, i32 2)
%7 = tail call i32 @outb(i32 33, i32 1)
%8 = tail call i32 @outb(i32 161, i32 1)
%9 = tail call i32 @outb(i32 33, i32 255)
%10 = tail call i32 @outb(i32 161, i32 255)
ret void
}
/* Variables and functions */
int getnpar(int /*<<< orphan*/, char *, char *, unsigned long *);
int getparulong(char *name, unsigned long *ptr) {
  return getnpar(0, name, "v", ptr);
}


x86 assembly (clang, -O0):
<getparulong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rcx
xor    %edi,%edi
lea    0xecf(%rip),%rdx
call   1030 <getnpar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getparulong>:
mov    %rsi,%rcx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdx
xor    %edi,%edi
jmp    1030 <getnpar@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"v\00"
define i32 @getparulong(i8* %0, i64* %1) {
%3 = tail call i32 @getnpar(i32 0, i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %1)
ret i32 %3
}
int and (void) { return a() && b() && c(); }


x86 assembly (clang, -O0):
<and>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <a@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1(%rbp)
je     1176 <and+0x46>
mov    $0x0,%al
call   1030 <b@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1(%rbp)
je     1176 <and+0x46>
mov    $0x0,%al
call   1040 <c@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<and>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <a@plt>
test   %eax,%eax
je     1159 <and+0x29>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <b@plt>
test   %eax,%eax
je     1159 <and+0x29>
xor    %eax,%eax
call   1040 <c@plt>
xor    %ebx,%ebx
test   %eax,%eax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @and() {
%1 = call i32 (...) @a()
%2 = icmp ne i32 %1, 0
br i1 %2, label %3, label %9
3: ; preds = %0
%4 = call i32 (...) @b()
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = call i32 (...) @c()
%8 = icmp ne i32 %7, 0
br label %9
9: ; preds = %6, %3, %0
%10 = phi i1 [ false, %3 ], [ false, %0 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @and() {
%1 = tail call i32 (...) @a()
%2 = icmp eq i32 %1, 0
br i1 %2, label %10, label %3
3: ; preds = %0
%4 = tail call i32 (...) @b()
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 (...) @c()
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3, %0
%11 = phi i32 [ 0, %3 ], [ 0, %0 ], [ %9, %6 ]
ret i32 %11
}
void ieee80211_proc_init_sta(struct ieee80211_local *local,
                             struct sta_info *sta) {}


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

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

LLVM IR (-O0):
%struct.ieee80211_local = type opaque
%struct.sta_info = type opaque
define void @ieee80211_proc_init_sta(%struct.ieee80211_local* %0, %struct.sta_info* %1) {
%3 = alloca %struct.ieee80211_local*
%4 = alloca %struct.sta_info*
store %struct.ieee80211_local* %0, %struct.ieee80211_local** %3
store %struct.sta_info* %1, %struct.sta_info** %4
ret void
}

LLVM IR (-O2):
%struct.ieee80211_local = type opaque
%struct.sta_info = type opaque
define void @ieee80211_proc_init_sta(%struct.ieee80211_local* nocapture %0, %struct.sta_info* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *argv[]) {
  printf("%s [-f] [-w <sec>] [-k <sec>] [-s] [-h|--help]\n"
         "A simple watchdog deamon that send WDIOC_KEEPALIVE ioctl every some\n"
         "\"heartbeat of keepalives\" seconds.\n"
         "Options:\n"
         "\t-f        start in foreground (background is default)\n"
         "\t-w <sec>  set the watchdog counter to <sec> in seconds\n"
         "\t-k <sec>  set the \"heartbeat of keepalives\" to <sec> in seconds\n"
         "\t-s        safe exit (disable Watchdog) for CTRL-c and kill "
         "-SIGTERM signals\n"
         "\t--help|-h write this help message and exit\n",
         argv[0]);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    (%rdi),%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [457 x i8] c"%s [-f] [-w <sec>] [-k <sec>] [-s] [-h|--help]\0AA simple watchdog deamon that send WDIOC_KEEPALIVE ioctl every some\0A\22heartbeat of keepalives\22 seconds.\0AOptions:\0A\09-f start in foreground (background is default)\0A\09-w <sec> set the watchdog counter to <sec> in seconds\0A\09-k <sec> set the \22heartbeat of keepalives\22 to <sec> in seconds\0A\09-s safe exit (disable Watchdog) for CTRL-c and kill -SIGTERM signals\0A\09--help|-h write this help message and exit\0A\00"
define void @usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([457 x i8], [457 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [457 x i8] c"%s [-f] [-w <sec>] [-k <sec>] [-s] [-h|--help]\0AA simple watchdog deamon that send WDIOC_KEEPALIVE ioctl every some\0A\22heartbeat of keepalives\22 seconds.\0AOptions:\0A\09-f start in foreground (background is default)\0A\09-w <sec> set the watchdog counter to <sec> in seconds\0A\09-k <sec> set the \22heartbeat of keepalives\22 to <sec> in seconds\0A\09-s safe exit (disable Watchdog) for CTRL-c and kill -SIGTERM signals\0A\09--help|-h write this help message and exit\0A\00"
define void @usage(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([457 x i8], [457 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
char rand();
char getRandomChar() { return (char)((rand() % ('Z' - 'A')) + 'A'); }


x86 assembly (clang, -O0):
<getRandomChar>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
movsbl %al,%eax
mov    $0x19,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    %dl,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandomChar>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
movsbl %al,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,8),%ecx
movzwl %cx,%edx
shr    $0xa,%ecx
shr    $0xf,%edx
add    %cl,%dl
movzbl %dl,%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
add    $0x41,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @getRandomChar() {
%1 = call signext i8 (...) @rand()
%2 = sext i8 %1 to i32
%3 = srem i32 %2, 25
%4 = add nsw i32 %3, 65
%5 = trunc i32 %4 to i8
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @getRandomChar() {
%1 = tail call signext i8 (...) @rand()
%2 = srem i8 %1, 25
%3 = add nsw i8 %2, 65
ret i8 %3
}
extern char *get_hello_msg() { return "Hello, world!"; }


x86 assembly (clang, -O0):
<get_hello_msg>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hello_msg>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, world!\00"
define i8* @get_hello_msg() {
ret i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, world!\00"
define i8* @get_hello_msg() {
ret i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0)
}
int jos(int n, int k) {
  int x;
  if (n == 1)
    x = 1;
  else {
    x = (jos(n - 1, k) + k) % n;
    if (x == 0)
      x = n;
  }
  return x;
}


x86 assembly (clang, -O0):
<jos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1134 <jos+0x24>
movl   $0x1,-0xc(%rbp)
jmp    1161 <jos+0x51>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
call   1030 <jos@plt>
add    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    115c <jos+0x4c>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <jos+0x51>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jos>:
mov    $0x1,%eax
cmp    $0x1,%edi
je     113b <jos+0x2b>
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    -0x1(%rbx),%edi
call   1030 <jos@plt>
add    %ebp,%eax
cltd
idiv   %ebx
mov    %edx,%eax
test   %edx,%edx
cmove  %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @jos(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2, %6
%5 = phi i32 [ %12, %6 ], [ 1, %2 ]
ret i32 %5
6: ; preds = %2
%7 = add nsw i32 %0, -1
%8 = tail call i32 @jos(i32 %7, i32 %1)
%9 = add nsw i32 %8, %1
%10 = srem i32 %9, %0
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 %0, i32 %10
br label %4
}
int do_310() { return 310; }


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

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

LLVM IR (-O0):
define i32 @do_310() {
ret i32 310
}

LLVM IR (-O2):
define i32 @do_310() {
ret i32 310
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void throwing_pipe_errors(int fd) {
  if (fd == -1) {
    printf("Unable to open pipe\n");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<throwing_pipe_errors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    114f <throwing_pipe_errors+0x2f>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<throwing_pipe_errors>:
cmp    $0xffffffff,%edi
je     1126 <throwing_pipe_errors+0x6>
ret
push   %rax
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Unable to open pipe\0A\00"
@EXIT_FAILURE = global i32 0
define void @throwing_pipe_errors(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [20 x i8] c"Unable to open pipe\00"
define void @throwing_pipe_errors(i32 %0) {
%2 = icmp eq i32 %0, -1
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
7: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void closeConnection(int sockfd, int newsockfd) {
  close(newsockfd);
  close(sockfd);
}


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

x86 assembly (clang, -O2):
<closeConnection>:
push   %rbx
mov    %edi,%ebx
mov    %esi,%edi
call   1030 <close@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <close@plt>

LLVM IR (-O0):
define void @closeConnection(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 = call i32 @close(i32 %5)
%7 = load i32, i32* %3
%8 = call i32 @close(i32 %7)
ret void
}

LLVM IR (-O2):
define void @closeConnection(i32 %0, i32 %1) {
%3 = tail call i32 @close(i32 %1)
%4 = tail call i32 @close(i32 %0)
ret void
}
/* Variables and functions */
void *iconv_open(char const *, char const *);
void *portable_iconv_open(const char *tocode, const char *fromcode) {
  return iconv_open(tocode, fromcode);
}


x86 assembly (clang, -O0):
<portable_iconv_open>:
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 <iconv_open@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<portable_iconv_open>:
jmp    1030 <iconv_open@plt>

LLVM IR (-O0):
define i8* @portable_iconv_open(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 i8* @iconv_open(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @portable_iconv_open(i8* %0, i8* %1) {
%3 = tail call i8* @iconv_open(i8* %0, i8* %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ SetMotor(int, int);
int getJSAnalog(int, int);
void JSToMotor(int joystick, int channel, int motor, int inverse) {
  SetMotor(motor, getJSAnalog(joystick, channel) * (inverse == 0 ? 1 : -1));
}


x86 assembly (clang, -O0):
<JSToMotor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <getJSAnalog@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
mov    -0x10(%rbp),%edx
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
imul   %eax,%esi
call   1030 <SetMotor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<JSToMotor>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%ebp
call   1040 <getJSAnalog@plt>
mov    %eax,%esi
neg    %esi
test   %ebx,%ebx
cmove  %eax,%esi
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <SetMotor@plt>

LLVM IR (-O0):
define void @JSToMotor(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 @getJSAnalog(i32 %10, i32 %11)
%13 = load i32, i32* %8
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 1, i32 -1
%17 = mul nsw i32 %12, %16
%18 = call i32 @SetMotor(i32 %9, i32 %17)
ret void
}

LLVM IR (-O2):
define void @JSToMotor(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @getJSAnalog(i32 %0, i32 %1)
%6 = icmp eq i32 %3, 0
%7 = sub nsw i32 0, %5
%8 = select i1 %6, i32 %5, i32 %7
%9 = tail call i32 @SetMotor(i32 %2, i32 %8)
ret void
}
void glUniform3i(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glUniform3i() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("MBEDTLS_BIGNUM_C and/or "
         "MBEDTLS_PK_PARSE_C and/or MBEDTLS_FS_IO not defined.\n");
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [78 x i8] c"MBEDTLS_BIGNUM_C and/or MBEDTLS_PK_PARSE_C and/or MBEDTLS_FS_IO not defined.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [77 x i8] c"MBEDTLS_BIGNUM_C and/or MBEDTLS_PK_PARSE_C and/or MBEDTLS_FS_IO not defined.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fibonacci();
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main() {
  for (int i = 0; i < 50; i++)
    printf("%lli\n", fibonacci());
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jge    1163 <main+0x43>
mov    $0x0,%al
call   1040 <fibonacci@plt>
mov    %eax,%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x32,%ebp
lea    0xed1(%rip),%rbx
nop
xor    %eax,%eax
call   1040 <fibonacci@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    1130 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%lli\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 50
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = call i32 (...) @fibonacci()
%8 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %3
12: ; preds = %3
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [6 x i8] c"%lli\0A\00"
define i32 @main() {
br label %2
1: ; preds = %2
ret i32 0
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %6, %2 ]
%4 = tail call i32 (...) @fibonacci()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = add nuw nsw i32 %3, 1
%7 = icmp eq i32 %6, 50
br i1 %7, label %1, label %2
}
/* Variables and functions */
int /*<<< orphan*/ transfer_samples_to_file(char *);
void phoenix_time_cleanup() { transfer_samples_to_file("sample.csv"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"sample.csv\00"
define void @phoenix_time_cleanup() {
%1 = call i32 @transfer_samples_to_file(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"sample.csv\00"
define void @phoenix_time_cleanup() {
%1 = tail call i32 @transfer_samples_to_file(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
void log_init() {}


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

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

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

LLVM IR (-O2):
define void @log_init() {
ret void
}
/* Variables and functions */
int send_recv(int, int);
int case_one(int fd) { return send_recv(fd, 1); }


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

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

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

LLVM IR (-O2):
define i32 @case_one(i32 %0) {
%2 = tail call i32 @send_recv(i32 %0, i32 1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ THDiskFile_isLittleEndianCPU();
int THDiskFile_isBigEndianCPU(void) {
  return (!THDiskFile_isLittleEndianCPU());
}


x86 assembly (clang, -O0):
<THDiskFile_isBigEndianCPU>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <THDiskFile_isLittleEndianCPU@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<THDiskFile_isBigEndianCPU>:
push   %rax
xor    %eax,%eax
call   1030 <THDiskFile_isLittleEndianCPU@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @THDiskFile_isBigEndianCPU() {
%1 = call i32 (...) @THDiskFile_isLittleEndianCPU()
%2 = icmp ne i32 %1, 0
%3 = xor i1 %2, true
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @THDiskFile_isBigEndianCPU() {
%1 = tail call i32 (...) @THDiskFile_isLittleEndianCPU()
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
void ff_hevc_put_hevc_bi_w_epel_v16_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_w_epel_v16_8_sse4() {
ret void
}
void ExttFWRuleAuxTable(void) {}


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

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

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

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