xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int input = 0;
  printf("Please input an integer: ");
  scanf("%d", &input);
  printf("Input integer plus 12 is: %d\n", input + 12);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
add    $0xc,%esi
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Please input an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"Input integer plus 12 is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 12
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Please input an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"Input integer plus 12 is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 12
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int _reverse(int, int /*<<< orphan*/);
int reverse(int x) { return _reverse(x, 0); }


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

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

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

LLVM IR (-O2):
define i32 @reverse(i32 %0) {
%2 = tail call i32 @_reverse(i32 %0, i32 0)
ret i32 %2
}
void gtk_text_view_starts_display_line() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_view_starts_display_line() {
ret void
}
int register_reboot_notifier(struct notifier_block *dummy) {
  int i;
  { return (i); }
}


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

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

LLVM IR (-O0):
%struct.notifier_block = type opaque
define i32 @register_reboot_notifier(%struct.notifier_block* %0) {
%2 = alloca %struct.notifier_block*
%3 = alloca i32
store %struct.notifier_block* %0, %struct.notifier_block** %2
%4 = load i32, i32* %3
ret i32 %4
}

LLVM IR (-O2):
%struct.notifier_block = type opaque
define i32 @register_reboot_notifier(%struct.notifier_block* nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ mm2pxf(double);
int round(int /*<<< orphan*/);
int mm2pxi(double x) { return round(mm2pxf(x)); }


x86 assembly (clang, -O0):
<mm2pxi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <mm2pxf@plt>
mov    %eax,%edi
call   1040 <round@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm2pxi>:
push   %rax
call   1030 <mm2pxf@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <round@plt>

LLVM IR (-O0):
define i32 @mm2pxi(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @mm2pxf(double %3)
%5 = call i32 @round(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @mm2pxi(double %0) {
%2 = tail call i32 @mm2pxf(double %0)
%3 = tail call i32 @round(i32 %2)
ret i32 %3
}
/* Variables and functions */
scalar_t__ ets_strrchr(char const *, int);
char *strrchr(const char *s, int c) { return (char *)ets_strrchr(s, c); }


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

x86 assembly (clang, -O2):
<strrchr>:
jmp    1030 <ets_strrchr@plt>

LLVM IR (-O0):
define i8* @strrchr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i64 @ets_strrchr(i8* %5, i32 %6)
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define i8* @strrchr(i8* %0, i32 %1) {
%3 = tail call i64 @ets_strrchr(i8* %0, i32 %1)
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ array;

/* Variables and functions */
int /*<<< orphan*/ memset(int *, int, int);
int main() {
  int array[5];
  memset(array, 23, sizeof(array));
  return array[3];
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x17,%esi
mov    $0x14,%edx
call   1030 <memset@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    %rsp,%rdi
mov    $0x17,%esi
mov    $0x14,%edx
call   1030 <memset@plt>
mov    0xc(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%4 = call i32 @memset(i32* %3, i32 23, i32 20)
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 3
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @memset(i32* %3, i32 23, i32 20)
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%6 = load i32, i32* %5
ret i32 %6
}
void enormlz(x) unsigned short x[];
{
  register unsigned short *p;
  p = &x[2];
  while ((*p & 0xff00) == 0) {
    eshup8(x);
  }
}


x86 assembly (clang, -O0):
<enormlz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzwl (%rax),%eax
and    $0xff00,%eax
cmp    $0x0,%eax
jne    114d <enormlz+0x3d>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <eshup8@plt>
jmp    1128 <enormlz+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enormlz>:
push   %rbx
movzwl 0x4(%rdi),%eax
cmp    $0xff,%eax
ja     1135 <enormlz+0x25>
mov    %rdi,%rbx
nop
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <eshup8@plt>
movzwl 0x4(%rbx),%eax
cmp    $0x100,%eax
jb     1120 <enormlz+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @enormlz(i16* %0) {
%2 = alloca i16*
%3 = alloca i16*
store i16* %0, i16** %2
%4 = load i16*, i16** %2
%5 = getelementptr inbounds i16, i16* %4, i64 2
store i16* %5, i16** %3
br label %6
6: ; preds = %12, %1
%7 = load i16*, i16** %3
%8 = load i16, i16* %7
%9 = zext i16 %8 to i32
%10 = and i32 %9, 65280
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = load i16*, i16** %2
%14 = call i32 (i16*, ...) bitcast (i32 (...)* @eshup8 to i32 (i16*, ...)*)(i16* %13)
br label %6
15: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @enormlz(i16* %0) {
%2 = getelementptr inbounds i16, i16* %0, i64 2
%3 = load i16, i16* %2
%4 = icmp ult i16 %3, 256
br i1 %4, label %5, label %9
5: ; preds = %1, %5
%6 = tail call i32 (i16*, ...) bitcast (i32 (...)* @eshup8 to i32 (i16*, ...)*)(i16* %0)
%7 = load i16, i16* %2
%8 = icmp ult i16 %7, 256
br i1 %8, label %5, label %9
9: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ver_up_draw_ver_1_2_22();
void ver_up_game_conf_1_0_15(void) { ver_up_draw_ver_1_2_22(); }


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

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

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

LLVM IR (-O2):
define void @ver_up_game_conf_1_0_15() {
%1 = tail call i32 (...) @ver_up_draw_ver_1_2_22()
ret void
}
/* Variables and functions */
char *quotes_around(char *, char *, char);
char *double_quotes_around(char *destination, char *s) {
  return quotes_around(destination, s, '\"');
}


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

x86 assembly (clang, -O2):
<double_quotes_around>:
mov    $0x22,%edx
jmp    1030 <quotes_around@plt>

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

LLVM IR (-O2):
define i8* @double_quotes_around(i8* %0, i8* %1) {
%3 = tail call i8* @quotes_around(i8* %0, i8* %1, i8 signext 34)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct ns_connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ns_send_mqtt_short_command(struct ns_connection *, int,
                                              int /*<<< orphan*/);
void ns_mqtt_pubcomp(struct ns_connection *nc, uint16_t message_id) {
  ns_send_mqtt_short_command(nc, 7, message_id);
}


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

x86 assembly (clang, -O2):
<ns_mqtt_pubcomp>:
mov    %esi,%edx
mov    $0x7,%esi
jmp    1030 <ns_send_mqtt_short_command@plt>

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

LLVM IR (-O2):
%struct.ns_connection = type { i32 }
define void @ns_mqtt_pubcomp(%struct.ns_connection* %0, i32 %1) {
%3 = tail call i32 @ns_send_mqtt_short_command(%struct.ns_connection* %0, i32 7, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar(int);
int my_outc(int c) {
  ft_putchar(c);
  return (0);
}


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

x86 assembly (clang, -O2):
<my_outc>:
push   %rax
call   1030 <ft_putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @my_outc(i32 %0) {
%2 = tail call i32 @ft_putchar(i32 %0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
uint16_t __le_u16(const void *p) { return *((uint16_t *)(p)); }


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

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

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

LLVM IR (-O2):
define i32 @__le_u16(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
void g_pattern_spec_new() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ copro_mc6809nc_write(int /*<<< orphan*/, int /*<<< orphan*/);
void dbg_memwrite(uint32_t addr, uint32_t value) {
  do {
    copro_mc6809nc_write(addr, value);
  } while (0);
}


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

x86 assembly (clang, -O2):
<dbg_memwrite>:
jmp    1030 <copro_mc6809nc_write@plt>

LLVM IR (-O0):
define void @dbg_memwrite(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %5
5: ; preds = %2
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @copro_mc6809nc_write(i32 %6, i32 %7)
br label %9
9: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @dbg_memwrite(i32 %0, i32 %1) {
%3 = tail call i32 @copro_mc6809nc_write(i32 %0, i32 %1)
ret void
}
unsigned char peek(unsigned int address) { address; }


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

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

LLVM IR (-O0):
define zeroext i8 @peek(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i8, i8* %2
ret i8 %5
}

LLVM IR (-O2):
define zeroext i8 @peek(i32 %0) {
ret i8 undef
}
int f_eq_mm1(float *a1, float *a2) { return (((*a1) == (*a2))); }


x86 assembly (clang, -O0):
<f_eq_mm1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomiss (%rax),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_eq_mm1>:
movss  (%rsi),%xmm0
cmpeqss (%rdi),%xmm0
movd   %xmm0,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @f_eq_mm1(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = load float, float* %5
%7 = load float*, float** %4
%8 = load float, float* %7
%9 = fcmp oeq float %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @f_eq_mm1(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = fcmp oeq float %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ twoDsim_createFunctionEvent(double, unsigned int,
                                               unsigned int);
void create_function_event(double t, unsigned int id, unsigned int param) {
  twoDsim_createFunctionEvent(t, id, param);
}


x86 assembly (clang, -O0):
<create_function_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <twoDsim_createFunctionEvent@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_function_event>:
jmp    1030 <twoDsim_createFunctionEvent@plt>

LLVM IR (-O0):
define void @create_function_event(double %0, i32 %1, i32 %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
store double %0, double* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load double, double* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @twoDsim_createFunctionEvent(double %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @create_function_event(double %0, i32 %1, i32 %2) {
%4 = tail call i32 @twoDsim_createFunctionEvent(double %0, i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void syswarn(const char *msg) { fprintf(stderr, "%s\n", msg); }


x86 assembly (clang, -O0):
<syswarn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syswarn>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @syswarn(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
void *liballoc_memset(void *s, int c, size_t n) {
  unsigned int i;
  for (i = 0; i < n; i++)
    ((char *)s)[i] = (char)c;
  return s;
}


x86 assembly (clang, -O0):
<liballoc_memset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%rax
jae    1140 <liballoc_memset+0x40>
mov    -0xc(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1116 <liballoc_memset+0x16>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<liballoc_memset>:
mov    %rdi,%rax
test   %rdx,%rdx
je     111c <liballoc_memset+0x1c>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
mov    %sil,(%rax,%rcx,1)
add    $0x1,%ecx
cmp    %rdx,%rcx
jb     1110 <liballoc_memset+0x10>
ret

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

LLVM IR (-O2):
define i8* @liballoc_memset(i8* returned writeonly %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %13, label %5
5: ; preds = %3
%6 = trunc i32 %1 to i8
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %11, %7 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 %6, i8* %9
%10 = add nuw nsw i64 %8, 1
%11 = and i64 %10, 4294967295
%12 = icmp ult i64 %11, %2
br i1 %12, label %7, label %13
13: ; preds = %7, %3
ret i8* %0
}
/* Type definitions */
struct psl {
  int dummy;
};

/* Variables and functions */
int pslScore(struct psl const *);
int pslCmpScoreDesc(const void *va, const void *vb) {
  const struct psl *a = *((struct psl **)va);
  const struct psl *b = *((struct psl **)vb);
  return pslScore(b) - pslScore(a);
}


x86 assembly (clang, -O0):
<pslCmpScoreDesc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <pslScore@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <pslScore@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pslCmpScoreDesc>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%rbx
mov    (%rsi),%rdi
call   1030 <pslScore@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <pslScore@plt>
sub    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.psl = type { i32 }
define i32 @pslCmpScoreDesc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.psl*
%6 = alloca %struct.psl*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.psl**
%9 = load %struct.psl*, %struct.psl** %8
store %struct.psl* %9, %struct.psl** %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to %struct.psl**
%12 = load %struct.psl*, %struct.psl** %11
store %struct.psl* %12, %struct.psl** %6
%13 = load %struct.psl*, %struct.psl** %6
%14 = call i32 @pslScore(%struct.psl* %13)
%15 = load %struct.psl*, %struct.psl** %5
%16 = call i32 @pslScore(%struct.psl* %15)
%17 = sub nsw i32 %14, %16
ret i32 %17
}

LLVM IR (-O2):
%struct.psl = type { i32 }
define i32 @pslCmpScoreDesc(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to %struct.psl**
%4 = load %struct.psl*, %struct.psl** %3
%5 = bitcast i8* %1 to %struct.psl**
%6 = load %struct.psl*, %struct.psl** %5
%7 = tail call i32 @pslScore(%struct.psl* %6)
%8 = tail call i32 @pslScore(%struct.psl* %4)
%9 = sub nsw i32 %7, %8
ret i32 %9
}
int is_add_overflow(int a, int b) {
  if (a > 0 && b > 0 && a + b < 0)
    return 1;
  if (a < 0 && b < 0 && a + b > 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_add_overflow>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1139 <is_add_overflow+0x39>
cmpl   $0x0,-0xc(%rbp)
jle    1139 <is_add_overflow+0x39>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x0,%eax
jge    1139 <is_add_overflow+0x39>
movl   $0x1,-0x4(%rbp)
jmp    116f <is_add_overflow+0x6f>
cmpl   $0x0,-0x8(%rbp)
jge    1168 <is_add_overflow+0x68>
cmpl   $0x0,-0xc(%rbp)
jge    1168 <is_add_overflow+0x68>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x0,%eax
jle    1168 <is_add_overflow+0x68>
movl   $0x1,-0x4(%rbp)
jmp    116f <is_add_overflow+0x6f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_add_overflow>:
lea    (%rsi,%rdi,1),%ecx
test   %edi,%edi
jle    1115 <is_add_overflow+0x15>
test   %esi,%esi
jle    1115 <is_add_overflow+0x15>
mov    $0x1,%eax
test   %ecx,%ecx
jns    1115 <is_add_overflow+0x15>
ret
test   %edi,%esi
sets   %al
test   %ecx,%ecx
setg   %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @is_add_overflow(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
%4 = icmp sgt i32 %1, 0
%5 = and i1 %3, %4
%6 = add nsw i32 %1, %0
%7 = icmp slt i32 %6, 0
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %15, label %9
9: ; preds = %2
%10 = and i32 %1, %0
%11 = icmp slt i32 %10, 0
%12 = icmp sgt i32 %6, 0
%13 = select i1 %11, i1 %12, i1 false
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %9, %2
%16 = phi i32 [ 1, %2 ], [ %14, %9 ]
ret i32 %16
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int encoding_ascii(char *encoding) {
  return ((strcmp(encoding, "ASCII") == 0) ||
          (strcmp(encoding, "ISO-8859-1") == 0));
}


x86 assembly (clang, -O0):
<encoding_ascii>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     1158 <encoding_ascii+0x48>
mov    -0x8(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encoding_ascii>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1141 <encoding_ascii+0x31>
lea    0xeda(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"ASCII\00"
@.str.1 = [11 x i8] c"ISO-8859-1\00"
define i32 @encoding_ascii(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq 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):
@.str = [6 x i8] c"ASCII\00"
@.str.1 = [11 x i8] c"ISO-8859-1\00"
define i32 @encoding_ascii(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq 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
}
void gtk_label_set_angle() {}


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

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

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

LLVM IR (-O2):
define void @gtk_label_set_angle() {
ret void
}
extern int verify_area(int type, const void *addr, unsigned long size) {
  return 0;
}


x86 assembly (clang, -O0):
<verify_area>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @verify_area(i32 %0, i8* nocapture readnone %1, i64 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_strbuf_new() {
  printf("NOT IMPLEMENTED:"
         "pa_strbuf_new"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"NOT IMPLEMENTED:pa_strbuf_new\0A\00"
define i32 @pa_strbuf_new() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [30 x i8] c"NOT IMPLEMENTED:pa_strbuf_new\00"
define i32 @pa_strbuf_new() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void xfree(void *ptr) {
  if (ptr)
    free(ptr);
}


x86 assembly (clang, -O0):
<xfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <xfree+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfree>:
test   %rdi,%rdi
je     111a <xfree+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @xfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @xfree(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int read(int /*<<< orphan*/, char *, int);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/,
           int /*<<< orphan*/ *);
int main() {
  fd_set fds;
  int r;
  char buf[100];
  while (1) {
    FD_ZERO(&fds);
    FD_SET(0, &fds);
    r = select(1, &fds, 0, 0, NULL);
    printf("has data input.......\n");
    r = read(0, buf, 99);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <FD_ZERO@plt>
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1070 <FD_SET@plt>
mov    $0x1,%edi
lea    -0x8(%rbp),%rsi
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
mov    %ecx,%edx
call   1060 <select@plt>
mov    %eax,-0xc(%rbp)
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
xor    %edi,%edi
mov    $0x63,%edx
call   1040 <read@plt>
mov    %eax,-0xc(%rbp)
jmp    115f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0xc(%rsp),%rbx
lea    0xe98(%rip),%r14
lea    0x10(%rsp),%r15
nopl   (%rax)
mov    %rbx,%rdi
call   1050 <FD_ZERO@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <FD_SET@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <select@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    %r15,%rsi
mov    $0x63,%edx
call   1040 <read@plt>
jmp    1170 <main+0x20>

LLVM IR (-O0):
@.str = [23 x i8] c"has data input.......\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i8]
store i32 0, i32* %1
br label %5
5: ; preds = %0, %5
%6 = call i32 @FD_ZERO(i32* %2)
%7 = call i32 @FD_SET(i32 0, i32* %2)
%8 = call i32 @select(i32 1, i32* %2, i32 0, i32 0, i32* null)
store i32 %8, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%11 = call i32 @read(i32 0, i8* %10, i32 99)
store i32 %11, i32* %3
br label %5
}

LLVM IR (-O2):
@str = [22 x i8] c"has data input.......\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %5, %0
%6 = call i32 @FD_ZERO(i32* %1)
%7 = call i32 @FD_SET(i32 0, i32* %1)
%8 = call i32 @select(i32 1, i32* %1, i32 0, i32 0, i32* null)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%10 = call i32 @read(i32 0, i8* %4, i32 99)
br label %5
}
/* Type definitions */
typedef void imd_header;

/* Variables and functions */
int ALIGN(int, int);
int imd_read_length(void *);
struct imd_header *imd_next(struct imd_header *imd) {
  int length;
  length = imd_read_length(imd);
  length = ALIGN(length, 4);
  length += 8;
  return (void *)imd + length;
}


x86 assembly (clang, -O0):
<imd_next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <imd_read_length@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x4,%esi
call   1030 <ALIGN@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imd_next>:
push   %rbx
mov    %rdi,%rbx
call   1040 <imd_read_length@plt>
mov    %eax,%edi
mov    $0x4,%esi
call   1030 <ALIGN@plt>
cltq
add    %rbx,%rax
add    $0x8,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.imd_header = type opaque
define %struct.imd_header* @imd_next(%struct.imd_header* %0) {
%2 = alloca %struct.imd_header*
%3 = alloca i32
store %struct.imd_header* %0, %struct.imd_header** %2
%4 = load %struct.imd_header*, %struct.imd_header** %2
%5 = bitcast %struct.imd_header* %4 to i8*
%6 = call i32 @imd_read_length(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @ALIGN(i32 %7, i32 4)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 8
store i32 %10, i32* %3
%11 = load %struct.imd_header*, %struct.imd_header** %2
%12 = bitcast %struct.imd_header* %11 to i8*
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr i8, i8* %12, i64 %14
%16 = bitcast i8* %15 to %struct.imd_header*
ret %struct.imd_header* %16
}

LLVM IR (-O2):
%struct.imd_header = type opaque
define %struct.imd_header* @imd_next(%struct.imd_header* %0) {
%2 = bitcast %struct.imd_header* %0 to i8*
%3 = tail call i32 @imd_read_length(i8* %2)
%4 = tail call i32 @ALIGN(i32 %3, i32 4)
%5 = add nsw i32 %4, 8
%6 = sext i32 %5 to i64
%7 = getelementptr i8, i8* %2, i64 %6
%8 = bitcast i8* %7 to %struct.imd_header*
ret %struct.imd_header* %8
}
/* Variables and functions */
scalar_t__ xxx(int /*<<< orphan*/);
void xxxx(char *buf, short n) {
  short i;
  unsigned char c;
  for (i = 0; i < n; i++) {
    c = (unsigned char)xxx(0);
    buf[i] ^= c;
  }
}


x86 assembly (clang, -O0):
<xxxx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movw   $0x0,-0xc(%rbp)
movswl -0xc(%rbp),%eax
movswl -0xa(%rbp),%ecx
cmp    %ecx,%eax
jge    116a <xxxx+0x5a>
xor    %edi,%edi
call   1030 <xxx@plt>
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%esi
mov    -0x8(%rbp),%rax
movswq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
xor    %esi,%edx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xc(%rbp)
jmp    1129 <xxxx+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xxxx>:
push   %r15
push   %r14
push   %rbx
test   %si,%si
jle    1144 <xxxx+0x34>
mov    %rdi,%r14
movzwl %si,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %edi,%edi
call   1030 <xxx@plt>
xor    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <xxxx+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @xxxx(i8* %0, i16 signext %1) {
%3 = alloca i8*
%4 = alloca i16
%5 = alloca i16
%6 = alloca i8
store i8* %0, i8** %3
store i16 %1, i16* %4
store i16 0, i16* %5
br label %7
7: ; preds = %26, %2
%8 = load i16, i16* %5
%9 = sext i16 %8 to i32
%10 = load i16, i16* %4
%11 = sext i16 %10 to i32
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %29
13: ; preds = %7
%14 = call i64 @xxx(i32 0)
%15 = trunc i64 %14 to i8
store i8 %15, i8* %6
%16 = load i8, i8* %6
%17 = zext i8 %16 to i32
%18 = load i8*, i8** %3
%19 = load i16, i16* %5
%20 = sext i16 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = xor i32 %23, %17
%25 = trunc i32 %24 to i8
store i8 %25, i8* %21
br label %26
26: ; preds = %13
%27 = load i16, i16* %5
%28 = add i16 %27, 1
store i16 %28, i16* %5
br label %7
29: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @xxxx(i8* nocapture %0, i16 signext %1) {
%3 = icmp sgt i16 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = zext i16 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %13, %6 ]
%8 = tail call i64 @xxx(i32 0)
%9 = trunc i64 %8 to i8
%10 = getelementptr inbounds i8, i8* %0, i64 %7
%11 = load i8, i8* %10
%12 = xor i8 %11, %9
store i8 %12, i8* %10
%13 = add nuw nsw i64 %7, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %15, label %6
15: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ close(int);
int creat(char *, int);
int /*<<< orphan*/ dup2(int, int /*<<< orphan*/);
void mkimg() {
  int newfile = creat("image.ppm", 0644);
  dup2(newfile, STDOUT_FILENO);
  close(newfile);
}


x86 assembly (clang, -O0):
<mkimg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x1a4,%esi
call   1050 <creat@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
call   1030 <dup2@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkimg>:
push   %rbx
lea    0xec8(%rip),%rdi
mov    $0x1a4,%esi
call   1050 <creat@plt>
mov    %eax,%ebx
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1030 <dup2@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"image.ppm\00"
@STDOUT_FILENO = global i32 0
define void @mkimg() {
%1 = alloca i32
%2 = call i32 @creat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 420)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = load i32, i32* @STDOUT_FILENO
%5 = call i32 @dup2(i32 %3, i32 %4)
%6 = load i32, i32* %1
%7 = call i32 @close(i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"image.ppm\00"
@STDOUT_FILENO = global i32 0
define void @mkimg() {
%1 = tail call i32 @creat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 420)
%2 = load i32, i32* @STDOUT_FILENO
%3 = tail call i32 @dup2(i32 %1, i32 %2)
%4 = tail call i32 @close(i32 %1)
ret void
}
void cpu_relax(void) { __asm__ __volatile__("rep;nop" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @cpu_relax() {
tail call void asm sideeffect "rep;nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int tpm_open_v03(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @tpm_open_v03() {
ret i32 0
}
/* Variables and functions */
double floor(double);
double fmod(double, double);
double round(double x) {
  double remainder = fmod(x, 1.0);
  x = floor(x);
  if (remainder >= 0.5)
    return x + 1.0;
  else
    return x;
}


x86 assembly (clang, -O0):
<round>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xece(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xea0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1181 <round+0x61>
movsd  0xe96(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    118b <round+0x6b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
movsd  0xece(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <floor@plt>
movsd  0xeb0(%rip),%xmm2
addsd  %xmm0,%xmm2
movsd  0xeac(%rip),%xmm1
cmpnlesd 0x10(%rsp),%xmm1
andpd  %xmm1,%xmm0
andnpd %xmm2,%xmm1
orpd   %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @round(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = call double @fmod(double %5, double 1.000000e+00)
store double %6, double* %4
%7 = load double, double* %3
%8 = call double @llvm.floor.f64(double %7)
store double %8, double* %3
%9 = load double, double* %4
%10 = fcmp oge double %9, 5.000000e-01
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load double, double* %3
%13 = fadd double %12, 1.000000e+00
store double %13, double* %2
br label %16
14: ; preds = %1
%15 = load double, double* %3
store double %15, double* %2
br label %16
16: ; preds = %14, %11
%17 = load double, double* %2
ret double %17
}

LLVM IR (-O2):
define double @round(double %0) {
%2 = tail call double @fmod(double %0, double 1.000000e+00)
%3 = tail call double @llvm.floor.f64(double %0)
%4 = fcmp ult double %2, 5.000000e-01
%5 = fadd double %3, 1.000000e+00
%6 = select i1 %4, double %3, double %5
ret double %6
}
unsigned char hex2Nibble(unsigned char b) {
  b -= '0';
  if (b >= 0 && b < 10) {
  } else {
    if (b >= 'A' - '0' && b <= 'F' - '0') {
      b -= 'A' - '0' - 10;
    } else {
      b = -1;
    }
  }
  return b;
}


x86 assembly (clang, -O0):
<hex2Nibble>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jl     1133 <hex2Nibble+0x33>
movzbl -0x1(%rbp),%eax
cmp    $0xa,%eax
jge    1133 <hex2Nibble+0x33>
jmp    1165 <hex2Nibble+0x65>
movzbl -0x1(%rbp),%eax
cmp    $0x11,%eax
jl     115c <hex2Nibble+0x5c>
movzbl -0x1(%rbp),%eax
cmp    $0x16,%eax
jg     115c <hex2Nibble+0x5c>
movzbl -0x1(%rbp),%eax
sub    $0x7,%eax
mov    %al,-0x1(%rbp)
jmp    1160 <hex2Nibble+0x60>
movb   $0xff,-0x1(%rbp)
jmp    1165 <hex2Nibble+0x65>
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex2Nibble>:
lea    -0x30(%rdi),%eax
lea    -0x41(%rdi),%ecx
add    $0xc9,%dil
cmp    $0x6,%cl
movzbl %dil,%ecx
mov    $0xff,%edx
cmovb  %ecx,%edx
cmp    $0xa,%al
movzbl %al,%eax
cmovae %edx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @hex2Nibble(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = sub nsw i32 %4, 48
%6 = trunc i32 %5 to i8
store i8 %6, i8* %2
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %1
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %15
14: ; preds = %10
br label %30
15: ; preds = %10, %1
%16 = load i8, i8* %2
%17 = zext i8 %16 to i32
%18 = icmp sge i32 %17, 17
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = load i8, i8* %2
%21 = zext i8 %20 to i32
%22 = icmp sle i32 %21, 22
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load i8, i8* %2
%25 = zext i8 %24 to i32
%26 = sub nsw i32 %25, 7
%27 = trunc i32 %26 to i8
store i8 %27, i8* %2
br label %29
28: ; preds = %19, %15
store i8 -1, i8* %2
br label %29
29: ; preds = %28, %23
br label %30
30: ; preds = %29, %14
%31 = load i8, i8* %2
ret i8 %31
}

LLVM IR (-O2):
define zeroext i8 @hex2Nibble(i8 zeroext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = add i8 %0, -65
%5 = icmp ult i8 %4, 6
%6 = add i8 %0, -55
%7 = select i1 %5, i8 %6, i8 -1
%8 = select i1 %3, i8 %2, i8 %7
ret i8 %8
}
unsigned short __bswap_16(unsigned short __bsx) {
  return ((unsigned short)((((__bsx) >> 8) & 255) | (((__bsx)&255) << 8)));
}


x86 assembly (clang, -O0):
<__bswap_16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
movzwl -0x2(%rbp),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__bswap_16>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @__bswap_16(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 8
%6 = and i32 %5, 255
%7 = load i16, i16* %2
%8 = zext i16 %7 to i32
%9 = and i32 %8, 255
%10 = shl i32 %9, 8
%11 = or i32 %6, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define zeroext i16 @__bswap_16(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
void default_node_clean(void *key, void *data) {
  (void)(key);
  (void)(data);
}


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

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

LLVM IR (-O0):
define void @default_node_clean(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
ret void
}

LLVM IR (-O2):
define void @default_node_clean(i8* nocapture %0, i8* nocapture %1) {
ret void
}
void foo(void) {
  static const unsigned short array[] = (const unsigned short[]){0x0F00};
  clang_analyzer_eval(array[0] == 0x0F00);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movzwl 0xee5(%rip),%eax
cmp    $0xf00,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <clang_analyzer_eval@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    $0x1,%edi
xor    %eax,%eax
jmp    1030 <clang_analyzer_eval@plt>

LLVM IR (-O0):
@foo.array = internal constant [1 x i16] [i16 3840]
define void @foo() {
%1 = load i16, i16* getelementptr inbounds ([1 x i16], [1 x i16]* @foo.array, i64 0, i64 0)
%2 = zext i16 %1 to i32
%3 = icmp eq i32 %2, 3840
%4 = zext i1 %3 to i32
%5 = call i32 (i32, ...) bitcast (i32 (...)* @clang_analyzer_eval to i32 (i32, ...)*)(i32 %4)
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @clang_analyzer_eval to i32 (i32, ...)*)(i32 1)
ret void
}
/* Variables and functions */
long lrint(double);
__attribute__((weak)) long int lrintl(long double x) {
  return lrint((double)x);
}


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

x86 assembly (clang, -O2):
<lrintl>:
fldt   0x8(%rsp)
fstpl  -0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
jmp    1030 <lrint@plt>

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

LLVM IR (-O2):
define weak i64 @lrintl(x86_fp80 %0) {
%2 = fptrunc x86_fp80 %0 to double
%3 = tail call i64 @lrint(double %2)
ret i64 %3
}