xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ EINTR;
int close(int);
scalar_t__ errno;
int r_close(int fildes) {
  int retval;
  while (retval = close(fildes), retval == -1 && errno == EINTR)
    ;
  return retval;
}


x86 assembly (clang, -O0):
<r_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jne    114f <r_close+0x3f>
mov    0x2ea4(%rip),%rax
mov    (%rax),%rax
mov    0x2e92(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    115f <r_close+0x4f>
jmp    1164 <r_close+0x54>
jmp    111b <r_close+0xb>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_close>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2ec2(%rip),%r14
mov    0x2eb3(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1030 <close@plt>
cmp    $0xffffffff,%eax
jne    1144 <r_close+0x34>
mov    (%r15),%rcx
cmp    %rcx,(%r14)
je     1130 <r_close+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define i32 @r_close(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %15, %1
%5 = load i32, i32* %2
%6 = call i32 @close(i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = load i64, i64* @errno
%11 = load i64, i64* @EINTR
%12 = icmp eq i64 %10, %11
br label %13
13: ; preds = %9, %4
%14 = phi i1 [ false, %4 ], [ %12, %9 ]
br i1 %14, label %15, label %16
15: ; preds = %13
br label %4
16: ; preds = %13
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i32 @r_close(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @close(i32 %0)
%4 = icmp eq i32 %3, -1
%5 = load i64, i64* @errno
%6 = load i64, i64* @EINTR
%7 = icmp eq i64 %5, %6
%8 = select i1 %4, i1 %7, i1 false
br i1 %8, label %2, label %9
9: ; preds = %2
ret i32 %3
}
float Max(float a, float b) {
  if (a < b)
    return b;
  return a;
}


x86 assembly (clang, -O0):
<Max>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1130 <Max+0x30>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    113a <Max+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Max>:
maxss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @Max(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = load float, float* %5
%8 = fcmp olt float %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load float, float* %5
store float %10, float* %3
br label %13
11: ; preds = %2
%12 = load float, float* %4
store float %12, float* %3
br label %13
13: ; preds = %11, %9
%14 = load float, float* %3
ret float %14
}

LLVM IR (-O2):
define float @Max(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, float %1, float %0
ret float %4
}
void fasttrig_test_arctrig(void) {}


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

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

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

LLVM IR (-O2):
define void @fasttrig_test_arctrig() {
ret void
}
/* Variables and functions */
void *OP1_TYPECAST(void *);
void *OP2_TYPECAST(void *);
void *op_MOD(void *inp1, void *inp2) {
  inp1 = OP1_TYPECAST(inp1);
  inp2 = OP2_TYPECAST(inp2);
  int first = (int)inp1;
  int second = (int)inp2;
  return (void *)(first % second);
}


x86 assembly (clang, -O0):
<op_MOD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <OP1_TYPECAST@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <OP2_TYPECAST@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
movslq %edx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_MOD>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1040 <OP1_TYPECAST@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <OP2_TYPECAST@plt>
mov    %rax,%rcx
mov    %r14d,%eax
cltd
idiv   %ecx
movslq %edx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @op_MOD(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i8* @OP1_TYPECAST(i8* %7)
store i8* %8, i8** %3
%9 = load i8*, i8** %4
%10 = call i8* @OP2_TYPECAST(i8* %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %3
%12 = ptrtoint i8* %11 to i32
store i32 %12, i32* %5
%13 = load i8*, i8** %4
%14 = ptrtoint i8* %13 to i32
store i32 %14, i32* %6
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = srem i32 %15, %16
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i8*
ret i8* %19
}

LLVM IR (-O2):
define i8* @op_MOD(i8* %0, i8* %1) {
%3 = tail call i8* @OP1_TYPECAST(i8* %0)
%4 = tail call i8* @OP2_TYPECAST(i8* %1)
%5 = ptrtoint i8* %3 to i64
%6 = trunc i64 %5 to i32
%7 = ptrtoint i8* %4 to i64
%8 = trunc i64 %7 to i32
%9 = srem i32 %6, %8
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ handle_memerr();
void *malloc(size_t const);
__attribute__((always_)) void *xmalloc(const size_t size) {
  void *ptr = malloc(size);
  if (ptr == ((void *)0))
    handle_memerr();
  return ptr;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <xmalloc+0x2b>
mov    $0x0,%al
call   1040 <handle_memerr@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <xmalloc+0x15>
xor    %eax,%eax
call   1040 <handle_memerr@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @handle_memerr()
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @handle_memerr()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
void gtk_viewport_set_shadow_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_viewport_set_shadow_type() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int volatile);
int main() {
  volatile int i = 0;
  while (i < 200000000) {
    i += 1;
  }
  printf("i: %d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    $0xbebc200,%eax
jge    1142 <main+0x32>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x8(%rbp),%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
mov    0x4(%rsp),%eax
cmp    $0xbebc1ff,%eax
jg     1140 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addl   $0x1,0x4(%rsp)
mov    0x4(%rsp),%eax
cmp    $0xbebc200,%eax
jl     1130 <main+0x20>
mov    0x4(%rsp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"i: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
%3 = load volatile i32, i32* %1
%4 = icmp slt i32 %3, 200000000
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = load volatile i32, i32* %1
%7 = add nsw i32 %6, 1
store volatile i32 %7, i32* %1
%8 = load volatile i32, i32* %1
%9 = icmp slt i32 %8, 200000000
br i1 %9, label %5, label %10
10: ; preds = %5, %0
%11 = load volatile i32, i32* %1
%12 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hal_early_print_printf(char *);
int /*<<< orphan*/ private_hal_cpu_cpu_ipi_init();
int /*<<< orphan*/ private_hal_cpu_cpuinfo_init();
void hal_cpu_init() {
  hal_early_print_printf("Initializing cpu module...\n");
  private_hal_cpu_cpuinfo_init();
  private_hal_cpu_cpu_ipi_init();
  return;
}


x86 assembly (clang, -O0):
<hal_cpu_init>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <hal_early_print_printf@plt>
mov    $0x0,%al
call   1050 <private_hal_cpu_cpuinfo_init@plt>
mov    $0x0,%al
call   1030 <private_hal_cpu_cpu_ipi_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hal_cpu_init>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <hal_early_print_printf@plt>
xor    %eax,%eax
call   1050 <private_hal_cpu_cpuinfo_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <private_hal_cpu_cpu_ipi_init@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Initializing cpu module...\0A\00"
define void @hal_cpu_init() {
%1 = call i32 @hal_early_print_printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @private_hal_cpu_cpuinfo_init()
%3 = call i32 (...) @private_hal_cpu_cpu_ipi_init()
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Initializing cpu module...\0A\00"
define void @hal_cpu_init() {
%1 = tail call i32 @hal_early_print_printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @private_hal_cpu_cpuinfo_init()
%3 = tail call i32 (...) @private_hal_cpu_cpu_ipi_init()
ret void
}
void PushStringArgumentSyntaxMapping(const char *p_value) {}


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

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

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

LLVM IR (-O2):
define void @PushStringArgumentSyntaxMapping(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int getHeight();
int getWidth();
int aboveX(int x) {
  int a = x - getWidth(), min = 0, max = getWidth() * getHeight() - 1;
  return (a >= min && a <= max) ? (a) : (-1);
}


x86 assembly (clang, -O0):
<aboveX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <getWidth@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getWidth@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getHeight@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     118b <aboveX+0x6b>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     118b <aboveX+0x6b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1198 <aboveX+0x78>
mov    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1198 <aboveX+0x78>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aboveX>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getWidth@plt>
sub    %eax,%ebx
xor    %eax,%eax
call   1030 <getWidth@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getHeight@plt>
imul   %ebp,%eax
cmp    %eax,%ebx
mov    $0xffffffff,%eax
cmovl  %ebx,%eax
mov    $0xffffffff,%ecx
test   %ebx,%ebx
cmovs  %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @aboveX(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = call i32 (...) @getWidth()
%8 = sub nsw i32 %6, %7
store i32 %8, i32* %3
store i32 0, i32* %4
%9 = call i32 (...) @getWidth()
%10 = call i32 (...) @getHeight()
%11 = mul nsw i32 %9, %10
%12 = sub nsw i32 %11, 1
store i32 %12, i32* %5
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = icmp sge i32 %13, %14
br i1 %15, label %16, label %22
16: ; preds = %1
%17 = load i32, i32* %3
%18 = load i32, i32* %5
%19 = icmp sle i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load i32, i32* %3
br label %23
22: ; preds = %16, %1
br label %23
23: ; preds = %22, %20
%24 = phi i32 [ %21, %20 ], [ -1, %22 ]
ret i32 %24
}

LLVM IR (-O2):
define i32 @aboveX(i32 %0) {
%2 = tail call i32 (...) @getWidth()
%3 = sub nsw i32 %0, %2
%4 = tail call i32 (...) @getWidth()
%5 = tail call i32 (...) @getHeight()
%6 = icmp sgt i32 %3, -1
%7 = mul nsw i32 %5, %4
%8 = icmp slt i32 %3, %7
%9 = select i1 %6, i1 %8, i1 false
%10 = select i1 %9, i32 %3, i32 -1
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main() {
  puts("Hello World");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
double *get_at(double **matrix, int row, int col) { return &matrix[row][col]; }


x86 assembly (clang, -O0):
<get_at>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x10(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_at>:
movslq %esi,%rcx
movslq %edx,%rax
shl    $0x3,%rax
add    (%rdi,%rcx,8),%rax
ret

LLVM IR (-O0):
define double* @get_at(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 = sext i32 %8 to i64
%10 = getelementptr inbounds double*, double** %7, i64 %9
%11 = load double*, double** %10
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %11, i64 %13
ret double* %14
}

LLVM IR (-O2):
define double* @get_at(double** nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds double*, double** %0, i64 %4
%6 = load double*, double** %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds double, double* %6, i64 %7
ret double* %8
}
/* Variables and functions */
int /*<<< orphan*/ my_put2str(char **);
int do_env(char **envp) {
  my_put2str(envp);
  return (0);
}


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

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

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

LLVM IR (-O2):
define i32 @do_env(i8** %0) {
%2 = tail call i32 @my_put2str(i8** %0)
ret i32 0
}
/* Variables and functions */
int htmly_detect_tag(char *, char *);
int htmly_detect_video(char *line) { return htmly_detect_tag(line, "video"); }


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

x86 assembly (clang, -O2):
<htmly_detect_video>:
lea    0xee9(%rip),%rsi
jmp    1030 <htmly_detect_tag@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"video\00"
define i32 @htmly_detect_video(i8* %0) {
%2 = tail call i32 @htmly_detect_tag(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
__attribute__((__const__)) bool utf8_is_noncharacter(int c) {
  return (c >= 0xFDD0 && c <= 0xFDEF) || ((c & 0xFFFF) == 0xFFFE) ||
         ((c & 0xFFFF) == 0xFFFF);
}


x86 assembly (clang, -O0):
<utf8_is_noncharacter>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xfdd0,-0x4(%rbp)
jl     1126 <utf8_is_noncharacter+0x26>
mov    $0x1,%al
cmpl   $0xfdef,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1153 <utf8_is_noncharacter+0x53>
mov    -0x4(%rbp),%ecx
and    $0xffff,%ecx
mov    $0x1,%al
cmp    $0xfffe,%ecx
mov    %al,-0x5(%rbp)
je     1153 <utf8_is_noncharacter+0x53>
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
cmp    $0xffff,%eax
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_is_noncharacter>:
lea    -0xfdd0(%rdi),%ecx
mov    $0x1,%eax
cmp    $0x20,%ecx
jb     1126 <utf8_is_noncharacter+0x26>
movzwl %di,%ecx
cmp    $0xfffe,%ecx
je     1126 <utf8_is_noncharacter+0x26>
xor    %eax,%eax
cmp    $0xffff,%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @utf8_is_noncharacter(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 64976
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 65007
br i1 %7, label %16, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = and i32 %9, 65535
%11 = icmp eq i32 %10, 65534
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = load i32, i32* %2
%14 = and i32 %13, 65535
%15 = icmp eq i32 %14, 65535
br label %16
16: ; preds = %12, %8, %5
%17 = phi i1 [ true, %8 ], [ true, %5 ], [ %15, %12 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @utf8_is_noncharacter(i32 %0) {
%2 = add i32 %0, -64976
%3 = icmp ult i32 %2, 32
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = and i32 %0, 65535
%6 = icmp eq i32 %5, 65534
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = icmp eq i32 %5, 65535
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %1, %7, %4
%11 = phi i32 [ 1, %4 ], [ %9, %7 ], [ 1, %1 ]
ret i32 %11
}
void I2CMasterEnable(unsigned int baseAdd) {
  (*((volatile unsigned int *)(baseAdd + (0xA4)))) |= (0x00008000u);
}


x86 assembly (clang, -O0):
<I2CMasterEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa4,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     $0x8000,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CMasterEnable>:
add    $0xa4,%edi
orl    $0x8000,(%rdi)
ret

LLVM IR (-O0):
define void @I2CMasterEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 164
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = or i32 %7, 32768
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @I2CMasterEnable(i32 %0) {
%2 = add i32 %0, 164
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = or i32 %5, 32768
store volatile i32 %6, i32* %4
ret void
}
void ruby_re_compile_fastmap(char *fastmap, int options) {
  int j;
  for (j = 0; j < (1 << 8); j++) {
    if (j != '\n' || (options & 4))
      fastmap[j] = 1;
  }
}


x86 assembly (clang, -O0):
<ruby_re_compile_fastmap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x100,-0x10(%rbp)
jge    1157 <ruby_re_compile_fastmap+0x57>
cmpl   $0xa,-0x10(%rbp)
jne    1138 <ruby_re_compile_fastmap+0x38>
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1144 <ruby_re_compile_fastmap+0x44>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
jmp    1149 <ruby_re_compile_fastmap+0x49>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <ruby_re_compile_fastmap+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ruby_re_compile_fastmap>:
xor    %eax,%eax
jmp    1125 <ruby_re_compile_fastmap+0x25>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x1,(%rdi,%rax,1)
movb   $0x1,0x1(%rdi,%rax,1)
add    $0x2,%rax
cmp    $0x100,%rax
je     1133 <ruby_re_compile_fastmap+0x33>
test   $0x4,%sil
jne    1110 <ruby_re_compile_fastmap+0x10>
cmp    $0xa,%rax
je     1114 <ruby_re_compile_fastmap+0x14>
jmp    1110 <ruby_re_compile_fastmap+0x10>
ret

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

LLVM IR (-O2):
define void @ruby_re_compile_fastmap(i8* nocapture writeonly %0, i32 %1) {
%3 = and i32 %1, 4
%4 = icmp eq i32 %3, 0
br label %5
5: ; preds = %11, %2
%6 = phi i64 [ 0, %2 ], [ %14, %11 ]
%7 = icmp eq i64 %6, 10
%8 = and i1 %4, %7
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 1, i8* %10
br label %11
11: ; preds = %9, %5
%12 = or i64 %6, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 1, i8* %13
%14 = add nuw nsw i64 %6, 2
%15 = icmp eq i64 %14, 256
br i1 %15, label %16, label %5
16: ; preds = %11
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(unsigned short);
int main() {
  unsigned short a = 0;
  unsigned b = a + 1;
  f(a + 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x0,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movzwl -0x6(%rbp),%eax
add    $0x1,%eax
movzwl %ax,%edi
call   1030 <f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i32
store i32 0, i32* %1
store i16 0, i16* %2
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = load i16, i16* %2
%8 = zext i16 %7 to i32
%9 = add nsw i32 %8, 1
%10 = trunc i32 %9 to i16
%11 = call i32 @f(i16 zeroext %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i16 zeroext 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ core11_swap(char *, int);
void U_EMRPAINTRGN_swap(char *record, int torev) { core11_swap(record, torev); }


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

x86 assembly (clang, -O2):
<U_EMRPAINTRGN_swap>:
jmp    1030 <core11_swap@plt>

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

LLVM IR (-O2):
define void @U_EMRPAINTRGN_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core11_swap(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
void *memcpy(void *dst, const void *src, register size_t cnt) {}


x86 assembly (clang, -O0):
<memcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define noalias i8* @memcpy(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
ret i8* undef
}
/* Variables and functions */
double powi(double, int);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  double A = 2.0;
  float B = 2.0;
#pragma omp target map(A, B)
  { A = powi(A, 4); }
  printf("%lf\n", A);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  0xebc(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x4,%edi
call   1040 <powi@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xed7(%rip),%xmm0
mov    $0x4,%edi
call   1040 <powi@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca float
store i32 0, i32* %1
store double 2.000000e+00, double* %2
store float 2.000000e+00, float* %3
%4 = load double, double* %2
%5 = call double @powi(double %4, i32 4)
store double %5, double* %2
%6 = load double, double* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = tail call double @powi(double 2.000000e+00, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %1)
ret i32 0
}
int main() {
  volatile char *p = (char *)0;
  *p = 5;
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
movb   $0x5,0x0
05
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %2
%3 = load i8*, i8** %2
store volatile i8 5, i8* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
store volatile i8 5, i8* null
ret i32 0
}
main() {
  char a[10];
  a[40970] = 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movb   $0x1,0xa000(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 40970
store i8 1, i8* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dream(int);
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Estoy despierto, nivel 1. Listo para dormir...\n");
  dream(1);
  printf("Desperte en un avion aterrizando en LA\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <dream@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Estoy despierto, nivel 1. Listo para dormir...\0A\00"
@.str.1 = [40 x i8] c"Desperte en un avion aterrizando en LA\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @dream(i32 1)
%4 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [47 x i8] c"Estoy despierto, nivel 1. Listo para dormir...\00"
@str.2 = [39 x i8] c"Desperte en un avion aterrizando en LA\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @dream(i32 1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *strstr(char *, char const *);
int findkey(FILE *fp, const char *key) {
  char temp[32768];
  do {
    if (NULL == fgets(temp, 32768, fp))
      return 1;
  } while (NULL == strstr(temp, key));
  return 0;
}


x86 assembly (clang, -O0):
<findkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8020,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x8020(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x8000,%esi
call   1030 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1162 <findkey+0x42>
movl   $0x1,-0x4(%rbp)
jmp    118c <findkey+0x6c>
jmp    1167 <findkey+0x47>
lea    -0x8020(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1133 <findkey+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findkey>:
push   %r15
push   %r14
push   %rbx
sub    $0x8000,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    $0x8000,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
test   %rax,%rax
je     1169 <findkey+0x49>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strstr@plt>
test   %rax,%rax
je     1140 <findkey+0x20>
xor    %eax,%eax
jmp    116e <findkey+0x4e>
mov    $0x1,%eax
add    $0x8000,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @findkey(i32* nocapture %0, i8* nocapture %1) {
%3 = alloca [32768 x i8]
%4 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %8, %2
%6 = call i32* @fgets(i8* %4, i32 32768, i32* %0)
%7 = icmp eq i32* %6, null
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = call i32* @strstr(i8* %4, i8* dereferenceable(1) %1)
%10 = icmp eq i32* %9, null
br i1 %10, label %5, label %11
11: ; preds = %8, %5
%12 = phi i32 [ 1, %5 ], [ 0, %8 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
main() {
  char *a = "Hello World";
  char *b;
  b = a + 4;
  printf("\n%s", b);
}


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"Hello World\00"
@.str.1 = [4 x i8] c"\0A%s\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 4))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int system(char *);
int remote_check_conn(const char *executor) {
  int ret;
  char cmd[1024];
  snprintf(cmd, 1024, "%s \"echo echo from remote connection check\"",
           executor);
  ret = system(cmd);
  return ret;
}


x86 assembly (clang, -O0):
<remote_check_conn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x400,%esi
lea    0xeba(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remote_check_conn>:
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%rcx
lea    0xece(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"%s \22echo echo from remote connection check\22\00"
define i32 @remote_check_conn(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [1024 x i8]
store i8* %0, i8** %2
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @snprintf(i8* %5, i32 1024, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = call i32 @system(i8* %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
@.str = [44 x i8] c"%s \22echo echo from remote connection check\22\00"
define i32 @remote_check_conn(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 1024, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @system(i8* %3)
ret i32 %5
}
/* Variables and functions */
int t1_3d_init_ctxno_sc(unsigned int);
int t1_3d_getctxno_sc(unsigned int f) {
  return t1_3d_init_ctxno_sc(
      (f & (0x00000010 | 0x00000020 | 0x00000040 | 0x00000080 | 0x00000100 |
            0x00000200)) |
      ((f >> 16) & (0x0400 | 0x0800 | 0x1000 | 0x2000 | 0x4000 | 0x8000)));
}


x86 assembly (clang, -O0):
<t1_3d_getctxno_sc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
and    $0x3f0,%edi
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
and    $0xfc00,%eax
or     %eax,%edi
call   1030 <t1_3d_init_ctxno_sc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t1_3d_getctxno_sc>:
mov    %edi,%eax
and    $0x3f0,%eax
shr    $0x10,%edi
and    $0xfc00,%edi
or     %eax,%edi
jmp    1030 <t1_3d_init_ctxno_sc@plt>

LLVM IR (-O0):
define i32 @t1_3d_getctxno_sc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1008
%5 = load i32, i32* %2
%6 = lshr i32 %5, 16
%7 = and i32 %6, 64512
%8 = or i32 %4, %7
%9 = call i32 @t1_3d_init_ctxno_sc(i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @t1_3d_getctxno_sc(i32 %0) {
%2 = and i32 %0, 1008
%3 = lshr i32 %0, 16
%4 = and i32 %3, 64512
%5 = or i32 %4, %2
%6 = tail call i32 @t1_3d_init_ctxno_sc(i32 %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void signal_handler(int signum) {
  printf("Signal handler %d ... Exiting...", signum);
  exit(1);
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<signal_handler>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Signal handler %d ... Exiting...\00"
define void @signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [33 x i8] c"Signal handler %d ... Exiting...\00"
define void @signal_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
int hl_hash_del(char *key) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @hl_hash_del(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr,
          "Usage: ddd [-f] [-o output] raw_device_file [start [size]]\n");
  exit(2);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [60 x i8] c"Usage: ddd [-f] [-o output] raw_device_file [start [size]]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [60 x i8] c"Usage: ddd [-f] [-o output] raw_device_file [start [size]]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 2)
unreachable
}
int test_imm_E5int64_highword_reg(long long val) {
  return ((val >> 32) & (0xE5 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_E5int64_highword_reg>:
movabs $0xe500000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_E5int64_highword_reg(i64 %0) {
%2 = and i64 %0, 983547510784
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void next(char *key, int p) {
  if (p < 0)
    return;
  key[p]++;
  if (key[p] > 'z') {
    key[p] = 'a';
    next(key, p - 1);
  }
}


x86 assembly (clang, -O0):
<next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    112e <next+0x1e>
jmp    116f <next+0x5f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
add    $0x1,%dl
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jle    116f <next+0x5f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x61,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <next@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next>:
test   %esi,%esi
js     1129 <next+0x29>
mov    %esi,%eax
add    $0x1,%esi
add    %rax,%rdi
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%al
mov    %al,(%rdi)
cmp    $0x7b,%al
jl     1129 <next+0x29>
movb   $0x61,(%rdi)
add    $0xffffffff,%esi
add    $0xffffffffffffffff,%rdi
test   %esi,%esi
jg     1110 <next+0x10>
ret

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

LLVM IR (-O2):
define void @next(i8* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %14, label %4
4: ; preds = %2, %11
%5 = phi i32 [ %12, %11 ], [ %1, %2 ]
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = add i8 %8, 1
store i8 %9, i8* %7
%10 = icmp sgt i8 %9, 122
br i1 %10, label %11, label %14
11: ; preds = %4
store i8 97, i8* %7
%12 = add nsw i32 %5, -1
%13 = icmp slt i32 %5, 1
br i1 %13, label %14, label %4
14: ; preds = %4, %11, %2
ret void
}
/* Variables and functions */
scalar_t__ strlen(char *);
int string_vazia(char *string) {
  if (strlen(string) == 0) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<string_vazia>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    113b <string_vazia+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    1142 <string_vazia+0x32>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_vazia>:
xor    %eax,%eax
cmpb   $0x0,(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @string_vazia(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int b = 0;
  if (b) {
    printf("Memory change succcessful.\n");
  }
}


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)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1143 <main+0x33>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [28 x i8] c"Memory change succcessful.\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
store i32 0, i32* %6
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int IsSeparator(char chr) {
  return ((chr <= ',' && chr != '$' && chr != '#') ||
          (chr >= ':' && chr < '?'));
}


x86 assembly (clang, -O0):
<IsSeparator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x2c,%eax
jg     1136 <IsSeparator+0x36>
movsbl -0x1(%rbp),%eax
cmp    $0x24,%eax
je     1136 <IsSeparator+0x36>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x23,%ecx
mov    %al,-0x2(%rbp)
jne    115b <IsSeparator+0x5b>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x3a,%ecx
mov    %al,-0x3(%rbp)
jl     1155 <IsSeparator+0x55>
movsbl -0x1(%rbp),%eax
cmp    $0x3f,%eax
setl   %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsSeparator>:
cmp    $0x2d,%dil
setl   %al
lea    -0x25(%rdi),%ecx
cmp    $0xfe,%cl
setb   %cl
and    %al,%cl
add    $0xc6,%dil
cmp    $0x5,%dil
setb   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @IsSeparator(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sle i32 %4, 44
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 36
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 35
br i1 %13, label %24, label %14
14: ; preds = %10, %6, %1
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sge i32 %16, 58
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp slt i32 %20, 63
br label %22
22: ; preds = %18, %14
%23 = phi i1 [ false, %14 ], [ %21, %18 ]
br label %24
24: ; preds = %22, %10
%25 = phi i1 [ true, %10 ], [ %23, %22 ]
%26 = zext i1 %25 to i32
ret i32 %26
}

LLVM IR (-O2):
define i32 @IsSeparator(i8 signext %0) {
%2 = icmp slt i8 %0, 45
%3 = add i8 %0, -37
%4 = icmp ult i8 %3, -2
%5 = and i1 %2, %4
%6 = add i8 %0, -58
%7 = icmp ult i8 %6, 5
%8 = or i1 %7, %5
%9 = zext i1 %8 to i32
ret i32 %9
}