xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int get_input(char *command) {
  printf(">");
  scanf("%c", command);
  return (1);
}


x86 assembly (clang, -O0):
<get_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xebf(%rip),%rdi
call   1040 <scanf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_input>:
push   %rbx
mov    %rdi,%rbx
mov    $0x3e,%edi
call   1030 <putchar@plt>
lea    0xecb(%rip),%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
define i32 @get_input(i8* %0) {
%2 = tail call i32 @putchar(i32 62)
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ IFF_UP;
int /*<<< orphan*/ LOG_INFO;
int modify_flags(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char *);
int ifdown(char *dev) {
  syslog(LOG_INFO, "Stopping device %s", dev);
  return (modify_flags(dev, 0, IFF_UP));
}


x86 assembly (clang, -O0):
<ifdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <syslog@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <modify_flags@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifdown>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
mov    %rbx,%rdx
call   1040 <syslog@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1030 <modify_flags@plt>

LLVM IR (-O0):
@LOG_INFO = global i32 0
@.str = [19 x i8] c"Stopping device %s\00"
@IFF_UP = global i32 0
define i32 @ifdown(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @LOG_INFO
%4 = load i8*, i8** %2
%5 = call i32 @syslog(i32 %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %2
%7 = load i32, i32* @IFF_UP
%8 = call i32 @modify_flags(i8* %6, i32 0, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@LOG_INFO = global i32 0
@.str = [19 x i8] c"Stopping device %s\00"
@IFF_UP = global i32 0
define i32 @ifdown(i8* %0) {
%2 = load i32, i32* @LOG_INFO
%3 = tail call i32 @syslog(i32 %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @IFF_UP
%5 = tail call i32 @modify_flags(i8* %0, i32 0, i32 %4)
ret i32 %5
}
long SPIDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData) {
  unsigned long ulRegVal;
  ulRegVal = (*((volatile unsigned long *)(ulBase + 0x00000130)));
  if (ulRegVal & 0x00000001) {
    *pulData = (*((volatile unsigned long *)(ulBase + 0x0000013C)));
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<SPIDataGetNonBlocking>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x130(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     114c <SPIDataGetNonBlocking+0x4c>
mov    -0x10(%rbp),%rax
mov    0x13c(%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movq   $0x1,-0x8(%rbp)
jmp    1154 <SPIDataGetNonBlocking+0x54>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SPIDataGetNonBlocking>:
testq  $0x1,0x130(%rdi)
jne    1110 <SPIDataGetNonBlocking+0x10>
xor    %eax,%eax
ret
mov    0x13c(%rdi),%rax
mov    %rax,(%rsi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i64 @SPIDataGetNonBlocking(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64*
%6 = alloca i64
store i64 %0, i64* %4
store i64* %1, i64** %5
%7 = load i64, i64* %4
%8 = add i64 %7, 304
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
store i64 %10, i64* %6
%11 = load i64, i64* %6
%12 = and i64 %11, 1
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i64, i64* %4
%16 = add i64 %15, 316
%17 = inttoptr i64 %16 to i64*
%18 = load volatile i64, i64* %17
%19 = load i64*, i64** %5
store i64 %18, i64* %19
store i64 1, i64* %3
br label %21
20: ; preds = %2
store i64 0, i64* %3
br label %21
21: ; preds = %20, %14
%22 = load i64, i64* %3
ret i64 %22
}

LLVM IR (-O2):
define i64 @SPIDataGetNonBlocking(i64 %0, i64* nocapture writeonly %1) {
%3 = add i64 %0, 304
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = and i64 %5, 1
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = add i64 %0, 316
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
store i64 %11, i64* %1
br label %12
12: ; preds = %2, %8
%13 = phi i64 [ 1, %8 ], [ 0, %2 ]
ret i64 %13
}
/* Variables and functions */
int /*<<< orphan*/ strtoll(char *, int /*<<< orphan*/ *, int);
int main(void) {
  strtoll("10", NULL, 10);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
a(x) {
  int y[994];
  return 3 + x;
}


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3,%eax
add    $0xf10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a>:
lea    0x3(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @a(i32 %0) {
%2 = alloca i32
%3 = alloca [994 x i32]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @a(i32 %0) {
%2 = add nsw i32 %0, 3
ret i32 %2
}
void mdp4_overlay_update_dsi_cmd(struct msm_fb_data_type *mfd) {}


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

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

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

LLVM IR (-O2):
%struct.msm_fb_data_type = type opaque
define void @mdp4_overlay_update_dsi_cmd(%struct.msm_fb_data_type* nocapture %0) {
ret void
}
void init_sub_pixel_color_pt_funcs_c(void) {}


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

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

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

LLVM IR (-O2):
define void @init_sub_pixel_color_pt_funcs_c() {
ret void
}
/* Variables and functions */
size_t align_to(size_t offset, size_t align) {
  return (offset + align - 1) & ~(align - 1);
}


x86 assembly (clang, -O0):
<align_to>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
sub    $0x1,%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align_to>:
lea    (%rdi,%rsi,1),%rax
add    $0xffffffffffffffff,%rax
neg    %rsi
and    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @align_to(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add i64 %5, %6
%8 = sub i64 %7, 1
%9 = load i64, i64* %4
%10 = sub i64 %9, 1
%11 = xor i64 %10, -1
%12 = and i64 %8, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @align_to(i64 %0, i64 %1) {
%3 = add i64 %0, -1
%4 = add i64 %3, %1
%5 = sub i64 0, %1
%6 = and i64 %4, %5
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ writeChar(char);
void writeScreen(char ch, void **buffer) {
  writeChar(ch);
  ((void)buffer);
}


x86 assembly (clang, -O0):
<writeScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <writeChar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeScreen>:
jmp    1030 <writeChar@plt>

LLVM IR (-O0):
define void @writeScreen(i8 signext %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 = call i32 @writeChar(i8 signext %5)
%7 = load i8**, i8*** %4
ret void
}

LLVM IR (-O2):
define void @writeScreen(i8 signext %0, i8** nocapture readnone %1) {
%3 = tail call i32 @writeChar(i8 signext %0)
ret void
}
/* Type definitions */
struct ac_buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _increase_read_index(struct ac_buffer *, int);
void buffer_increase_read_index(struct ac_buffer *buffer, int size) {
  _increase_read_index(buffer, size);
}


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

x86 assembly (clang, -O2):
<buffer_increase_read_index>:
jmp    1030 <_increase_read_index@plt>

LLVM IR (-O0):
%struct.ac_buffer = type { i32 }
define void @buffer_increase_read_index(%struct.ac_buffer* %0, i32 %1) {
%3 = alloca %struct.ac_buffer*
%4 = alloca i32
store %struct.ac_buffer* %0, %struct.ac_buffer** %3
store i32 %1, i32* %4
%5 = load %struct.ac_buffer*, %struct.ac_buffer** %3
%6 = load i32, i32* %4
%7 = call i32 @_increase_read_index(%struct.ac_buffer* %5, i32 %6)
ret void
}

LLVM IR (-O2):
%struct.ac_buffer = type { i32 }
define void @buffer_increase_read_index(%struct.ac_buffer* %0, i32 %1) {
%3 = tail call i32 @_increase_read_index(%struct.ac_buffer* %0, i32 %1)
ret void
}
void gtk_widget_get_modifier_style() {}


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

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

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

LLVM IR (-O2):
define void @gtk_widget_get_modifier_style() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fn_glutMainLoopEvent();
void glutMainLoopEvent() { fn_glutMainLoopEvent(); }


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

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

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

LLVM IR (-O2):
define void @glutMainLoopEvent() {
%1 = tail call i32 (...) @fn_glutMainLoopEvent()
ret void
}
/* Variables and functions */
int sigmoid_activation_function(double);
double derivative_sigmoid_activation_function(double z) {
  return sigmoid_activation_function(z) * (1 - sigmoid_activation_function(z));
}


x86 assembly (clang, -O0):
<derivative_sigmoid_activation_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sigmoid_activation_function@plt>
mov    %eax,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sigmoid_activation_function@plt>
mov    %eax,%edx
mov    -0xc(%rbp),%eax
mov    $0x1,%ecx
sub    %edx,%ecx
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<derivative_sigmoid_activation_function>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
call   1030 <sigmoid_activation_function@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1030 <sigmoid_activation_function@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
imul   %ebx,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @derivative_sigmoid_activation_function(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @sigmoid_activation_function(double %3)
%5 = load double, double* %2
%6 = call i32 @sigmoid_activation_function(double %5)
%7 = sub nsw i32 1, %6
%8 = mul nsw i32 %4, %7
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
define double @derivative_sigmoid_activation_function(double %0) {
%2 = tail call i32 @sigmoid_activation_function(double %0)
%3 = tail call i32 @sigmoid_activation_function(double %0)
%4 = sub nsw i32 1, %3
%5 = mul nsw i32 %4, %2
%6 = sitofp i32 %5 to double
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ adjust_to_framerate();
int /*<<< orphan*/ draw_screen();
void output_screen() {
  draw_screen();
  adjust_to_framerate();
}


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

x86 assembly (clang, -O2):
<output_screen>:
push   %rax
xor    %eax,%eax
call   1030 <draw_screen@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <adjust_to_framerate@plt>

LLVM IR (-O0):
define void @output_screen() {
%1 = call i32 (...) @draw_screen()
%2 = call i32 (...) @adjust_to_framerate()
ret void
}

LLVM IR (-O2):
define void @output_screen() {
%1 = tail call i32 (...) @draw_screen()
%2 = tail call i32 (...) @adjust_to_framerate()
ret void
}
char *strchr(char *str, int ch) {
  for (; *str; str++)
    if (*str == ch)
      return str;
  return (void *)0;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <strchr+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1135 <strchr+0x35>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <strchr+0x53>
jmp    113a <strchr+0x3a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <strchr+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <strchr+0x23>
mov    %rdi,%rax
nopl   0x0(%rax)
movsbl %cl,%ecx
cmp    %esi,%ecx
je     1125 <strchr+0x25>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %12, %10 ], [ %3, %2 ]
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = sext i8 %6 to i32
%9 = icmp eq i32 %8, %1
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %2
%15 = phi i8* [ null, %2 ], [ null, %10 ], [ %7, %5 ]
ret i8* %15
}
int test_imm_F5int64_midword_reg(long long val) {
  return ((val >> 16) & (0xF5 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_F5int64_midword_reg(i64 %0) {
%2 = and i64 %0, 16056320
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
bool nrf51_errata_5(void) { return false; }


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

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

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

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

/* Variables and functions */
char const *_Locale_extract_name(char const *, int *);
char const *_Locale_extract_messages_name(const char *name,
                                          char *buf __attribute__((__unused__)),
                                          struct _Locale_name_hint *hint
                                          __attribute__((__unused__)),
                                          int *__err_code) {
  return _Locale_extract_name(name, __err_code);
}


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

x86 assembly (clang, -O2):
<_Locale_extract_messages_name>:
mov    %rcx,%rsi
jmp    1030 <_Locale_extract_name@plt>

LLVM IR (-O0):
%struct._Locale_name_hint = type { i32 }
define i8* @_Locale_extract_messages_name(i8* %0, i8* %1, %struct._Locale_name_hint* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct._Locale_name_hint*
%8 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store %struct._Locale_name_hint* %2, %struct._Locale_name_hint** %7
store i32* %3, i32** %8
%9 = load i8*, i8** %5
%10 = load i32*, i32** %8
%11 = call i8* @_Locale_extract_name(i8* %9, i32* %10)
ret i8* %11
}

LLVM IR (-O2):
%struct._Locale_name_hint = type { i32 }
define i8* @_Locale_extract_messages_name(i8* %0, i8* nocapture readnone %1, %struct._Locale_name_hint* nocapture readnone %2, i32* %3) {
%5 = tail call i8* @_Locale_extract_name(i8* %0, i32* %3)
ret i8* %5
}
void ff_hevc_put_hevc_bi_w_epel_h32_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_w_epel_h32_8_sse4() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL;

/* Variables and functions */
int custom_ext_1_srv_add_cb(SSL *s, unsigned int ext_type,
                            const unsigned char **out, size_t *outlen, int *al,
                            void *arg) {
  return 0;
}


x86 assembly (clang, -O0):
<custom_ext_1_srv_add_cb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @custom_ext_1_srv_add_cb(i32* %0, i32 %1, i8** %2, i64* %3, i32* %4, i8* %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i64*
%11 = alloca i32*
%12 = alloca i8*
store i32* %0, i32** %7
store i32 %1, i32* %8
store i8** %2, i8*** %9
store i64* %3, i64** %10
store i32* %4, i32** %11
store i8* %5, i8** %12
ret i32 0
}

LLVM IR (-O2):
define i32 @custom_ext_1_srv_add_cb(i32* nocapture readnone %0, i32 %1, i8** nocapture readnone %2, i64* nocapture readnone %3, i32* nocapture readnone %4, i8* nocapture readnone %5) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void ch8_LDR_RPL() { printf("Error: ch8_LDR_RPL not yet implemented\n"); }


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

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

LLVM IR (-O0):
@.str = [40 x i8] c"Error: ch8_LDR_RPL not yet implemented\0A\00"
define void @ch8_LDR_RPL() {
%1 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [39 x i8] c"Error: ch8_LDR_RPL not yet implemented\00"
define void @ch8_LDR_RPL() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *malloc(size_t);
char *memcpy(char *, char const *, size_t);
size_t strnlen(char const *, size_t);
char *strndup(char const *s, size_t n) {
  size_t len = strnlen(s, n);
  char *new = malloc(len + 1);
  if (new == NULL)
    return NULL;
  new[len] = '\0';
  return memcpy(new, s, len);
}


x86 assembly (clang, -O0):
<strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strnlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    117a <strndup+0x4a>
movq   $0x0,-0x8(%rbp)
jmp    119b <strndup+0x6b>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <memcpy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define noalias i8* @strndup(i8* nocapture %0, i64 %1) {
%3 = tail call i64 @strnlen(i8* %0, i64 %1)
%4 = add i64 %3, 1
%5 = tail call i8* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %5, i64 %3
store i8 0, i8* %8
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %5, i8* align 1 %0, i64 %3, i1 false)
br label %9
9: ; preds = %2, %7
ret i8* %5
}
/* Type definitions */
struct rusage {
  int dummy;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ anvil_syslog(int /*<<< orphan*/, char *);
int /*<<< orphan*/ wait4(int /*<<< orphan*/, int *, int, struct rusage *);
pid_t wait3(int *stat_loc, int options, struct rusage *rusage) {
  anvil_syslog(0, "Calling wait3()\n");
  return wait4(0, stat_loc, options, rusage);
}


x86 assembly (clang, -O0):
<wait3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %edi,%edi
lea    0xec4(%rip),%rsi
call   1030 <anvil_syslog@plt>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
xor    %edi,%edi
call   1040 <wait4@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait3>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xecd(%rip),%rsi
xor    %edi,%edi
call   1030 <anvil_syslog@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <wait4@plt>

LLVM IR (-O0):
%struct.rusage = type { i32 }
@.str = [17 x i8] c"Calling wait3()\0A\00"
define i32 @wait3(i32* %0, i32 %1, %struct.rusage* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca %struct.rusage*
store i32* %0, i32** %4
store i32 %1, i32* %5
store %struct.rusage* %2, %struct.rusage** %6
%7 = call i32 @anvil_syslog(i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = load %struct.rusage*, %struct.rusage** %6
%11 = call i32 @wait4(i32 0, i32* %8, i32 %9, %struct.rusage* %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.rusage = type { i32 }
@.str = [17 x i8] c"Calling wait3()\0A\00"
define i32 @wait3(i32* %0, i32 %1, %struct.rusage* %2) {
%4 = tail call i32 @anvil_syslog(i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @wait4(i32 0, i32* %0, i32 %1, %struct.rusage* %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int,
                           char const *, char const *);
int /*<<< orphan*/ stderr;
int fn_error(const char *m, const char *f, const char *fn, int l) {
  fprintf(stderr, "libagl error in %s:%d:(%s): %s\n", f, l, fn, m);
  return 1;
}


x86 assembly (clang, -O0):
<fn_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x8(%rbp),%r9
lea    0xeba(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_error>:
push   %rax
mov    %rdx,%r8
mov    %rsi,%rdx
mov    %rdi,%r9
mov    0x2ebf(%rip),%rax
mov    (%rax),%edi
lea    0xed6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"libagl error in %s:%d:(%s): %s\0A\00"
define i32 @fn_error(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %6
%11 = load i32, i32* %8
%12 = load i8*, i8** %7
%13 = load i8*, i8** %5
%14 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11, i8* %12, i8* %13)
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"libagl error in %s:%d:(%s): %s\0A\00"
define i32 @fn_error(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %3, i8* %2, i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *random_bytes(int);
char random_char() {
  void *ptr = random_bytes(sizeof(char));
  char out = *(char *)ptr;
  free(ptr);
  return out;
}


x86 assembly (clang, -O0):
<random_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1040 <random_bytes@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movsbl -0x9(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_char>:
push   %rbx
mov    $0x1,%edi
call   1040 <random_bytes@plt>
mov    (%rax),%bl
mov    %rax,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @random_char() {
%1 = alloca i8*
%2 = alloca i8
%3 = call i8* @random_bytes(i32 1)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = load i8, i8* %4
store i8 %5, i8* %2
%6 = load i8*, i8** %1
%7 = call i32 @free(i8* %6)
%8 = load i8, i8* %2
ret i8 %8
}

LLVM IR (-O2):
define signext i8 @random_char() {
%1 = tail call i8* @random_bytes(i32 1)
%2 = load i8, i8* %1
%3 = tail call i32 @free(i8* %1)
ret i8 %2
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ x;
};
struct TYPE_4__ {
  TYPE_1__ max_aspect;
};
typedef TYPE_2__ XSizeHints;

/* Variables and functions */
int get_XSizeHints_max_aspect_x(void *_p) {
  return (int)((XSizeHints *)_p)->max_aspect.x;
}


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

x86 assembly (clang, -O2):
<get_XSizeHints_max_aspect_x>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i32 @get_XSizeHints_max_aspect_x(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_XSizeHints_max_aspect_x(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
const char *__malidrv_build_info(void) {
  return "malidrv:  API_VERSION=401 REPO_URL= REVISION= CHANGED_REVISION= "
         "CHANGE_DATE= BUILD_DATE=Wed Sep 17 21:19:25 IST 2014 BUILD=debug "
         "TARGET_PLATFORM= MALI_PLATFORM= KDIR= "
         "OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP= USING_PROFILING= "
         "USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 "
         "USING_POWER_PERFORMANCE_POLICY= MALI_UPPER_HALF_SCHEDULING=1";
}


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

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

LLVM IR (-O0):
@.str = [344 x i8] c"malidrv: API_VERSION=401 REPO_URL= REVISION= CHANGED_REVISION= CHANGE_DATE= BUILD_DATE=Wed Sep 17 21:19:25 IST 2014 BUILD=debug TARGET_PLATFORM= MALI_PLATFORM= KDIR= OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP= USING_PROFILING= USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 USING_POWER_PERFORMANCE_POLICY= MALI_UPPER_HALF_SCHEDULING=1\00"
define i8* @__malidrv_build_info() {
ret i8* getelementptr inbounds ([344 x i8], [344 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [344 x i8] c"malidrv: API_VERSION=401 REPO_URL= REVISION= CHANGED_REVISION= CHANGE_DATE= BUILD_DATE=Wed Sep 17 21:19:25 IST 2014 BUILD=debug TARGET_PLATFORM= MALI_PLATFORM= KDIR= OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP= USING_PROFILING= USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 USING_POWER_PERFORMANCE_POLICY= MALI_UPPER_HALF_SCHEDULING=1\00"
define i8* @__malidrv_build_info() {
ret i8* getelementptr inbounds ([344 x i8], [344 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __chdir(const char *path) {
  if (path == NULL) {
    __set_errno(EINVAL);
    return -1;
  }
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__chdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1141 <__chdir+0x31>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1156 <__chdir+0x46>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__chdir>:
push   %rax
test   %rdi,%rdi
jne    111f <__chdir+0xf>
mov    0x2ebb(%rip),%rax
jmp    1126 <__chdir+0x16>
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EINVAL = global i32 0
@ENOSYS = global i32 0
define i32 @__chdir(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @EINVAL
%8 = call i32 @__set_errno(i32 %7)
store i32 -1, i32* %2
br label %12
9: ; preds = %1
%10 = load i32, i32* @ENOSYS
%11 = call i32 @__set_errno(i32 %10)
store i32 -1, i32* %2
br label %12
12: ; preds = %9, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@EINVAL = global i32 0
@ENOSYS = global i32 0
define i32 @__chdir(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = load i32, i32* @EINVAL
%4 = load i32, i32* @ENOSYS
%5 = select i1 %2, i32 %3, i32 %4
%6 = tail call i32 @__set_errno(i32 %5)
ret i32 -1
}
int mylib1_fct1(void) {
  printf("%s\n", __FUNCTION__);
  mylib2_fct1();
  return 0;
}


x86 assembly (clang, -O0):
<mylib1_fct1>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed2(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <mylib2_fct1@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@__FUNCTION__.mylib1_fct1 = [12 x i8] c"mylib1_fct1\00"
define i32 @mylib1_fct1() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__FUNCTION__.mylib1_fct1, i64 0, i64 0))
%2 = call i32 (...) @mylib2_fct1()
ret i32 0
}

LLVM IR (-O2):
@__FUNCTION__.mylib1_fct1 = [12 x i8] c"mylib1_fct1\00"
define i32 @mylib1_fct1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @__FUNCTION__.mylib1_fct1, i64 0, i64 0))
%2 = tail call i32 (...) @mylib2_fct1()
ret i32 0
}
unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl) {
  unsigned int sum;
  __asm__ __volatile__("movl (%1), %0\n"
                       "subl $4, %2\n"
                       "jbe 2f\n"
                       "addl 4(%1), %0\n"
                       "adcl 8(%1), %0\n"
                       "adcl 12(%1), %0\n"
                       "1:	     adcl 16(%1), %0\n"
                       "lea 4(%1), %1\n"
                       "decl %2\n"
                       "jne	1b\n"
                       "adcl $0, %0\n"
                       "movl %0, %2\n"
                       "shrl $16, %0\n"
                       "addw %w2, %w0\n"
                       "adcl $0, %0\n"
                       "notl %0\n"
                       "2:\n"
                       : "=r"(sum), "=r"(iph), "=r"(ihl)
                       : "1"(iph), "2"(ihl));
  return (sum);
}


x86 assembly (clang, -O0):
<ip_fast_csum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%eax
mov    (%rcx),%edx
sub    $0x4,%eax
jbe    1145 <ip_fast_csum+0x45>
add    0x4(%rcx),%edx
adc    0x8(%rcx),%edx
adc    0xc(%rcx),%edx
adc    0x10(%rcx),%edx
lea    0x4(%rcx),%rcx
dec    %eax
jne    1126 <ip_fast_csum+0x26>
adc    $0x0,%edx
mov    %edx,%eax
shr    $0x10,%edx
add    %ax,%dx
adc    $0x0,%edx
not    %edx
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip_fast_csum>:
mov    (%rdi),%eax
sub    $0x4,%esi
jbe    112b <ip_fast_csum+0x2b>
add    0x4(%rdi),%eax
adc    0x8(%rdi),%eax
adc    0xc(%rdi),%eax
adc    0x10(%rdi),%eax
lea    0x4(%rdi),%rdi
dec    %esi
jne    1110 <ip_fast_csum+0x10>
adc    $0x0,%eax
mov    %eax,%esi
shr    $0x10,%eax
add    %si,%ax
adc    $0x0,%eax
not    %eax
ret

LLVM IR (-O0):
define zeroext i16 @ip_fast_csum(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call { i32, i8*, i32 } asm sideeffect "movl ($1), $0\0Asubl $$4, $2\0Ajbe 2f\0Aaddl 4($1), $0\0Aadcl 8($1), $0\0Aadcl 12($1), $0\0A1:\09 adcl 16($1), $0\0Alea 4($1), $1\0Adecl $2\0Ajne\091b\0Aadcl $$0, $0\0Amovl $0, $2\0Ashrl $$16, $0\0Aaddw ${2:w}, ${0:w}\0Aadcl $$0, $0\0Anotl $0\0A2:\0A", "=r,=r,=r,1,2,~{dirflag},~{fpsr},~{flags}"(i8* %6, i32 %7)
%9 = extractvalue { i32, i8*, i32 } %8, 0
%10 = extractvalue { i32, i8*, i32 } %8, 1
%11 = extractvalue { i32, i8*, i32 } %8, 2
store i32 %9, i32* %5
store i8* %10, i8** %3
store i32 %11, i32* %4
%12 = load i32, i32* %5
%13 = trunc i32 %12 to i16
ret i16 %13
}

LLVM IR (-O2):
define zeroext i16 @ip_fast_csum(i8* %0, i32 %1) {
%3 = tail call { i32, i8*, i32 } asm sideeffect "movl ($1), $0\0Asubl $$4, $2\0Ajbe 2f\0Aaddl 4($1), $0\0Aadcl 8($1), $0\0Aadcl 12($1), $0\0A1:\09 adcl 16($1), $0\0Alea 4($1), $1\0Adecl $2\0Ajne\091b\0Aadcl $$0, $0\0Amovl $0, $2\0Ashrl $$16, $0\0Aaddw ${2:w}, ${0:w}\0Aadcl $$0, $0\0Anotl $0\0A2:\0A", "=r,=r,=r,1,2,~{dirflag},~{fpsr},~{flags}"(i8* %0, i32 %1)
%4 = extractvalue { i32, i8*, i32 } %3, 0
%5 = trunc i32 %4 to i16
ret i16 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  scanf("%d", &num);
  while (num != 42) {
    printf("%d\n", num);
    scanf("%d", &num);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x2a,-0x8(%rbp)
je     116d <main+0x4d>
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x2a,%esi
je     117c <main+0x5c>
lea    0xeb9(%rip),%r14
lea    0xeaf(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x2a,%esi
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 42
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %10, %6 ], [ %4, %0 ]
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 42
br i1 %11, label %12, label %6
12: ; preds = %6, %0
ret i32 0
}
long GCD(long i, long j) {
  long k;
  while (j != 0) {
    k;
    k = j;
    j = i % j;
    i = k;
  }
  return k;
}


x86 assembly (clang, -O0):
<GCD>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113a <GCD+0x3a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    110c <GCD+0xc>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GCD>:
test   %rsi,%rsi
je     1136 <GCD+0x36>
mov    %rsi,%rdx
mov    %rdi,%rax
jmp    111d <GCD+0x1d>
nopl   (%rax)
cqto
idiv   %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1132 <GCD+0x32>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1110 <GCD+0x10>
xor    %edx,%edx
div    %ecx
jmp    1115 <GCD+0x15>
mov    %rcx,%rax
ret
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @GCD(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %7, %4 ], [ %1, %2 ]
%6 = phi i64 [ %5, %4 ], [ %0, %2 ]
%7 = srem i64 %6, %5
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i64 [ undef, %2 ], [ %5, %4 ]
ret i64 %10
}
/* Type definitions */
struct stack {
  int dummy;
};

/* Variables and functions */
int isEmpty(struct stack *s) {
  if (s == NULL)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isEmpty>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <isEmpty+0x1f>
movl   $0x1,-0x4(%rbp)
jmp    1126 <isEmpty+0x26>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isEmpty>:
xor    %eax,%eax
test   %rdi,%rdi
sete   %al
ret

LLVM IR (-O0):
%struct.stack = type { i32 }
define i32 @isEmpty(%struct.stack* %0) {
%2 = alloca i32
%3 = alloca %struct.stack*
store %struct.stack* %0, %struct.stack** %3
%4 = load %struct.stack*, %struct.stack** %3
%5 = icmp eq %struct.stack* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
%struct.stack = type { i32 }
define i32 @isEmpty(%struct.stack* readnone %0) {
%2 = icmp eq %struct.stack* %0, null
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ do_syscall(char *);
void EE_UnLock(void) { do_syscall("EE_UnLock"); }


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

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"EE_UnLock\00"
define void @EE_UnLock() {
%1 = tail call i32 @do_syscall(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *i8k_get_machine_id();
int /*<<< orphan*/ printf(char *, char *);
int machine_id() {
  char *machine_id;
  if ((machine_id = i8k_get_machine_id()) == NULL) {
    machine_id = "?";
  }
  printf("%s\n", machine_id);
  return 0;
}


x86 assembly (clang, -O0):
<machine_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <i8k_get_machine_id@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    1148 <machine_id+0x28>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<machine_id>:
push   %rax
xor    %eax,%eax
call   1040 <i8k_get_machine_id@plt>
test   %rax,%rax
lea    0xece(%rip),%rsi
cmovne %rax,%rsi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"?\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @machine_id() {
%1 = alloca i8*
%2 = call i8* (...) @i8k_get_machine_id()
store i8* %2, i8** %1
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %5
4: ; preds = %0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %1
br label %5
5: ; preds = %4, %0
%6 = load i8*, i8** %1
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"?\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @machine_id() {
%1 = tail call i8* (...) @i8k_get_machine_id()
%2 = icmp eq i8* %1, null
%3 = select i1 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t load_u16_little(const void *mem) {
  uint16_t ret;
  const uint8_t *x = (const uint8_t *)mem;
  ret = x[0] << 0 | x[1] << 8;
  return ret;
}


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

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

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

LLVM IR (-O2):
define i32 @load_u16_little(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
%8 = or i32 %7, %3
ret i32 %8
}