xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void cc_free(void *memory) {
  free(memory);
  if (memory)
    ;
}


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

x86 assembly (clang, -O2):
<cc_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @cc_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                          int);
void TtlMarshal_Blob(const uint8_t *from, uint8_t **cursor, int size) {
  memcpy(*cursor, from, size);
  *cursor += size;
}


x86 assembly (clang, -O0):
<TtlMarshal_Blob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
shl    $0x2,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TtlMarshal_Blob>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%rsi
mov    (%r14),%rdi
call   1030 <memcpy@plt>
movslq %ebx,%rax
shl    $0x2,%rax
add    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @TtlMarshal_Blob(i32* %0, i32** %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32**
%6 = alloca i32
store i32* %0, i32** %4
store i32** %1, i32*** %5
store i32 %2, i32* %6
%7 = load i32**, i32*** %5
%8 = load i32*, i32** %7
%9 = load i32*, i32** %4
%10 = load i32, i32* %6
%11 = call i32 @memcpy(i32* %8, i32* %9, i32 %10)
%12 = load i32, i32* %6
%13 = load i32**, i32*** %5
%14 = load i32*, i32** %13
%15 = sext i32 %12 to i64
%16 = getelementptr inbounds i32, i32* %14, i64 %15
store i32* %16, i32** %13
ret void
}

LLVM IR (-O2):
define void @TtlMarshal_Blob(i32* %0, i32** nocapture %1, i32 %2) {
%4 = load i32*, i32** %1
%5 = tail call i32 @memcpy(i32* %4, i32* %0, i32 %2)
%6 = load i32*, i32** %1
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %6, i64 %7
store i32* %8, i32** %1
ret void
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
int pollit(void *base, uint64_t offset, uint32_t doorbell_val) {
  uint32_t val = 0;
  int i;
  val = *(uint32_t *)((char *)base + offset);
  if (val == doorbell_val) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<pollit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    1141 <pollit+0x41>
movl   $0x1,-0x4(%rbp)
jmp    1148 <pollit+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pollit>:
movslq %esi,%rcx
xor    %eax,%eax
cmp    %rdx,(%rdi,%rcx,1)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @pollit(i8* nocapture %0, i32 %1, i64 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = bitcast i8* %5 to i64*
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, %2
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(int);
void *realloc(void *, int);
void *stb__realloc_raw(void *p, int sz) {
  if (p == NULL)
    return malloc(sz);
  if (sz == 0) {
    free(p);
    return NULL;
  }
  return realloc(p, sz);
}


x86 assembly (clang, -O0):
<stb__realloc_raw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115b <stb__realloc_raw+0x2b>
mov    -0x14(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
jmp    118b <stb__realloc_raw+0x5b>
cmpl   $0x0,-0x14(%rbp)
jne    117b <stb__realloc_raw+0x4b>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    118b <stb__realloc_raw+0x5b>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stb__realloc_raw>:
test   %rdi,%rdi
je     113e <stb__realloc_raw+0xe>
test   %esi,%esi
je     1145 <stb__realloc_raw+0x15>
jmp    1050 <realloc@plt>
mov    %esi,%edi
jmp    1040 <malloc@plt>
push   %rax
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @stb__realloc_raw(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @malloc(i32 %1)
br label %12
6: ; preds = %2
%7 = icmp eq i32 %1, 0
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 @free(i8* %0)
br label %12
10: ; preds = %6
%11 = tail call i8* @realloc(i8* %0, i32 %1)
br label %12
12: ; preds = %10, %8, %4
%13 = phi i8* [ %5, %4 ], [ null, %8 ], [ %11, %10 ]
ret i8* %13
}
void testClosureBBrV(void (*closure)(char, char), char a1, char a2) {
  (*closure)(a1, a2);
}


x86 assembly (clang, -O0):
<testClosureBBrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x9(%rbp),%cl
movsbl %cl,%edi
movsbl -0xa(%rbp),%esi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureBBrV>:
mov    %rdi,%rax
mov    %esi,%edi
mov    %edx,%esi
jmp    *%rax

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

LLVM IR (-O2):
define void @testClosureBBrV(void (i8, i8)* nocapture %0, i8 signext %1, i8 signext %2) {
tail call void %0(i8 signext %1, i8 signext %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void ex1() {
  for (int k = 0; k < 255; k++) {
    printf("||  %-3c||   %-6d||\n", k, k);
  }
}


x86 assembly (clang, -O0):
<ex1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jge    114c <ex1+0x3c>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <ex1+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ex1>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0xff,%ebx
jne    1120 <ex1+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"|| %-3c|| %-6d||\0A\00"
define void @ex1() {
br label %2
1: ; preds = %2
ret void
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %3)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 255
br i1 %6, label %1, label %2
}
void symbol51_untagged(void) {}


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

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

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

LLVM IR (-O2):
define void @symbol51_untagged() {
ret void
}
/* Variables and functions */
double exp(int);
int log(double);
double sqrt(double num) { return exp(log(num) / 2); }


x86 assembly (clang, -O0):
<sqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <log@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <exp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqrt>:
push   %rax
call   1040 <log@plt>
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
pop    %rax
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @sqrt(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @log(double %3)
%5 = sdiv i32 %4, 2
%6 = call double @exp(i32 %5)
ret double %6
}

LLVM IR (-O2):
define double @sqrt(double %0) {
%2 = tail call i32 @log(double %0)
%3 = sdiv i32 %2, 2
%4 = tail call double @exp(i32 %3)
ret double %4
}
/* Variables and functions */
float sin(float);
float deg_sin(float deg) { return sin(deg * 0.01745329251); }


x86 assembly (clang, -O0):
<deg_sin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <sin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deg_sin>:
cvtss2sd %xmm0,%xmm0
mulsd  0xee4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
jmp    1030 <sin@plt>

LLVM IR (-O0):
define float @deg_sin(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double %4, 0x3F91DF46A226E211
%6 = fptrunc double %5 to float
%7 = call float @sin(float %6)
ret float %7
}

LLVM IR (-O2):
define float @deg_sin(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 0x3F91DF46A226E211
%4 = fptrunc double %3 to float
%5 = tail call float @sin(float %4)
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ login_tty(int /*<<< orphan*/);
void foo(void) { login_tty(0); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <login_tty@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %edi,%edi
jmp    1030 <login_tty@plt>

LLVM IR (-O0):
define void @foo() {
%1 = call i32 @login_tty(i32 0)
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 @login_tty(i32 0)
ret void
}
int test_imm_C2uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xC2 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_C2uint64_midword_mem>:
testb  $0xc2,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_C2uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 12713984
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char *cvt(long double, int, int *, int *, int /*<<< orphan*/);
char *_fcvt(long double value, int ndigit, int *decpt, int *sign) {
  return cvt(value, ndigit, decpt, sign, 0);
}


x86 assembly (clang, -O0):
<_fcvt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
fldt   -0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %rsp,%rax
fstpt  (%rax)
xor    %ecx,%ecx
call   1030 <cvt@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fcvt>:
xor    %ecx,%ecx
jmp    1030 <cvt@plt>

LLVM IR (-O0):
define i8* @_fcvt(x86_fp80 %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca x86_fp80
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
store x86_fp80 %0, x86_fp80* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load x86_fp80, x86_fp80* %5
%10 = load i32, i32* %6
%11 = load i32*, i32** %7
%12 = load i32*, i32** %8
%13 = call i8* @cvt(x86_fp80 %9, i32 %10, i32* %11, i32* %12, i32 0)
ret i8* %13
}

LLVM IR (-O2):
define i8* @_fcvt(x86_fp80 %0, i32 %1, i32* %2, i32* %3) {
%5 = tail call i8* @cvt(x86_fp80 %0, i32 %1, i32* %2, i32* %3, i32 0)
ret i8* %5
}
const char *get_option_str(int flag) {
  if (flag & 1)
    return "rows";
  if (flag & 2)
    return "columns";
  if (flag & 4)
    return "probability";
  return "programming error: should not be reached!";
}


x86 assembly (clang, -O0):
<get_option_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1126 <get_option_str+0x26>
lea    0xee3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    116f <get_option_str+0x6f>
mov    -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1145 <get_option_str+0x45>
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    116f <get_option_str+0x6f>
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1164 <get_option_str+0x64>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    116f <get_option_str+0x6f>
lea    0xeae(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_option_str>:
test   $0x1,%dil
jne    1123 <get_option_str+0x23>
test   $0x2,%dil
jne    112b <get_option_str+0x2b>
test   $0x4,%dil
lea    0xf02(%rip),%rcx
lea    0xeef(%rip),%rax
cmove  %rcx,%rax
ret
lea    0xed6(%rip),%rax
ret
lea    0xed3(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"rows\00"
@.str.1 = [8 x i8] c"columns\00"
@.str.2 = [12 x i8] c"probability\00"
@.str.3 = [42 x i8] c"programming error: should not be reached!\00"
define i8* @get_option_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %19
8: ; preds = %1
%9 = load i32, i32* %3
%10 = and i32 %9, 2
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %19
13: ; preds = %8
%14 = load i32, i32* %3
%15 = and i32 %14, 4
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %19
18: ; preds = %13
store i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %19
19: ; preds = %18, %17, %12, %7
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [5 x i8] c"rows\00"
@.str.1 = [8 x i8] c"columns\00"
@.str.2 = [12 x i8] c"probability\00"
@.str.3 = [42 x i8] c"programming error: should not be reached!\00"
define i8* @get_option_str(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = and i32 %0, 2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = and i32 %0, 4
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0)
br label %11
11: ; preds = %7, %4, %1
%12 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %4 ], [ %10, %7 ]
ret i8* %12
}
/* Type definitions */
struct img_str {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ img_str_to_native(struct img_str *);
char *strrchr(int /*<<< orphan*/, char);
char *img_strrchr(struct img_str *str, char c) {
  return strrchr(img_str_to_native(str), c);
}


x86 assembly (clang, -O0):
<img_strrchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <img_str_to_native@plt>
mov    %eax,%edi
movsbl -0x9(%rbp),%esi
call   1030 <strrchr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<img_strrchr>:
push   %rbx
mov    %esi,%ebx
call   1040 <img_str_to_native@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <strrchr@plt>

LLVM IR (-O0):
%struct.img_str = type { i32 }
define i8* @img_strrchr(%struct.img_str* %0, i8 signext %1) {
%3 = alloca %struct.img_str*
%4 = alloca i8
store %struct.img_str* %0, %struct.img_str** %3
store i8 %1, i8* %4
%5 = load %struct.img_str*, %struct.img_str** %3
%6 = call i32 @img_str_to_native(%struct.img_str* %5)
%7 = load i8, i8* %4
%8 = call i8* @strrchr(i32 %6, i8 signext %7)
ret i8* %8
}

LLVM IR (-O2):
%struct.img_str = type { i32 }
define i8* @img_strrchr(%struct.img_str* %0, i8 signext %1) {
%3 = tail call i32 @img_str_to_native(%struct.img_str* %0)
%4 = tail call i8* @strrchr(i32 %3, i8 signext %1)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ type;
typedef int socklen_t;

/* Variables and functions */
int AF_UNSPEC;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_TYPE;
scalar_t__ getsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *,
                      int *);
int net_socktype(int sock) {
  int type;
  socklen_t size = sizeof(type);
  if (getsockopt(sock, SOL_SOCKET, SO_TYPE, &type, &size) == 0) {
    return type;
  } else {
    return AF_UNSPEC;
  }
}


x86 assembly (clang, -O0):
<net_socktype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x4,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1030 <getsockopt@plt>
cmp    $0x0,%rax
jne    1159 <net_socktype+0x49>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1165 <net_socktype+0x55>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_socktype>:
push   %rbx
sub    $0x10,%rsp
movl   $0x4,0x8(%rsp)
mov    0x2ec4(%rip),%rax
mov    (%rax),%esi
mov    0x2eab(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rbx
lea    0x8(%rsp),%r8
mov    %rbx,%rcx
call   1030 <getsockopt@plt>
test   %rax,%rax
je     114d <net_socktype+0x3d>
mov    0x2e93(%rip),%rbx
mov    (%rbx),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_TYPE = global i32 0
@AF_UNSPEC = global i32 0
define i32 @net_socktype(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 4, i32* %5
%6 = load i32, i32* %3
%7 = load i32, i32* @SOL_SOCKET
%8 = load i32, i32* @SO_TYPE
%9 = call i64 @getsockopt(i32 %6, i32 %7, i32 %8, i32* %4, i32* %5)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load i32, i32* %4
store i32 %12, i32* %2
br label %15
13: ; preds = %1
%14 = load i32, i32* @AF_UNSPEC
store i32 %14, i32* %2
br label %15
15: ; preds = %13, %11
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_TYPE = global i32 0
@AF_UNSPEC = global i32 0
define i32 @net_socktype(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_TYPE
%8 = call i64 @getsockopt(i32 %0, i32 %6, i32 %7, i32* %2, i32* %3)
%9 = icmp eq i64 %8, 0
%10 = load i32, i32* %2
%11 = load i32, i32* @AF_UNSPEC
%12 = select i1 %9, i32 %10, i32 %11
ret i32 %12
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ progerr(char *, size_t);
void *emalloc(size_t size) {
  void *p;
  if ((p = malloc(size)) == NULL)
    progerr("Ran out of memory (could not malloc %lu more bytes)!", size);
  return p;
}


x86 assembly (clang, -O0):
<emalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1153 <emalloc+0x33>
mov    -0x8(%rbp),%rsi
lea    0xeb2(%rip),%rdi
call   1030 <progerr@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <emalloc+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1030 <progerr@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [53 x i8] c"Ran out of memory (could not malloc %lu more bytes)!\00"
define i8* @emalloc(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 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i64, i64* %2
%9 = call i32 @progerr(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i64 %8)
br label %10
10: ; preds = %7, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [53 x i8] c"Ran out of memory (could not malloc %lu more bytes)!\00"
define noalias i8* @emalloc(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 @progerr(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
unsigned int MiiStationRead(int, int);
unsigned PhyStatus(void) {
  unsigned lxt970Status = MiiStationRead(0x14, 1);
  unsigned r = 0;
  if (lxt970Status & (1 << (13)))
    r |= 0x0001;
  if (lxt970Status & (1 << (12)))
    r |= 0x0002;
  if (lxt970Status & (1 << (11)))
    r |= 0x0004;
  return r;
}


x86 assembly (clang, -O0):
<PhyStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x14,%edi
mov    $0x1,%esi
call   1030 <MiiStationRead@plt>
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     114b <PhyStatus+0x3b>
mov    -0x8(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1000,%eax
cmp    $0x0,%eax
je     1165 <PhyStatus+0x55>
mov    -0x8(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x800,%eax
cmp    $0x0,%eax
je     117f <PhyStatus+0x6f>
mov    -0x8(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PhyStatus>:
push   %rax
mov    $0x14,%edi
mov    $0x1,%esi
call   1030 <MiiStationRead@plt>
mov    %eax,%ecx
shr    $0xd,%ecx
and    $0x1,%ecx
mov    %eax,%edx
shr    $0xb,%edx
and    $0x2,%edx
or     %ecx,%edx
shr    $0x9,%eax
and    $0x4,%eax
or     %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @PhyStatus() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @MiiStationRead(i32 20, i32 1)
store i32 %3, i32* %1
store i32 0, i32* %2
%4 = load i32, i32* %1
%5 = and i32 %4, 8192
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %2
%9 = or i32 %8, 1
store i32 %9, i32* %2
br label %10
10: ; preds = %7, %0
%11 = load i32, i32* %1
%12 = and i32 %11, 4096
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %2
%16 = or i32 %15, 2
store i32 %16, i32* %2
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %1
%19 = and i32 %18, 2048
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %2
%23 = or i32 %22, 4
store i32 %23, i32* %2
br label %24
24: ; preds = %21, %17
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @PhyStatus() {
%1 = tail call i32 @MiiStationRead(i32 20, i32 1)
%2 = lshr i32 %1, 13
%3 = and i32 %2, 1
%4 = lshr i32 %1, 11
%5 = and i32 %4, 2
%6 = or i32 %5, %3
%7 = lshr i32 %1, 9
%8 = and i32 %7, 4
%9 = or i32 %6, %8
ret i32 %9
}
/* Variables and functions */
int __isascii(int);
int isascii(int c) { return __isascii(c); }


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

x86 assembly (clang, -O2):
<isascii>:
jmp    1030 <__isascii@plt>

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

LLVM IR (-O2):
define i32 @isascii(i32 %0) {
%2 = tail call i32 @__isascii(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main02() {
  int i = 5;
  int a = i++ + ++i;
  printf("%d\n", a);
  printf("%d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main02>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main02>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main02() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 12)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert_int_equal(int /*<<< orphan*/, int /*<<< orphan*/);
void test_example(void **state) { assert_int_equal(0, 0); }


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

x86 assembly (clang, -O2):
<test_example>:
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <assert_int_equal@plt>

LLVM IR (-O0):
define void @test_example(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @assert_int_equal(i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @test_example(i8** nocapture readnone %0) {
%2 = tail call i32 @assert_int_equal(i32 0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printw(char *, ...);
void draw_game_over(int tm) {
  printw("Game Over!\n");
  printw("You played for: %ds\n", tm);
}


x86 assembly (clang, -O0):
<draw_game_over>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printw@plt>
mov    -0x4(%rbp),%esi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_game_over>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
xor    %eax,%eax
call   1030 <printw@plt>
lea    0xee4(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printw@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Game Over!\0A\00"
@.str.1 = [21 x i8] c"You played for: %ds\0A\00"
define void @draw_game_over(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Game Over!\0A\00"
@.str.1 = [21 x i8] c"You played for: %ds\0A\00"
define void @draw_game_over(i32 %0) {
%2 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printw(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
void ARGBShadeRow_C() {}


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

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

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

LLVM IR (-O2):
define void @ARGBShadeRow_C() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void dog_shout(int volume) { printf("wang wang %d\n", volume); }


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

x86 assembly (clang, -O2):
<dog_shout>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"wang wang %d\0A\00"
define void @dog_shout(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"wang wang %d\0A\00"
define void @dog_shout(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
unsigned long ReadEprom(unsigned long WordAddr) {
  unsigned long data, i;
  for (i = 0, data = 0, WordAddr *= 4; i < 4; i++, WordAddr++)
    data |= (*(unsigned long *)((0x340000) + WordAddr) & 0xFF) << (i * 8);
  return (data);
}


x86 assembly (clang, -O0):
<ReadEprom>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x4,-0x18(%rbp)
jae    1172 <ReadEprom+0x72>
mov    -0x8(%rbp),%rax
add    $0x340000,%rax
mov    (%rax),%rax
and    $0xff,%rax
mov    -0x18(%rbp),%rcx
shl    $0x3,%rcx
shl    %cl,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1124 <ReadEprom+0x24>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadEprom>:
movzbl 0x340000(,%rdi,4),%eax
mov    0x340001(,%rdi,4),%ecx
mov    0x340002(,%rdi,4),%edx
shl    $0x8,%ecx
movzwl %cx,%ecx
or     %rax,%rcx
movzbl %dl,%edx
shl    $0x10,%rdx
or     %rcx,%rdx
mov    0x340003(,%rdi,4),%eax
shl    $0x18,%eax
or     %rdx,%rax
ret

LLVM IR (-O0):
define i64 @ReadEprom(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %2
store i64 0, i64* %4
store i64 0, i64* %3
%5 = load i64, i64* %2
%6 = mul i64 %5, 4
store i64 %6, i64* %2
br label %7
7: ; preds = %21, %1
%8 = load i64, i64* %4
%9 = icmp ult i64 %8, 4
br i1 %9, label %10, label %26
10: ; preds = %7
%11 = load i64, i64* %2
%12 = add i64 3407872, %11
%13 = inttoptr i64 %12 to i64*
%14 = load i64, i64* %13
%15 = and i64 %14, 255
%16 = load i64, i64* %4
%17 = mul i64 %16, 8
%18 = shl i64 %15, %17
%19 = load i64, i64* %3
%20 = or i64 %19, %18
store i64 %20, i64* %3
br label %21
21: ; preds = %10
%22 = load i64, i64* %4
%23 = add i64 %22, 1
store i64 %23, i64* %4
%24 = load i64, i64* %2
%25 = add i64 %24, 1
store i64 %25, i64* %2
br label %7
26: ; preds = %7
%27 = load i64, i64* %3
ret i64 %27
}

LLVM IR (-O2):
define i64 @ReadEprom(i64 %0) {
%2 = shl i64 %0, 2
%3 = add i64 %2, 3407872
%4 = inttoptr i64 %3 to i64*
%5 = load i64, i64* %4
%6 = and i64 %5, 255
%7 = add i64 %2, 3407873
%8 = inttoptr i64 %7 to i64*
%9 = load i64, i64* %8
%10 = shl i64 %9, 8
%11 = and i64 %10, 65280
%12 = or i64 %11, %6
%13 = add i64 %2, 3407874
%14 = inttoptr i64 %13 to i64*
%15 = load i64, i64* %14
%16 = shl i64 %15, 16
%17 = and i64 %16, 16711680
%18 = or i64 %17, %12
%19 = add i64 %2, 3407875
%20 = inttoptr i64 %19 to i64*
%21 = load i64, i64* %20
%22 = shl i64 %21, 24
%23 = and i64 %22, 4278190080
%24 = or i64 %23, %18
ret i64 %24
}
unsigned int generic_hweight16(unsigned int w) {
  unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555);
  res = (res & 0x3333) + ((res >> 2) & 0x3333);
  res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F);
  return (res & 0x00FF) + ((res >> 8) & 0x00FF);
}


x86 assembly (clang, -O0):
<generic_hweight16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x5555,%eax
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
and    $0x5555,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3333,%eax
mov    -0x8(%rbp),%ecx
shr    $0x2,%ecx
and    $0x3333,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf0f,%eax
mov    -0x8(%rbp),%ecx
shr    $0x4,%ecx
and    $0xf0f,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    -0x8(%rbp),%ecx
shr    $0x8,%ecx
and    $0xff,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<generic_hweight16>:
mov    %edi,%eax
and    $0x5555,%eax
shr    %edi
and    $0x5555,%edi
add    %edi,%eax
mov    %eax,%ecx
and    $0x3333,%ecx
shr    $0x2,%eax
and    $0x3333,%eax
add    %ecx,%eax
mov    %eax,%ecx
and    $0x707,%ecx
shr    $0x4,%eax
and    $0x707,%eax
add    %ecx,%eax
movzbl %al,%ecx
shr    $0x8,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @generic_hweight16(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 21845
%6 = load i32, i32* %2
%7 = lshr i32 %6, 1
%8 = and i32 %7, 21845
%9 = add i32 %5, %8
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = and i32 %10, 13107
%12 = load i32, i32* %3
%13 = lshr i32 %12, 2
%14 = and i32 %13, 13107
%15 = add i32 %11, %14
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = and i32 %16, 3855
%18 = load i32, i32* %3
%19 = lshr i32 %18, 4
%20 = and i32 %19, 3855
%21 = add i32 %17, %20
store i32 %21, i32* %3
%22 = load i32, i32* %3
%23 = and i32 %22, 255
%24 = load i32, i32* %3
%25 = lshr i32 %24, 8
%26 = and i32 %25, 255
%27 = add i32 %23, %26
ret i32 %27
}

LLVM IR (-O2):
define i32 @generic_hweight16(i32 %0) {
%2 = and i32 %0, 21845
%3 = lshr i32 %0, 1
%4 = and i32 %3, 21845
%5 = add nuw nsw i32 %4, %2
%6 = and i32 %5, 13107
%7 = lshr i32 %5, 2
%8 = and i32 %7, 13107
%9 = add nuw nsw i32 %8, %6
%10 = and i32 %9, 1799
%11 = lshr i32 %9, 4
%12 = and i32 %11, 1799
%13 = add nuw nsw i32 %12, %10
%14 = and i32 %13, 15
%15 = lshr i32 %13, 8
%16 = add nuw nsw i32 %14, %15
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ exercicio_inserir_ordenado();
int /*<<< orphan*/ printf(char *, int);
int profundidade_arvore(int);
int main() {
  printf("%d\n", profundidade_arvore(2));
  exercicio_inserir_ordenado();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
call   1030 <profundidade_arvore@plt>
mov    %eax,%esi
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <exercicio_inserir_ordenado@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1030 <profundidade_arvore@plt>
lea    0xebe(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <exercicio_inserir_ordenado@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @profundidade_arvore(i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @exercicio_inserir_ordenado()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ *get_bottom();
int /*<<< orphan*/ *get_top();
bool is_stack_empty() {
  if (get_top() == NULL && get_bottom() == NULL)
    return true;
  return false;
}


x86 assembly (clang, -O0):
<is_stack_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <get_top@plt>
cmp    $0x0,%rax
jne    1156 <is_stack_empty+0x36>
mov    $0x0,%al
call   1040 <get_bottom@plt>
cmp    $0x0,%rax
jne    1156 <is_stack_empty+0x36>
movl   $0x1,-0x4(%rbp)
jmp    115d <is_stack_empty+0x3d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_stack_empty>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <get_top@plt>
test   %rax,%rax
jne    1140 <is_stack_empty+0x20>
xor    %eax,%eax
call   1040 <get_bottom@plt>
test   %rax,%rax
jne    1140 <is_stack_empty+0x20>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @is_stack_empty() {
%1 = tail call i32* (...) @get_top()
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32* (...) @get_bottom()
%5 = icmp eq i32* %4, null
br i1 %5, label %7, label %6
6: ; preds = %3, %0
br label %7
7: ; preds = %3, %6
%8 = phi i32 [ 0, %6 ], [ 1, %3 ]
ret i32 %8
}
const char *STRV_IFNOTNULL(const char *x) { return x ? x : (const char *)-1; }


x86 assembly (clang, -O0):
<STRV_IFNOTNULL>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1120 <STRV_IFNOTNULL+0x20>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1130 <STRV_IFNOTNULL+0x30>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1130 <STRV_IFNOTNULL+0x30>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<STRV_IFNOTNULL>:
cmp    $0x1,%rdi
sbb    %rax,%rax
or     %rdi,%rax
ret

LLVM IR (-O0):
define i8* @STRV_IFNOTNULL(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i8*, i8** %2
br label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %5
%9 = phi i8* [ %6, %5 ], [ inttoptr (i64 -1 to i8*), %7 ]
ret i8* %9
}

LLVM IR (-O2):
define i8* @STRV_IFNOTNULL(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* inttoptr (i64 -1 to i8*), i8* %0
ret i8* %3
}
int Q_charhex(int c) {
  if (c >= 'A' && c <= 'F') {
    return 10 + (c - 'A');
  }
  if (c >= 'a' && c <= 'f') {
    return 10 + (c - 'a');
  }
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return -1;
}


x86 assembly (clang, -O0):
<Q_charhex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     112c <Q_charhex+0x2c>
cmpl   $0x46,-0x8(%rbp)
jg     112c <Q_charhex+0x2c>
mov    -0x8(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <Q_charhex+0x7a>
cmpl   $0x61,-0x8(%rbp)
jl     1151 <Q_charhex+0x51>
cmpl   $0x66,-0x8(%rbp)
jg     1151 <Q_charhex+0x51>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <Q_charhex+0x7a>
cmpl   $0x30,-0x8(%rbp)
jl     1173 <Q_charhex+0x73>
cmpl   $0x39,-0x8(%rbp)
jg     1173 <Q_charhex+0x73>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <Q_charhex+0x7a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_charhex>:
mov    %edi,%eax
lea    -0x41(%rax),%ecx
cmp    $0x5,%ecx
ja     110e <Q_charhex+0xe>
add    $0xffffffc9,%eax
ret
lea    -0x61(%rax),%ecx
cmp    $0x5,%ecx
ja     111a <Q_charhex+0x1a>
add    $0xffffffa9,%eax
ret
add    $0xffffffd0,%eax
cmp    $0xa,%eax
mov    $0xffffffff,%ecx
cmovb  %eax,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @Q_charhex(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 70
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 65
%12 = add nsw i32 10, %11
store i32 %12, i32* %2
br label %33
13: ; preds = %6, %1
%14 = load i32, i32* %3
%15 = icmp sge i32 %14, 97
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp sle i32 %17, 102
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 97
%22 = add nsw i32 10, %21
store i32 %22, i32* %2
br label %33
23: ; preds = %16, %13
%24 = load i32, i32* %3
%25 = icmp sge i32 %24, 48
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = load i32, i32* %3
%28 = icmp sle i32 %27, 57
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %3
%31 = sub nsw i32 %30, 48
store i32 %31, i32* %2
br label %33
32: ; preds = %26, %23
store i32 -1, i32* %2
br label %33
33: ; preds = %32, %29, %19, %9
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @Q_charhex(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 6
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = add nsw i32 %0, -55
br label %15
6: ; preds = %1
%7 = add i32 %0, -97
%8 = icmp ult i32 %7, 6
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = add nsw i32 %0, -87
br label %15
11: ; preds = %6
%12 = add i32 %0, -48
%13 = icmp ult i32 %12, 10
%14 = select i1 %13, i32 %12, i32 -1
br label %15
15: ; preds = %11, %9, %4
%16 = phi i32 [ %5, %4 ], [ %10, %9 ], [ %14, %11 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ syserr(char *, long, int);
int write(int, long *, int);
void writeLong(int writeDescriptor, long value) {
  if (write(writeDescriptor, &value, sizeof(long)) != sizeof(long)) {
    syserr("write %ld to %d\n", value, writeDescriptor);
  }
}


x86 assembly (clang, -O0):
<writeLong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cltq
cmp    $0x8,%rax
je     115f <writeLong+0x3f>
mov    -0x10(%rbp),%rsi
mov    -0x4(%rbp),%edx
lea    0xea6(%rip),%rdi
call   1040 <syserr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeLong>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
mov    %rsi,(%rsp)
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cmp    $0x8,%eax
jne    1147 <writeLong+0x27>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xeb2(%rip),%rdi
mov    %r14,%rsi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <syserr@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"write %ld to %d\0A\00"
define void @writeLong(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
%6 = call i32 @write(i32 %5, i64* %4, i32 8)
%7 = sext i32 %6 to i64
%8 = icmp ne i64 %7, 8
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i64, i64* %4
%11 = load i32, i32* %3
%12 = call i32 @syserr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %10, i32 %11)
br label %13
13: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"write %ld to %d\0A\00"
define void @writeLong(i32 %0, i64 %1) {
%3 = alloca i64
store i64 %1, i64* %3
%4 = call i32 @write(i32 %0, i64* %3, i32 8)
%5 = icmp eq i32 %4, 8
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @syserr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %1, i32 %0)
br label %8
8: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TCSBRK;
int ioctl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int tcsendbreak(int fd, int dur) { return ioctl(fd, TCSBRK, 0); }


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

x86 assembly (clang, -O2):
<tcsendbreak>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
jmp    1030 <ioctl@plt>

LLVM IR (-O0):
@TCSBRK = global i32 0
define i32 @tcsendbreak(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* @TCSBRK
%7 = call i32 @ioctl(i32 %5, i32 %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
@TCSBRK = global i32 0
define i32 @tcsendbreak(i32 %0, i32 %1) {
%3 = load i32, i32* @TCSBRK
%4 = tail call i32 @ioctl(i32 %0, i32 %3, i32 0)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128;

/* Variables and functions */
long long _mm_cvtss_si64(int /*<<< orphan*/);
long long test_mm_cvtss_si64(__m128 A) { return _mm_cvtss_si64(A); }


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

x86 assembly (clang, -O2):
<test_mm_cvtss_si64>:
jmp    1030 <_mm_cvtss_si64@plt>

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

LLVM IR (-O2):
define i64 @test_mm_cvtss_si64(i32 %0) {
%2 = tail call i64 @_mm_cvtss_si64(i32 %0)
ret i64 %2
}