xunge/DecIR huggingface dataset:
/* Type definitions */
struct kv_pair {
  int dummy;
};

/* Variables and functions */
struct kv_pair *kv_pair_add(struct kv_pair *, char const *, char const *);
struct kv_pair *kv_pair_add_bool(struct kv_pair *kv_list, const char *key,
                                 int value) {
  const char *str;
  if (value) {
    str = "yes";
  } else {
    str = "no";
  }
  return kv_pair_add(kv_list, key, str);
}


x86 assembly (clang, -O0):
<kv_pair_add_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     113d <kv_pair_add_bool+0x2d>
lea    0xecc(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1148 <kv_pair_add_bool+0x38>
lea    0xec0(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <kv_pair_add@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kv_pair_add_bool>:
test   %edx,%edx
lea    0xeeb(%rip),%rax
lea    0xee0(%rip),%rdx
cmove  %rax,%rdx
jmp    1030 <kv_pair_add@plt>

LLVM IR (-O0):
%struct.kv_pair = type { i32 }
@.str = [4 x i8] c"yes\00"
@.str.1 = [3 x i8] c"no\00"
define %struct.kv_pair* @kv_pair_add_bool(%struct.kv_pair* %0, i8* %1, i32 %2) {
%4 = alloca %struct.kv_pair*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store %struct.kv_pair* %0, %struct.kv_pair** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %7
br label %12
11: ; preds = %3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %7
br label %12
12: ; preds = %11, %10
%13 = load %struct.kv_pair*, %struct.kv_pair** %4
%14 = load i8*, i8** %5
%15 = load i8*, i8** %7
%16 = call %struct.kv_pair* @kv_pair_add(%struct.kv_pair* %13, i8* %14, i8* %15)
ret %struct.kv_pair* %16
}

LLVM IR (-O2):
%struct.kv_pair = type { i32 }
@.str = [4 x i8] c"yes\00"
@.str.1 = [3 x i8] c"no\00"
define %struct.kv_pair* @kv_pair_add_bool(%struct.kv_pair* %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
%6 = tail call %struct.kv_pair* @kv_pair_add(%struct.kv_pair* %0, i8* %1, i8* %5)
ret %struct.kv_pair* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ mbstate_t;

/* Variables and functions */
int mbsinit(const mbstate_t *st) { return !*(unsigned *)st; }


x86 assembly (clang, -O0):
<mbsinit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @mbsinit(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @mbsinit(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int hyperlink_print_get_place(int num) {
  int place, tmp;
  place = 1;
  tmp = num;
  while (tmp >= 10) {
    tmp = tmp / 10;
    place++;
  }
  return place;
}


x86 assembly (clang, -O0):
<hyperlink_print_get_place>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jl     113a <hyperlink_print_get_place+0x3a>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1114 <hyperlink_print_get_place+0x14>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hyperlink_print_get_place>:
mov    $0x1,%eax
cmp    $0xa,%edi
jl     1134 <hyperlink_print_get_place+0x34>
mov    $0x1,%eax
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x63,%edi
mov    %edx,%edi
ja     1120 <hyperlink_print_get_place+0x20>
ret

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

LLVM IR (-O2):
define i32 @hyperlink_print_get_place(i32 %0) {
%2 = icmp sgt i32 %0, 9
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = phi i32 [ %7, %3 ], [ 1, %1 ]
%6 = udiv i32 %4, 10
%7 = add nuw nsw i32 %5, 1
%8 = icmp ugt i32 %4, 99
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %7, %3 ]
ret i32 %10
}
int getFileLen3(int b) {
  int i = 0;
  b = 100;
}


x86 assembly (clang, -O0):
<getFileLen3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x64,-0x8(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @getFileLen3(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
void main() {
  float z = 2;
  printf("z = 2, square(z + 1) = %f\n", z + 1 * z + 1);
  printf("z = 2, add(z + 1) = %f\n", z + 1 + z + 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xee4(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  0xec5(%rip),%xmm1
addss  %xmm1,%xmm0
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
movss  0xead(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
addss  -0x4(%rbp),%xmm0
movss  0xe9b(%rip),%xmm1
addss  %xmm1,%xmm0
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
movss  0xed0(%rip),%xmm0
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"z = 2, square(z + 1) = %f\0A\00"
@.str.1 = [24 x i8] c"z = 2, add(z + 1) = %f\0A\00"
define void @main() {
%1 = alloca float
store float 2.000000e+00, float* %1
%2 = load float, float* %1
%3 = load float, float* %1
%4 = call float @llvm.fmuladd.f32(float 1.000000e+00, float %3, float %2)
%5 = fadd float %4, 1.000000e+00
%6 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), float %5)
%7 = load float, float* %1
%8 = fadd float %7, 1.000000e+00
%9 = load float, float* %1
%10 = fadd float %8, %9
%11 = fadd float %10, 1.000000e+00
%12 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), float %11)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"z = 2, square(z + 1) = %f\0A\00"
@.str.1 = [24 x i8] c"z = 2, add(z + 1) = %f\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), float 5.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), float 6.000000e+00)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int __int32_t_encode_array(void *, int, int, int /*<<< orphan*/ const *, int);
int __float_encode_array(void *_buf, int offset, int maxlen, const float *p,
                         int elements) {
  return __int32_t_encode_array(_buf, offset, maxlen, (const int32_t *)p,
                                elements);
}


x86 assembly (clang, -O0):
<__float_encode_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1030 <__int32_t_encode_array@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__float_encode_array>:
jmp    1030 <__int32_t_encode_array@plt>

LLVM IR (-O0):
define i32 @__float_encode_array(i8* %0, i32 %1, i32 %2, float* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca float*
%10 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store float* %3, float** %9
store i32 %4, i32* %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load float*, float** %9
%15 = bitcast float* %14 to i32*
%16 = load i32, i32* %10
%17 = call i32 @__int32_t_encode_array(i8* %11, i32 %12, i32 %13, i32* %15, i32 %16)
ret i32 %17
}

LLVM IR (-O2):
define i32 @__float_encode_array(i8* %0, i32 %1, i32 %2, float* %3, i32 %4) {
%6 = bitcast float* %3 to i32*
%7 = tail call i32 @__int32_t_encode_array(i8* %0, i32 %1, i32 %2, i32* %6, i32 %4)
ret i32 %7
}
/* Type definitions */
struct kfifo {
  int dummy;
};

/* Variables and functions */
unsigned int __kfifo_put(struct kfifo *, unsigned char *, unsigned int);
unsigned int kfifo_put(struct kfifo *fifo, unsigned char *buffer,
                       unsigned int len) {
  unsigned long flags;
  unsigned int ret;
  ret = __kfifo_put(fifo, buffer, len);
  return ret;
}


x86 assembly (clang, -O0):
<kfifo_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <__kfifo_put@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kfifo_put>:
jmp    1030 <__kfifo_put@plt>

LLVM IR (-O0):
%struct.kfifo = type { i32 }
define i32 @kfifo_put(%struct.kfifo* %0, i8* %1, i32 %2) {
%4 = alloca %struct.kfifo*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32
store %struct.kfifo* %0, %struct.kfifo** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load %struct.kfifo*, %struct.kfifo** %4
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @__kfifo_put(%struct.kfifo* %9, i8* %10, i32 %11)
store i32 %12, i32* %8
%13 = load i32, i32* %8
ret i32 %13
}

LLVM IR (-O2):
%struct.kfifo = type { i32 }
define i32 @kfifo_put(%struct.kfifo* %0, i8* %1, i32 %2) {
%4 = tail call i32 @__kfifo_put(%struct.kfifo* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ set_binomial();
int /*<<< orphan*/ test_case();
int main() {
  set_binomial();
  int n;
  scanf("%d", &n);
  while (n--)
    test_case();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <set_binomial@plt>
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1176 <main+0x46>
mov    $0x0,%al
call   1040 <test_case@plt>
jmp    1156 <main+0x26>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <set_binomial@plt>
lea    0xec1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
subl   $0x1,0x4(%rsp)
jb     115e <main+0x2e>
xor    %eax,%eax
call   1040 <test_case@plt>
subl   $0x1,0x4(%rsp)
jae    1150 <main+0x20>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 (...) @set_binomial()
%3 = bitcast i32* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add nsw i32 %5, -1
store i32 %6, i32* %1
%7 = icmp eq i32 %5, 0
br i1 %7, label %13, label %8
8: ; preds = %0, %8
%9 = call i32 (...) @test_case()
%10 = load i32, i32* %1
%11 = add nsw i32 %10, -1
store i32 %11, i32* %1
%12 = icmp eq i32 %10, 0
br i1 %12, label %13, label %8
13: ; preds = %8, %0
ret i32 0
}
void GB_ISGE_f_FP32(float *z, const float *x, const float *y) {
  (*z) = ((*x) >= (*y));
}


x86 assembly (clang, -O0):
<GB_ISGE_f_FP32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
ucomiss (%rax),%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2ss %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GB_ISGE_f_FP32>:
movss  (%rdx),%xmm0
cmpless (%rsi),%xmm0
movss  0xeef(%rip),%xmm1
andps  %xmm0,%xmm1
movss  %xmm1,(%rdi)
ret

LLVM IR (-O0):
define void @GB_ISGE_f_FP32(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%7 = load float*, float** %5
%8 = load float, float* %7
%9 = load float*, float** %6
%10 = load float, float* %9
%11 = fcmp oge float %8, %10
%12 = zext i1 %11 to i32
%13 = sitofp i32 %12 to float
%14 = load float*, float** %4
store float %13, float* %14
ret void
}

LLVM IR (-O2):
define void @GB_ISGE_f_FP32(float* nocapture writeonly %0, float* nocapture %1, float* nocapture %2) {
%4 = load float, float* %1
%5 = load float, float* %2
%6 = fcmp oge float %4, %5
%7 = uitofp i1 %6 to float
store float %7, float* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nrerror(char *);
scalar_t__ realloc(void *, unsigned int);
void *space(unsigned int);
void *xrealloc(void *p, unsigned size) {
  if (p == 0)
    return space(size);
  p = (void *)realloc(p, size);
  if (p == NULL) {
    nrerror("xrealloc allocation failure -> no memory");
  }
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115b <xrealloc+0x2b>
mov    -0x14(%rbp),%edi
call   1030 <space@plt>
mov    %rax,-0x8(%rbp)
jmp    118a <xrealloc+0x5a>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <realloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1182 <xrealloc+0x52>
lea    0xe83(%rip),%rdi
call   1040 <nrerror@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
test   %rdi,%rdi
je     1154 <xrealloc+0x24>
push   %rbx
call   1050 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114f <xrealloc+0x1f>
lea    0xeb6(%rip),%rdi
call   1040 <nrerror@plt>
mov    %rbx,%rax
pop    %rbx
ret
mov    %esi,%edi
jmp    1030 <space@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"xrealloc allocation failure -> no memory\00"
define i8* @xrealloc(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* @space(i32 %9)
store i8* %10, i8** %3
br label %22
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i32, i32* %5
%14 = call i64 @realloc(i8* %12, i32 %13)
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %4
%16 = load i8*, i8** %4
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = call i32 @nrerror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %11
%21 = load i8*, i8** %4
store i8* %21, i8** %3
br label %22
22: ; preds = %20, %8
%23 = load i8*, i8** %3
ret i8* %23
}

LLVM IR (-O2):
@.str = [41 x i8] c"xrealloc allocation failure -> no memory\00"
define i8* @xrealloc(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @space(i32 %1)
br label %12
6: ; preds = %2
%7 = tail call i64 @realloc(i8* %0, i32 %1)
%8 = inttoptr i64 %7 to i8*
%9 = icmp eq i64 %7, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @nrerror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %6, %10, %4
%13 = phi i8* [ %5, %4 ], [ %8, %10 ], [ %8, %6 ]
ret i8* %13
}
/* Variables and functions */
int /*<<< orphan*/ error_handler(char *);
int field_exist(const char *file, const char *name) {
  int ncid, varid, status, existed;
  char msg[512];
  error_handler("read_mosaic: Add flag -Duse_netCDF when compiling");
  return 0;
}


x86 assembly (clang, -O0):
<field_exist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed6(%rip),%rdi
call   1030 <error_handler@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [50 x i8] c"read_mosaic: Add flag -Duse_netCDF when compiling\00"
define i32 @field_exist(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [512 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%10 = call i32 @error_handler(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [50 x i8] c"read_mosaic: Add flag -Duse_netCDF when compiling\00"
define i32 @field_exist(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 @error_handler(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
char bext_b(char *, char *, char *);
signed char intr_wrap_522(signed char p1, signed char p2, signed char p3) {
  return bext_b(&p1, &p2, &p3);
}


x86 assembly (clang, -O0):
<intr_wrap_522>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
lea    -0x1(%rbp),%rdi
lea    -0x2(%rbp),%rsi
lea    -0x3(%rbp),%rdx
call   1030 <bext_b@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_wrap_522>:
push   %rax
mov    %dil,0x7(%rsp)
mov    %sil,0x6(%rsp)
mov    %dl,0x5(%rsp)
lea    0x7(%rsp),%rdi
lea    0x6(%rsp),%rsi
lea    0x5(%rsp),%rdx
call   1030 <bext_b@plt>
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @intr_wrap_522(i8 signext %0, i8 signext %1, i8 signext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = call signext i8 @bext_b(i8* %4, i8* %5, i8* %6)
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @intr_wrap_522(i8 signext %0, i8 signext %1, i8 signext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = call signext i8 @bext_b(i8* %4, i8* %5, i8* %6)
ret i8 %7
}
int balda_point_distance_squared(int x1, int y1, int x2, int y2) {
  return ((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1));
}


x86 assembly (clang, -O0):
<balda_point_distance_squared>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x4(%rbp),%ecx
imul   %ecx,%eax
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%edx
sub    -0x8(%rbp),%edx
imul   %edx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<balda_point_distance_squared>:
sub    %edi,%edx
imul   %edx,%edx
sub    %esi,%ecx
imul   %ecx,%ecx
lea    (%rcx,%rdx,1),%eax
ret

LLVM IR (-O0):
define i32 @balda_point_distance_squared(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = load i32, i32* %5
%11 = sub nsw i32 %9, %10
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = sub nsw i32 %12, %13
%15 = mul nsw i32 %11, %14
%16 = load i32, i32* %8
%17 = load i32, i32* %6
%18 = sub nsw i32 %16, %17
%19 = load i32, i32* %8
%20 = load i32, i32* %6
%21 = sub nsw i32 %19, %20
%22 = mul nsw i32 %18, %21
%23 = add nsw i32 %15, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @balda_point_distance_squared(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %2, %0
%6 = mul nsw i32 %5, %5
%7 = sub nsw i32 %3, %1
%8 = mul nsw i32 %7, %7
%9 = add nuw nsw i32 %8, %6
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ GPT1_DriverIRQHandler();
__attribute__((weak)) void GPT1_IRQHandler(void) { GPT1_DriverIRQHandler(); }


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

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

LLVM IR (-O0):
define weak void @GPT1_IRQHandler() {
%1 = call i32 (...) @GPT1_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @GPT1_IRQHandler() {
%1 = tail call i32 (...) @GPT1_DriverIRQHandler()
ret void
}
void kintr_enable(void) { asm volatile("sti"); }


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

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

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

LLVM IR (-O2):
define void @kintr_enable() {
tail call void asm sideeffect "sti", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int operacao(char operador, int *inteiros, size_t quantos) { return 0; }


x86 assembly (clang, -O0):
<operacao>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @operacao(i8 signext %0, i32* nocapture readnone %1, i64 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ stop_display(int);
void oglspectrum_stop(void) { stop_display(1); }


x86 assembly (clang, -O0):
<oglspectrum_stop>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <stop_display@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<oglspectrum_stop>:
mov    $0x1,%edi
jmp    1030 <stop_display@plt>

LLVM IR (-O0):
define void @oglspectrum_stop() {
%1 = call i32 @stop_display(i32 1)
ret void
}

LLVM IR (-O2):
define void @oglspectrum_stop() {
%1 = tail call i32 @stop_display(i32 1)
ret void
}
extern int GetScreenPitch() {
  int retval;
  asm("int $0x40" : "=a"(retval) : "a"(61), "b"(3));
  return retval;
}


x86 assembly (clang, -O0):
<GetScreenPitch>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    $0x3d,%eax
mov    $0x3,%ebx
int    $0x40
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetScreenPitch>:
push   %rbx
mov    $0x3d,%eax
mov    $0x3,%ebx
int    $0x40
pop    %rbx
ret

LLVM IR (-O0):
define i32 @GetScreenPitch() {
%1 = alloca i32
%2 = call i32 asm "int $$0x40", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 61, i32 3)
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @GetScreenPitch() {
%1 = tail call i32 asm "int $$0x40", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 61, i32 3)
ret i32 %1
}
/* Type definitions */
struct CFitIndex {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
struct CFitIndex *CFitIndexLoad(int /*<<< orphan*/);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
struct CFitIndex *CFitIndexFload(FILE *fp) {
  return CFitIndexLoad(fileno(fp));
}


x86 assembly (clang, -O0):
<CFitIndexFload>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fileno@plt>
mov    %eax,%edi
call   1040 <CFitIndexLoad@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.CFitIndex = type { i32 }
define %struct.CFitIndex* @CFitIndexFload(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fileno(i32* %3)
%5 = call %struct.CFitIndex* @CFitIndexLoad(i32 %4)
ret %struct.CFitIndex* %5
}

LLVM IR (-O2):
%struct.CFitIndex = type { i32 }
define %struct.CFitIndex* @CFitIndexFload(i32* nocapture %0) {
%2 = tail call i32 @fileno(i32* %0)
%3 = tail call %struct.CFitIndex* @CFitIndexLoad(i32 %2)
ret %struct.CFitIndex* %3
}
__typeof__(toupper((void *)1)) test_toupper_81(void) {
  return toupper((void *)1);
}


x86 assembly (clang, -O0):
<test_toupper_81>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
mov    %eax,%edi
call   1030 <toupper@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_toupper_81>:
mov    $0x1,%edi
jmp    1030 <toupper@plt>

LLVM IR (-O0):
define i32 @test_toupper_81() {
%1 = call i32 @toupper(i32 ptrtoint (i8* inttoptr (i64 1 to i8*) to i32))
ret i32 %1
}

LLVM IR (-O2):
define i32 @test_toupper_81() {
%1 = tail call i32 @toupper(i32 1)
ret i32 %1
}
void random2(long *seed) { *seed = (1664525L * *seed) + 1013904223L; }


x86 assembly (clang, -O0):
<random2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x19660d,(%rax),%rcx
add    $0x3c6ef35f,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<random2>:
imul   $0x19660d,(%rdi),%rax
add    $0x3c6ef35f,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @random2(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = mul nsw i64 1664525, %4
%6 = add nsw i64 %5, 1013904223
%7 = load i64*, i64** %2
store i64 %6, i64* %7
ret void
}

LLVM IR (-O2):
define void @random2(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = mul nsw i64 %2, 1664525
%4 = add nsw i64 %3, 1013904223
store i64 %4, i64* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pthread_self();
int /*<<< orphan*/ pthread_setname_np(int /*<<< orphan*/, char const *);
void thread_setname(const char *name) {
  pthread_setname_np(pthread_self(), name);
}


x86 assembly (clang, -O0):
<thread_setname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
call   1030 <pthread_setname_np@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_setname>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <pthread_self@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <pthread_setname_np@plt>

LLVM IR (-O0):
define void @thread_setname(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @pthread_self()
%4 = load i8*, i8** %2
%5 = call i32 @pthread_setname_np(i32 %3, i8* %4)
ret void
}

LLVM IR (-O2):
define void @thread_setname(i8* %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @pthread_setname_np(i32 %2, i8* %0)
ret void
}
int do_079() { return 79; }


x86 assembly (clang, -O0):
<do_079>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4f,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @do_079() {
ret i32 79
}

LLVM IR (-O2):
define i32 @do_079() {
ret i32 79
}
/* Variables and functions */
int /*<<< orphan*/ GenPrintInstr1Operand(int, int, int, int);
int /*<<< orphan*/ GenPrintInstr2Operands(int, int /*<<< orphan*/, int,
                                          int /*<<< orphan*/, int, int);
void GenJumpIfNotEqual(int val, int label) {
  GenPrintInstr2Operands(0x0E, 0, 0x03, 0, 0x0D, val);
  GenPrintInstr1Operand(0x1D, 9, 0x0F, label);
}


x86 assembly (clang, -O0):
<GenJumpIfNotEqual>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%r9d
mov    $0xe,%edi
xor    %ecx,%ecx
mov    $0x3,%edx
mov    $0xd,%r8d
mov    %ecx,%esi
call   1030 <GenPrintInstr2Operands@plt>
mov    -0x8(%rbp),%ecx
mov    $0x1d,%edi
mov    $0x9,%esi
mov    $0xf,%edx
call   1040 <GenPrintInstr1Operand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GenJumpIfNotEqual>:
push   %rbx
mov    %esi,%ebx
mov    %edi,%r9d
mov    $0xe,%edi
xor    %esi,%esi
mov    $0x3,%edx
xor    %ecx,%ecx
mov    $0xd,%r8d
call   1030 <GenPrintInstr2Operands@plt>
mov    $0x1d,%edi
mov    $0x9,%esi
mov    $0xf,%edx
mov    %ebx,%ecx
pop    %rbx
jmp    1040 <GenPrintInstr1Operand@plt>

LLVM IR (-O0):
define void @GenJumpIfNotEqual(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 = call i32 @GenPrintInstr2Operands(i32 14, i32 0, i32 3, i32 0, i32 13, i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @GenPrintInstr1Operand(i32 29, i32 9, i32 15, i32 %7)
ret void
}

LLVM IR (-O2):
define void @GenJumpIfNotEqual(i32 %0, i32 %1) {
%3 = tail call i32 @GenPrintInstr2Operands(i32 14, i32 0, i32 3, i32 0, i32 13, i32 %0)
%4 = tail call i32 @GenPrintInstr1Operand(i32 29, i32 9, i32 15, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printChar(char);
void printString(char *str) {
  int c = 0;
  while (str[c++] != '\0')
    printChar(str[c - 1]);
}


x86 assembly (clang, -O0):
<printString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115d <printString+0x4d>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <printChar@plt>
jmp    1123 <printString+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printString>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <printString+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <printChar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <printString+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @printString(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = add nuw i64 %5, 1
%8 = tail call i32 @printChar(i8 signext %6)
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
scalar_t__ M_PI_2;
double sin(scalar_t__);
double cos(double radians) { return sin(M_PI_2 - radians); }


x86 assembly (clang, -O0):
<cos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm0
subsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%rdi
call   1030 <sin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cos>:
mov    0x2ed1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
jmp    1030 <sin@plt>

LLVM IR (-O0):
@M_PI_2 = global i64 0
define double @cos(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load i64, i64* @M_PI_2
%4 = sitofp i64 %3 to double
%5 = load double, double* %2
%6 = fsub double %4, %5
%7 = fptosi double %6 to i64
%8 = call double @sin(i64 %7)
ret double %8
}

LLVM IR (-O2):
@M_PI_2 = global i64 0
define double @cos(double %0) {
%2 = load i64, i64* @M_PI_2
%3 = sitofp i64 %2 to double
%4 = fsub double %3, %0
%5 = fptosi double %4 to i64
%6 = tail call double @sin(i64 %5)
ret double %6
}
char *Q_chrreplace(char *s, const char subj, const char repl) {
  char *t = s;
  while ((t = strchr(t, subj)) != ((void *)0))
    *t++ = repl;
  return s;
}


x86 assembly (clang, -O0):
<Q_chrreplace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1163 <Q_chrreplace+0x53>
mov    -0xa(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    112f <Q_chrreplace+0x1f>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_chrreplace>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
nopl   0x0(%rax,%rax,1)
call   1030 <strchr@plt>
test   %rax,%rax
je     1137 <Q_chrreplace+0x27>
mov    %bl,(%rax)
add    $0x1,%rax
mov    %rax,%rdi
mov    %ebp,%esi
jmp    1120 <Q_chrreplace+0x10>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @Q_chrreplace(i8* returned %0, i8 signext %1, i8 signext %2) {
%4 = sext i8 %1 to i32
%5 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %12, label %7
7: ; preds = %3, %7
%8 = phi i8* [ %10, %7 ], [ %5, %3 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %2, i8* %8
%10 = tail call i8* @strchr(i8* dereferenceable(1) %9, i32 %4)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %7
12: ; preds = %7, %3
ret i8* %0
}
int test_imm_56uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x56 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_56uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 86
%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_56uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 5636096
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void sar_reg32_cl(unsigned long reg32) {
  put8(0xD3);
  put8(0xF8 + reg32);
}


x86 assembly (clang, -O0):
<sar_reg32_cl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xd3,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%rax
add    $0xf8,%rax
mov    %eax,%edi
call   1030 <put8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sar_reg32_cl>:
push   %rbx
mov    %rdi,%rbx
mov    $0xd3,%edi
call   1030 <put8@plt>
add    $0xf8,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @sar_reg32_cl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 @put8(i32 211)
%4 = load i64, i64* %2
%5 = add i64 248, %4
%6 = trunc i64 %5 to i32
%7 = call i32 @put8(i32 %6)
ret void
}

LLVM IR (-O2):
define void @sar_reg32_cl(i64 %0) {
%2 = tail call i32 @put8(i32 211)
%3 = trunc i64 %0 to i32
%4 = add i32 %3, 248
%5 = tail call i32 @put8(i32 %4)
ret void
}
/* Variables and functions */
int chdir(char const *);
int outside_chdir(const char *path) { return chdir(path); }


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

x86 assembly (clang, -O2):
<outside_chdir>:
jmp    1030 <chdir@plt>

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

LLVM IR (-O2):
define i32 @outside_chdir(i8* %0) {
%2 = tail call i32 @chdir(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i, j = 1;
  for (i = 11; i > 0; i /= 3)
    j++;
  printf("%d", j);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0xb,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1153 <main+0x43>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 4)
ret i32 0
}
/* Variables and functions */
char *hello_get_msg();
int /*<<< orphan*/ printf(char *, char *, ...);
char *version_get_revision();
char *version_get_version();
int main(int argc, char *argv[]) {
  printf("%s version %s [%s]\n", argv[0], version_get_version(),
         version_get_revision());
  printf("%s", hello_get_msg());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <version_get_version@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1060 <version_get_revision@plt>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    %rax,%rcx
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <hello_get_msg@plt>
mov    %rax,%rsi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    (%rsi),%r14
xor    %eax,%eax
call   1040 <version_get_version@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <version_get_revision@plt>
lea    0xea1(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <hello_get_msg@plt>
lea    0xe97(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"%s version %s [%s]\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = call i8* (...) @version_get_version()
%10 = call i8* (...) @version_get_revision()
%11 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9, i8* %10)
%12 = call i8* (...) @hello_get_msg()
%13 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"%s version %s [%s]\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i8* (...) @version_get_version()
%5 = tail call i8* (...) @version_get_revision()
%6 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4, i8* %5)
%7 = tail call i8* (...) @hello_get_msg()
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret i32 0
}
int swap(char *a, char *b) {
  char temp = *a;
  *a = *b;
  *b = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x19(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%al
mov    (%rsi),%cl
mov    %cl,(%rdi)
mov    %al,(%rsi)
ret

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

LLVM IR (-O2):
define i32 @swap(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
store i8 %4, i8* %0
store i8 %3, i8* %1
ret i32 undef
}
int do_483() { return 483; }


x86 assembly (clang, -O0):
<do_483>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1e3,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @do_483() {
ret i32 483
}

LLVM IR (-O2):
define i32 @do_483() {
ret i32 483
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char const *, char *, int *);
int atoh(const char *string) {
  int value = 0;
  sscanf(string, "%x", &value);
  return value;
}


x86 assembly (clang, -O0):
<atoh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed2(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoh>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xee0(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
define i32 @atoh(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
ret i32 %5
}
int main() {
  int a = 5, b = 6;
  int c = __builtin_snprintf(0, 0, "a%nb%nc", &a, &b);
  if (a + b + c != 6)
    __builtin_abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%esi
lea    0xeb8(%rip),%rdx
lea    -0x8(%rbp),%rcx
lea    -0xc(%rbp),%r8
mov    %rsi,%rdi
mov    $0x0,%al
call   1040 <snprintf@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    $0x6,%eax
je     1174 <main+0x54>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x5,0x4(%rsp)
movl   $0x6,(%rsp)
lea    0xec9(%rip),%rdx
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
xor    %edi,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <snprintf@plt>
add    0x4(%rsp),%eax
add    (%rsp),%eax
cmp    $0x6,%eax
jne    115a <main+0x3a>
xor    %eax,%eax
pop    %rcx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"a%nb%nc\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
store i32 6, i32* %3
%5 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* null, i64 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
store i32 %5, i32* %4
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
%9 = load i32, i32* %4
%10 = add nsw i32 %8, %9
%11 = icmp ne i32 %10, 6
br i1 %11, label %12, label %13
12: ; preds = %0
unreachable
13: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"a%nb%nc\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 6, i32* %2
%5 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* null, i64 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = add i32 %6, %5
%9 = add i32 %8, %7
%10 = icmp eq i32 %9, 6
br i1 %10, label %12, label %11
11: ; preds = %0
unreachable
12: ; preds = %0
ret i32 0
}
/* Variables and functions */
int write(int, char *, int);
int _putchar(char c) { return (write(1, &c, 1)); }


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

x86 assembly (clang, -O2):
<_putchar>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @_putchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @write(i32 1, i8* %2, i32 1)
ret i32 %3
}

LLVM IR (-O2):
define i32 @_putchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @write(i32 1, i8* %2, i32 1)
ret i32 %3
}