xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ f1(int /*<<< orphan*/);
scalar_t__ f3(int *);
int test() {
  int i;
  if (f1(0))
    if (f3(&i))
      i = 0;
  return i;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <f1@plt>
cmp    $0x0,%rax
je     1158 <test+0x38>
lea    -0x4(%rbp),%rdi
call   1030 <f3@plt>
cmp    $0x0,%rax
je     1153 <test+0x33>
movl   $0x0,-0x4(%rbp)
jmp    1158 <test+0x38>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
xor    %edi,%edi
call   1040 <f1@plt>
test   %rax,%rax
je     1148 <test+0x28>
lea    0xc(%rsp),%rdi
call   1030 <f3@plt>
test   %rax,%rax
jne    1148 <test+0x28>
mov    0xc(%rsp),%ebx
jmp    1148 <test+0x28>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test() {
%1 = alloca i32
%2 = call i64 @f1(i32 0)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = call i64 @f3(i32* %1)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %4
store i32 0, i32* %1
br label %8
8: ; preds = %7, %4
br label %9
9: ; preds = %8, %0
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @test() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i64 @f1(i32 0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %0
%6 = call i64 @f3(i32* %1)
%7 = icmp eq i64 %6, 0
%8 = load i32, i32* %1
%9 = select i1 %7, i32 %8, i32 0
br label %10
10: ; preds = %5, %0
%11 = phi i32 [ undef, %0 ], [ %9, %5 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ write_port(unsigned short, unsigned short);
void configure_serial_baud_rate(unsigned short com, unsigned short divisor) {
  write_port((com + 3), 0x80);
  write_port((com), divisor >> 8 & 0x00FF);
  write_port((com), divisor & 0x00FF);
}


x86 assembly (clang, -O0):
<configure_serial_baud_rate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x3,%eax
mov    $0x80,%esi
movzwl %ax,%edi
call   1030 <write_port@plt>
mov    -0x2(%rbp),%cx
movzwl -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
movzwl %cx,%edi
movzwl %ax,%esi
call   1030 <write_port@plt>
mov    -0x2(%rbp),%cx
movzwl -0x4(%rbp),%eax
and    $0xff,%eax
movzwl %cx,%edi
movzwl %ax,%esi
call   1030 <write_port@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<configure_serial_baud_rate>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0x3(%rbx),%eax
movzwl %ax,%edi
mov    $0x80,%esi
call   1030 <write_port@plt>
mov    %ebp,%esi
shr    $0x8,%esi
mov    %ebx,%edi
call   1030 <write_port@plt>
movzbl %bpl,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write_port@plt>

LLVM IR (-O0):
define void @configure_serial_baud_rate(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = add nsw i32 %6, 3
%8 = trunc i32 %7 to i16
%9 = call i32 @write_port(i16 zeroext %8, i16 zeroext 128)
%10 = load i16, i16* %3
%11 = load i16, i16* %4
%12 = zext i16 %11 to i32
%13 = ashr i32 %12, 8
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i16
%16 = call i32 @write_port(i16 zeroext %10, i16 zeroext %15)
%17 = load i16, i16* %3
%18 = load i16, i16* %4
%19 = zext i16 %18 to i32
%20 = and i32 %19, 255
%21 = trunc i32 %20 to i16
%22 = call i32 @write_port(i16 zeroext %17, i16 zeroext %21)
ret void
}

LLVM IR (-O2):
define void @configure_serial_baud_rate(i16 zeroext %0, i16 zeroext %1) {
%3 = add i16 %0, 3
%4 = tail call i32 @write_port(i16 zeroext %3, i16 zeroext 128)
%5 = lshr i16 %1, 8
%6 = tail call i32 @write_port(i16 zeroext %0, i16 zeroext %5)
%7 = and i16 %1, 255
%8 = tail call i32 @write_port(i16 zeroext %0, i16 zeroext %7)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ u32_to_le(int /*<<< orphan*/, int /*<<< orphan*/ *);
void float_to_le(float val, uint8_t *buf) {
  union {
    uint32_t u;
    float f;
  } convert;
  convert.f = val;
  u32_to_le(convert.u, buf);
}


x86 assembly (clang, -O0):
<float_to_le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <u32_to_le@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_to_le>:
mov    %rdi,%rsi
movd   %xmm0,%edi
jmp    1030 <u32_to_le@plt>

LLVM IR (-O0):
%union.anon = type { i32 }
define void @float_to_le(float %0, i32* %1) {
%3 = alloca float
%4 = alloca i32*
%5 = alloca %union.anon
store float %0, float* %3
store i32* %1, i32** %4
%6 = load float, float* %3
%7 = bitcast %union.anon* %5 to float*
store float %6, float* %7
%8 = bitcast %union.anon* %5 to i32*
%9 = load i32, i32* %8
%10 = load i32*, i32** %4
%11 = call i32 @u32_to_le(i32 %9, i32* %10)
ret void
}

LLVM IR (-O2):
define void @float_to_le(float %0, i32* %1) {
%3 = bitcast float %0 to i32
%4 = tail call i32 @u32_to_le(i32 %3, i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dcache_push_all();
int /*<<< orphan*/ icache_push_all();
void __flush_cache_all(void) {
  dcache_push_all();
  icache_push_all();
}


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

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

LLVM IR (-O0):
define void @__flush_cache_all() {
%1 = call i32 (...) @dcache_push_all()
%2 = call i32 (...) @icache_push_all()
ret void
}

LLVM IR (-O2):
define void @__flush_cache_all() {
%1 = tail call i32 (...) @dcache_push_all()
%2 = tail call i32 (...) @icache_push_all()
ret void
}
void glLogicOp(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glLogicOp() {
ret void
}
/* Variables and functions */
scalar_t__ FALSE;
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
scalar_t__ has_colors();
int /*<<< orphan*/ init_colors();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ start_color();
void init_color_mode() {
  if (has_colors() == FALSE) {
    endwin();
    puts("Your terminal does not support colors.");
    exit(1);
  } else {
    start_color();
    init_colors();
  }
}


x86 assembly (clang, -O0):
<init_color_mode>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <has_colors@plt>
mov    0x2e6e(%rip),%rcx
cmp    (%rcx),%rax
jne    1198 <init_color_mode+0x38>
mov    $0x0,%al
call   1060 <endwin@plt>
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    $0x0,%al
call   1050 <start_color@plt>
mov    $0x0,%al
call   1080 <init_colors@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_color_mode>:
push   %rax
xor    %eax,%eax
call   1040 <has_colors@plt>
mov    0x2e71(%rip),%rcx
cmp    (%rcx),%rax
je     1183 <init_color_mode+0x23>
xor    %eax,%eax
call   1050 <start_color@plt>
xor    %eax,%eax
pop    %rcx
jmp    1080 <init_colors@plt>
xor    %eax,%eax
call   1060 <endwin@plt>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@FALSE = global i64 0
@.str = [39 x i8] c"Your terminal does not support colors.\00"
define void @init_color_mode() {
%1 = call i64 (...) @has_colors()
%2 = load i64, i64* @FALSE
%3 = icmp eq i64 %1, %2
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = call i32 (...) @endwin()
%6 = call i32 @puts(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = call i32 (...) @start_color()
%10 = call i32 (...) @init_colors()
br label %11
11: ; preds = %8
ret void
}

LLVM IR (-O2):
@FALSE = global i64 0
@.str = [39 x i8] c"Your terminal does not support colors.\00"
define void @init_color_mode() {
%1 = tail call i64 (...) @has_colors()
%2 = load i64, i64* @FALSE
%3 = icmp eq i64 %1, %2
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = tail call i32 (...) @endwin()
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = tail call i32 (...) @start_color()
%10 = tail call i32 (...) @init_colors()
ret void
}
/* Variables and functions */
double pow(double, int);
double funcTest6(double x1, double x2) { return x1 * pow(x2, 3); }


x86 assembly (clang, -O0):
<funcTest6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<funcTest6>:
push   %rax
movsd  %xmm0,(%rsp)
movapd %xmm1,%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @funcTest6(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @pow(double %6, i32 3)
%8 = fmul double %5, %7
ret double %8
}

LLVM IR (-O2):
define double @funcTest6(double %0, double %1) {
%3 = tail call double @pow(double %1, i32 3)
%4 = fmul double %3, %0
ret double %4
}
/* Type definitions */
struct TreeNode {
  int dummy;
};

/* Variables and functions */
int layer(struct TreeNode *);
int /*<<< orphan*/ traverse(struct TreeNode *, int, int, int *);
int findBottomLeftValue(struct TreeNode *root) {
  int l = layer(root);
  int res = 0;
  traverse(root, 1, l, &res);
  return res;
}


x86 assembly (clang, -O0):
<findBottomLeftValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <layer@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x1,%esi
lea    -0x10(%rbp),%rcx
call   1030 <traverse@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findBottomLeftValue>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1040 <layer@plt>
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rcx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1030 <traverse@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.TreeNode = type { i32 }
define i32 @findBottomLeftValue(%struct.TreeNode* %0) {
%2 = alloca %struct.TreeNode*
%3 = alloca i32
%4 = alloca i32
store %struct.TreeNode* %0, %struct.TreeNode** %2
%5 = load %struct.TreeNode*, %struct.TreeNode** %2
%6 = call i32 @layer(%struct.TreeNode* %5)
store i32 %6, i32* %3
store i32 0, i32* %4
%7 = load %struct.TreeNode*, %struct.TreeNode** %2
%8 = load i32, i32* %3
%9 = call i32 @traverse(%struct.TreeNode* %7, i32 1, i32 %8, i32* %4)
%10 = load i32, i32* %4
ret i32 %10
}

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
define i32 @findBottomLeftValue(%struct.TreeNode* %0) {
%2 = alloca i32
%3 = tail call i32 @layer(%struct.TreeNode* %0)
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @traverse(%struct.TreeNode* %0, i32 1, i32 %3, i32* %2)
%6 = load i32, i32* %2
ret i32 %6
}
int main() { return (int)3.0; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 3
}
int ti_cvi_start(double const *options) {
  const int n = (int)options[0];
  return n * 2 - 1;
}


x86 assembly (clang, -O0):
<ti_cvi_start>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cvttsd2si (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ti_cvi_start>:
cvttsd2si (%rdi),%eax
add    %eax,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @ti_cvi_start(double* %0) {
%2 = alloca double*
%3 = alloca i32
store double* %0, double** %2
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 0
%6 = load double, double* %5
%7 = fptosi double %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 2
%10 = sub nsw i32 %9, 1
ret i32 %10
}

LLVM IR (-O2):
define i32 @ti_cvi_start(double* nocapture %0) {
%2 = load double, double* %0
%3 = fptosi double %2 to i32
%4 = shl nsw i32 %3, 1
%5 = add nsw i32 %4, -1
ret i32 %5
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ background_pixmap;
};
typedef TYPE_1__ XSetWindowAttributes;

/* Variables and functions */
unsigned long get_XSetWindowAttributes_background_pixmap(void *_p) {
  return (unsigned long)((XSetWindowAttributes *)_p)->background_pixmap;
}


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

x86 assembly (clang, -O2):
<get_XSetWindowAttributes_background_pixmap>:
mov    (%rdi),%rax
ret

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

LLVM IR (-O2):
define i64 @get_XSetWindowAttributes_background_pixmap(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
unsigned short int cast_uchar_ushort_fast(unsigned char x) {
  return (unsigned short int)x;
}


x86 assembly (clang, -O0):
<cast_uchar_ushort_fast>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
movzwl %ax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @cast_uchar_ushort_fast(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i16
ret i16 %4
}

LLVM IR (-O2):
define zeroext i16 @cast_uchar_ushort_fast(i8 zeroext %0) {
%2 = zext i8 %0 to i16
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ x_malloc(char *, int, int);
char *x_strdup(char *file, int lineno, char *str) {
  int len;
  char *tmp;
  len = strlen(str);
  tmp = (char *)(x_malloc(file, lineno, len + 1));
  strcpy(tmp, str);
  return tmp;
}


x86 assembly (clang, -O0):
<x_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
call   1050 <x_malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_strdup>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %rdx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edx
mov    %rbp,%rdi
mov    %r14d,%esi
call   1050 <x_malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @x_strdup(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %7
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = add nsw i32 %13, 1
%15 = call i64 @x_malloc(i8* %11, i32 %12, i32 %14)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %8
%17 = load i8*, i8** %8
%18 = load i8*, i8** %6
%19 = call i32 @strcpy(i8* %17, i8* %18)
%20 = load i8*, i8** %8
ret i8* %20
}

LLVM IR (-O2):
define i8* @x_strdup(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %2)
%5 = add nsw i32 %4, 1
%6 = tail call i64 @x_malloc(i8* %0, i32 %1, i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @strcpy(i8* %7, i8* %2)
ret i8* %7
}
int ternary_xor(int a, int b) {
  int m = (1 << a) | (1 << b);
  return a == b ? a : m == 3 ? 2 : m == 5 ? 1 : 0;
}


x86 assembly (clang, -O0):
<ternary_xor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    113c <ternary_xor+0x3c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    116c <ternary_xor+0x6c>
cmpl   $0x3,-0xc(%rbp)
jne    1153 <ternary_xor+0x53>
mov    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    1166 <ternary_xor+0x66>
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x5,%edx
cmove  %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ternary_xor>:
mov    %esi,%ecx
mov    %edi,%eax
mov    $0x1,%edx
shl    %cl,%edx
cmp    %esi,%edi
je     1124 <ternary_xor+0x24>
bts    %eax,%edx
mov    $0x2,%eax
cmp    $0x3,%edx
je     1124 <ternary_xor+0x24>
xor    %eax,%eax
cmp    $0x5,%edx
sete   %al
ret

LLVM IR (-O0):
define i32 @ternary_xor(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = shl i32 1, %6
%8 = load i32, i32* %4
%9 = shl i32 1, %8
%10 = or i32 %7, %9
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = load i32, i32* %3
br label %27
16: ; preds = %2
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 3
br i1 %18, label %19, label %20
19: ; preds = %16
br label %25
20: ; preds = %16
%21 = load i32, i32* %5
%22 = icmp eq i32 %21, 5
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 1, i32 0
br label %25
25: ; preds = %20, %19
%26 = phi i32 [ 2, %19 ], [ %24, %20 ]
br label %27
27: ; preds = %25, %14
%28 = phi i32 [ %15, %14 ], [ %26, %25 ]
ret i32 %28
}

LLVM IR (-O2):
define i32 @ternary_xor(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %0
%4 = shl nuw i32 1, %1
%5 = or i32 %4, %3
%6 = icmp eq i32 %0, %1
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = icmp eq i32 %5, 3
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = icmp eq i32 %5, 5
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %2, %9, %7
%13 = phi i32 [ %11, %9 ], [ 2, %7 ], [ %0, %2 ]
ret i32 %13
}
/* Variables and functions */
int omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int id;
#pragma omp parallel private(id)
  {
    id = omp_get_thread_num();
    printf("%d: Hello World!\n", id);
  }
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [18 x i8] c"%d: Hello World!\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @omp_get_thread_num()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float ar;
  printf("Ar AFA nelkul?\n");
  scanf("%f", &ar);
  printf("Teljes ar: %.2f\n", ar * 1.27);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea2(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xeb2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xea0(%rip),%xmm0
lea    0xea4(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Ar AFA nelkul?\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [17 x i8] c"Teljes ar: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 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), float* %2)
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fmul double %6, 1.270000e+00
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [17 x i8] c"Teljes ar: %.2f\0A\00"
@str = [15 x i8] c"Ar AFA nelkul?\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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), float* %1)
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = fmul double %6, 1.270000e+00
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}
/* Variables and functions */
char toupper(char);
char *strupr(char *s) {
  char *p = s;
  if (s == 0)
    return 0;
  while (*p = toupper(*p))
    p++;
  return s;
}


x86 assembly (clang, -O0):
<strupr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113c <strupr+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    1174 <strupr+0x64>
jmp    1141 <strupr+0x31>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    -0x18(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     116c <strupr+0x5c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1141 <strupr+0x31>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strupr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rdi,%rdi
je     1132 <strupr+0x22>
mov    %r14,%rbx
nop
movsbl (%rbx),%edi
call   1030 <toupper@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
test   %al,%al
jne    1120 <strupr+0x10>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strupr(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %8, %3 ], [ %0, %1 ]
%5 = load i8, i8* %4
%6 = tail call signext i8 @toupper(i8 signext %5)
store i8 %6, i8* %4
%7 = icmp eq i8 %6, 0
%8 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %7, label %9, label %3
9: ; preds = %3, %1
ret i8* %0
}
long syscall(int nr, unsigned long arg0, unsigned long arg1,
             unsigned long arg2) {
  long res;
  asm volatile("syscall"
               : "=a"(res)
               : "a"(nr), "D"(arg0), "S"(arg1), "d"(arg2)
               : "memory", "%rcx", "%r11");
  return res;
}


x86 assembly (clang, -O0):
<syscall>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
syscall
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscall>:
mov    %edi,%eax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
syscall
ret

LLVM IR (-O0):
define i64 @syscall(i32 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i32 %0, i32* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%10 = load i32, i32* %5
%11 = load i64, i64* %6
%12 = load i64, i64* %7
%13 = load i64, i64* %8
%14 = call i64 asm sideeffect "syscall", "={ax},{ax},{di},{si},{dx},~{memory},~{rcx},~{r11},~{dirflag},~{fpsr},~{flags}"(i32 %10, i64 %11, i64 %12, i64 %13)
store i64 %14, i64* %9
%15 = load i64, i64* %9
ret i64 %15
}

LLVM IR (-O2):
define i64 @syscall(i32 %0, i64 %1, i64 %2, i64 %3) {
%5 = tail call i64 asm sideeffect "syscall", "={ax},{ax},{di},{si},{dx},~{memory},~{rcx},~{r11},~{dirflag},~{fpsr},~{flags}"(i32 %0, i64 %1, i64 %2, i64 %3)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(void) {
  int valor1, valor2, suma;
  valor1 = 50;
  valor2 = 25;
  suma = valor1 + valor2;
  printf("La suma de %i y %i es %i\n", valor1, valor2, suma);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"La suma de %i y %i es %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 50, i32* %2
store i32 25, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = add nsw i32 %5, %6
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"La suma de %i y %i es %i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 50, i32 25, i32 75)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_MAKE_RADIO_FIFO_OUTPUT() { set_io_bit(-3, 6); }


x86 assembly (clang, -O0):
<TOSH_MAKE_RADIO_FIFO_OUTPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffd,%edi
mov    $0x6,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_RADIO_FIFO_OUTPUT>:
mov    $0xfffffffd,%edi
mov    $0x6,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_RADIO_FIFO_OUTPUT() {
%1 = call i32 @set_io_bit(i32 -3, i32 6)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_RADIO_FIFO_OUTPUT() {
%1 = tail call i32 @set_io_bit(i32 -3, i32 6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int fcntl(int /*<<< orphan*/, int /*<<< orphan*/, int);
void nonblocking_fd0(int signum) {
  int flags;
  if ((flags = fcntl(0, F_GETFL, 0)) >= 0) {
    flags |= O_NONBLOCK;
    (void)fcntl(0, F_SETFL, flags);
  }
}


x86 assembly (clang, -O0):
<nonblocking_fd0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
mov    %edx,%edi
call   1030 <fcntl@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jl     115b <nonblocking_fd0+0x4b>
mov    0x2ea8(%rip),%rax
mov    (%rax),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
xor    %edi,%edi
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nonblocking_fd0>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
xor    %edx,%edx
call   1030 <fcntl@plt>
test   %eax,%eax
js     1143 <nonblocking_fd0+0x33>
mov    0x2eba(%rip),%rcx
or     (%rcx),%eax
mov    0x2ea1(%rip),%rcx
mov    (%rcx),%esi
xor    %edi,%edi
mov    %eax,%edx
pop    %rax
jmp    1030 <fcntl@plt>
pop    %rax
ret

LLVM IR (-O0):
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
define void @nonblocking_fd0(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @F_GETFL
%5 = call i32 @fcntl(i32 0, i32 %4, i32 0)
store i32 %5, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load i32, i32* @O_NONBLOCK
%9 = load i32, i32* %3
%10 = or i32 %9, %8
store i32 %10, i32* %3
%11 = load i32, i32* @F_SETFL
%12 = load i32, i32* %3
%13 = call i32 @fcntl(i32 0, i32 %11, i32 %12)
br label %14
14: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
define void @nonblocking_fd0(i32 %0) {
%2 = load i32, i32* @F_GETFL
%3 = tail call i32 @fcntl(i32 0, i32 %2, i32 0)
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* @O_NONBLOCK
%7 = or i32 %6, %3
%8 = load i32, i32* @F_SETFL
%9 = tail call i32 @fcntl(i32 0, i32 %8, i32 %7)
br label %10
10: ; preds = %5, %1
ret void
}
void _cpu_halt() { __asm__("hlt"); }


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

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

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

LLVM IR (-O2):
define void @_cpu_halt() {
tail call void asm sideeffect "hlt", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void abort(void) {
  fprintf(stderr, "abort!\n");
  exit(1);
}


x86 assembly (clang, -O0):
<abort>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<abort>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"abort!\0A\00"
define void @abort() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
char *masm_malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *masm_strdup(char *s) {
  char *new;
  new = masm_malloc(strlen(s) + 1);
  strcpy(new, s);
  return new;
}


x86 assembly (clang, -O0):
<masm_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <masm_malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<masm_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <masm_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @masm_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @masm_malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @masm_strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @masm_malloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
void dummy_proc_1(int a0) { return; }


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

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

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

LLVM IR (-O2):
define void @dummy_proc_1(i32 %0) {
ret void
}
/* Variables and functions */
float atof(int /*<<< orphan*/);
int /*<<< orphan*/ command_GET(char *, int);
float command_FLOAT(char *name, int n) { return atof(command_GET(name, n)); }


x86 assembly (clang, -O0):
<command_FLOAT>:
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   1040 <command_GET@plt>
mov    %eax,%edi
call   1030 <atof@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define float @command_FLOAT(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 i32 @command_GET(i8* %5, i32 %6)
%8 = call float @atof(i32 %7)
ret float %8
}

LLVM IR (-O2):
define float @command_FLOAT(i8* %0, i32 %1) {
%3 = tail call i32 @command_GET(i8* %0, i32 %1)
%4 = tail call float @atof(i32 %3)
ret float %4
}
void AES_Done() {}


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

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

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

LLVM IR (-O2):
define void @AES_Done() {
ret void
}
long add2(int n, int m) { return n + m; }


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

x86 assembly (clang, -O2):
<add2>:
add    %esi,%edi
movslq %edi,%rax
ret

LLVM IR (-O0):
define i64 @add2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
%8 = sext i32 %7 to i64
ret i64 %8
}

LLVM IR (-O2):
define i64 @add2(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = sext i32 %3 to i64
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void hexdump() { fprintf(stderr, "no hexdump"); }


x86 assembly (clang, -O0):
<hexdump>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexdump>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"no hexdump\00"
define void @hexdump() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"no hexdump\00"
define void @hexdump() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned int bin2bcd(unsigned int val) {
  return (((val / 10) << 4) | (val % 10));
}


x86 assembly (clang, -O0):
<bin2bcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
shl    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    -0x8(%rbp),%eax
or     %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin2bcd>:
mov    %edi,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
mov    %ecx,%eax
shl    $0x4,%eax
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @bin2bcd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = udiv i32 %3, 10
%5 = shl i32 %4, 4
%6 = load i32, i32* %2
%7 = urem i32 %6, 10
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @bin2bcd(i32 %0) {
%2 = udiv i32 %0, 10
%3 = shl i32 %2, 4
%4 = urem i32 %0, 10
%5 = or i32 %3, %4
ret i32 %5
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int do_test() {
  {
    if (strcmp("hello", "hello") != 0)
      return 1;
  };
  return 0;
}


x86 assembly (clang, -O0):
<do_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rsi
mov    %rsi,%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     113d <do_test+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    1144 <do_test+0x34>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_test>:
push   %rax
lea    0xee8(%rip),%rdi
mov    %rdi,%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define i32 @do_test() {
%1 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ init_serial();
int /*<<< orphan*/ printf(char *);
int main() {
  init_serial();
  printf("Test12");
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <init_serial@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
jmp    1142 <main+0x22>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <init_serial@plt>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
jmp    1140 <main+0x20>

LLVM IR (-O0):
@.str = [7 x i8] c"Test12\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @init_serial()
%3 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
br label %4
}

LLVM IR (-O2):
@.str = [7 x i8] c"Test12\00"
define i32 @main() {
%1 = tail call i32 (...) @init_serial()
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
br label %3
}
/* Type definitions */
typedef int /*<<< orphan*/ GLfloat;

/* Variables and functions */
int /*<<< orphan*/ glColor4fv(int /*<<< orphan*/ *);
void Color4fv(GLfloat v[4]) { glColor4fv(v); }


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

x86 assembly (clang, -O2):
<Color4fv>:
jmp    1030 <glColor4fv@plt>

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

LLVM IR (-O2):
define void @Color4fv(i32* %0) {
%2 = tail call i32 @glColor4fv(i32* %0)
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t ui16Good(int a) { return 5; }


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

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

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

LLVM IR (-O2):
define i32 @ui16Good(i32 %0) {
ret i32 5
}
/* Variables and functions */
int /*<<< orphan*/ write_payloadbit(unsigned char);
void write_byte(unsigned char c) {
  int bit;
  for (bit = 7; bit >= 0; bit--)
    write_payloadbit(c >> bit);
}


x86 assembly (clang, -O0):
<write_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x7,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     114e <write_byte+0x3e>
movzbl -0x1(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
movzbl %al,%edi
call   1030 <write_payloadbit@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1125 <write_byte+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_byte>:
push   %rbx
mov    %edi,%ebx
mov    %ebx,%eax
shr    $0x7,%al
movzbl %al,%edi
call   1030 <write_payloadbit@plt>
mov    %ebx,%eax
shr    $0x6,%al
movzbl %al,%edi
call   1030 <write_payloadbit@plt>
mov    %ebx,%eax
shr    $0x5,%al
movzbl %al,%edi
call   1030 <write_payloadbit@plt>
mov    %ebx,%eax
shr    $0x4,%al
movzbl %al,%edi
call   1030 <write_payloadbit@plt>
mov    %ebx,%eax
shr    $0x3,%al
movzbl %al,%edi
call   1030 <write_payloadbit@plt>
mov    %ebx,%eax
shr    $0x2,%al
movzbl %al,%edi
call   1030 <write_payloadbit@plt>
mov    %ebx,%eax
shr    %al
movzbl %al,%edi
call   1030 <write_payloadbit@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <write_payloadbit@plt>

LLVM IR (-O0):
define void @write_byte(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 7, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = load i32, i32* %3
%11 = ashr i32 %9, %10
%12 = trunc i32 %11 to i8
%13 = call i32 @write_payloadbit(i8 zeroext %12)
br label %14
14: ; preds = %7
%15 = load i32, i32* %3
%16 = add nsw i32 %15, -1
store i32 %16, i32* %3
br label %4
17: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @write_byte(i8 zeroext %0) {
%2 = lshr i8 %0, 7
%3 = tail call i32 @write_payloadbit(i8 zeroext %2)
%4 = lshr i8 %0, 6
%5 = tail call i32 @write_payloadbit(i8 zeroext %4)
%6 = lshr i8 %0, 5
%7 = tail call i32 @write_payloadbit(i8 zeroext %6)
%8 = lshr i8 %0, 4
%9 = tail call i32 @write_payloadbit(i8 zeroext %8)
%10 = lshr i8 %0, 3
%11 = tail call i32 @write_payloadbit(i8 zeroext %10)
%12 = lshr i8 %0, 2
%13 = tail call i32 @write_payloadbit(i8 zeroext %12)
%14 = lshr i8 %0, 1
%15 = tail call i32 @write_payloadbit(i8 zeroext %14)
%16 = tail call i32 @write_payloadbit(i8 zeroext %0)
ret void
}
int tolower(int c) { return ((c >= 'A') && (c <= 'Z')) ? (c - 'A' + 'a') : c; }


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x41,-0x4(%rbp)
jl     112c <tolower+0x2c>
cmpl   $0x5a,-0x4(%rbp)
jg     112c <tolower+0x2c>
mov    -0x4(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <tolower+0x32>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
lea    -0x41(%rdi),%ecx
lea    0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @tolower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 65
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 90
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 65
%11 = add nsw i32 %10, 97
br label %14
12: ; preds = %5, %1
%13 = load i32, i32* %2
br label %14
14: ; preds = %12, %8
%15 = phi i32 [ %11, %8 ], [ %13, %12 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}