xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ f(int *, int *);
int f2(int *);
int /*<<< orphan*/ g(int *, int *);
int main(void) {
  int a = 5;
  f(&a, &a);
  g(&a, &a);
  int x = 5;
  return f2(&x) == 5;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    -0x8(%rbp),%rsi
mov    %rsi,%rdi
call   1040 <f@plt>
lea    -0x8(%rbp),%rsi
mov    %rsi,%rdi
call   1050 <g@plt>
movl   $0x5,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <f2@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x5,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1040 <f@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1050 <g@plt>
movl   $0x5,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <f2@plt>
xor    %ecx,%ecx
cmp    $0x5,%eax
sete   %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%4 = call i32 @f(i32* %2, i32* %2)
%5 = call i32 @g(i32* %2, i32* %2)
store i32 5, i32* %3
%6 = call i32 @f2(i32* %3)
%7 = icmp eq i32 %6, 5
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%4 = call i32 @f(i32* %1, i32* %1)
%5 = call i32 @g(i32* %1, i32* %1)
%6 = bitcast i32* %2 to i8*
store i32 5, i32* %2
%7 = call i32 @f2(i32* %2)
%8 = icmp eq i32 %7, 5
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint16_t;

/* Variables and functions */
void volatile_fetch_and_u16(uint16_t *dest, uint16_t val) {
  *((volatile uint16_t *)dest) &= val;
}


x86 assembly (clang, -O0):
<volatile_fetch_and_u16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<volatile_fetch_and_u16>:
mov    %esi,-0x4(%rsp)
mov    -0x4(%rsp),%eax
and    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @volatile_fetch_and_u16(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store volatile i32 %1, i32* %4
%5 = load volatile i32, i32* %4
%6 = load i32*, i32** %3
%7 = load volatile i32, i32* %6
%8 = and i32 %7, %5
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @volatile_fetch_and_u16(i32* %0, i32 %1) {
%3 = alloca i32
store volatile i32 %1, i32* %3
%4 = load volatile i32, i32* %3
%5 = load volatile i32, i32* %0
%6 = and i32 %5, %4
store volatile i32 %6, i32* %0
ret void
}
unsigned long align(unsigned long value, unsigned long align) {
  return ((value + align - 1) & ~(align - 1));
}


x86 assembly (clang, -O0):
<align>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
sub    $0x1,%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align>:
lea    (%rdi,%rsi,1),%rax
add    $0xffffffffffffffff,%rax
neg    %rsi
and    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @align(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add i64 %5, %6
%8 = sub i64 %7, 1
%9 = load i64, i64* %4
%10 = sub i64 %9, 1
%11 = xor i64 %10, -1
%12 = and i64 %8, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @align(i64 %0, i64 %1) {
%3 = add i64 %0, -1
%4 = add i64 %3, %1
%5 = sub i64 0, %1
%6 = and i64 %4, %5
ret i64 %6
}
/* Variables and functions */
scalar_t__ bar();
int foo() {
  int c;
  if (bar())
    c = 2;
  else
    c = 3;
  while (c) {
    c += 5;
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <bar@plt>
cmp    $0x0,%rax
je     1135 <foo+0x25>
movl   $0x2,-0x8(%rbp)
jmp    113c <foo+0x2c>
movl   $0x3,-0x8(%rbp)
jmp    1141 <foo+0x31>
cmpl   $0x0,-0x8(%rbp)
je     1159 <foo+0x49>
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <foo+0x31>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>

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

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i64 (...) @bar()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
void *calloc(size_t, size_t);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void *safe_calloc(size_t n, size_t size) {
  void *ptr;
  if ((ptr = calloc(n, size)) == NULL) {
    perror("Out of memory");
    exit(EXIT_FAILURE);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<safe_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1175 <safe_calloc+0x45>
lea    0xe9e(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_calloc>:
push   %rax
call   1030 <calloc@plt>
test   %rax,%rax
je     113d <safe_calloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Out of memory\00"
@EXIT_FAILURE = global i32 0
define i8* @safe_calloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
@.str = [14 x i8] c"Out of memory\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @safe_calloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
ret i8* %3
}
void nmi_set_timeout(int cpuid, int time) {}


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

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

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

LLVM IR (-O2):
define void @nmi_set_timeout(i32 %0, i32 %1) {
ret void
}
int d_blg_rr1(double a1, double a2) {
  return (__builtin_islessgreater(a1, a2));
}


x86 assembly (clang, -O0):
<d_blg_rr1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_blg_rr1>:
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setne  %al
ret

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

LLVM IR (-O2):
define i32 @d_blg_rr1(double %0, double %1) {
%3 = fcmp one double %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
float fmin(float, float);
float blue(float ratio) {
  return fmin(1.0f, -2.21f * ratio * ratio + 1.61f * ratio + 0.573f);
}


x86 assembly (clang, -O0):
<blue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xee7(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
movss  0xed1(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xeb8(%rip),%xmm0
addss  %xmm0,%xmm1
movss  0xea8(%rip),%xmm0
call   1030 <fmin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blue>:
movss  0xef8(%rip),%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  0xeec(%rip),%xmm0
addss  %xmm1,%xmm0
addss  0xee4(%rip),%xmm0
minss  0xee0(%rip),%xmm0
ret

LLVM IR (-O0):
define float @blue(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float 0xC001AE1480000000, %3
%5 = load float, float* %2
%6 = load float, float* %2
%7 = fmul float 0x3FF9C28F60000000, %6
%8 = call float @llvm.fmuladd.f32(float %4, float %5, float %7)
%9 = fadd float %8, 0x3FE2560420000000
%10 = call float @fmin(float 1.000000e+00, float %9)
ret float %10
}

LLVM IR (-O2):
define float @blue(float %0) {
%2 = fmul float %0, 0xC001AE1480000000
%3 = fmul float %0, 0x3FF9C28F60000000
%4 = tail call float @llvm.fmuladd.f32(float %2, float %0, float %3)
%5 = fadd float %4, 0x3FE2560420000000
%6 = tail call nsz float @llvm.minnum.f32(float %5, float 1.000000e+00)
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
main(int argc, char **argv) {
  puts("The AC3 decoder binary is only available inside Thomson fro "
       "demonstration purpose\n");
  puts("Please contact Henk Heijnen (henk.heijnen@thomson.net) for further "
       "details  \n");
}


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

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

LLVM IR (-O0):
@.str = [83 x i8] c"The AC3 decoder binary is only available inside Thomson fro demonstration purpose\0A\00"
@.str.1 = [78 x i8] c"Please contact Henk Heijnen (henk.heijnen@thomson.net) for further details \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @puts(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @puts(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [83 x i8] c"The AC3 decoder binary is only available inside Thomson fro demonstration purpose\0A\00"
@.str.1 = [78 x i8] c"Please contact Henk Heijnen (henk.heijnen@thomson.net) for further details \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int send(int, char *, int, int /*<<< orphan*/);
int tsend(int targetfd, char *bytes, int bytes_size) {
  int bytes_sent = 0;
  do {
    bytes_sent = send(targetfd, bytes, bytes_size, 0);
    if (bytes_sent == -1)
      return -1;
  } while (bytes_sent < bytes_size);
  return 0;
}


x86 assembly (clang, -O0):
<tsend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1153 <tsend+0x43>
movl   $0xffffffff,-0x4(%rbp)
jmp    116b <tsend+0x5b>
jmp    1158 <tsend+0x48>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     1129 <tsend+0x19>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tsend>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edi,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
cmp    $0xffffffff,%eax
je     113b <tsend+0x2b>
cmp    %ebx,%eax
jl     1120 <tsend+0x10>
xor    %eax,%eax
jmp    1140 <tsend+0x30>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @tsend(i32 %0, i8* %1, i32 %2) {
br label %4
4: ; preds = %7, %3
%5 = tail call i32 @send(i32 %0, i8* %1, i32 %2, i32 0)
%6 = icmp eq i32 %5, -1
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = icmp slt i32 %5, %2
br i1 %8, label %4, label %9
9: ; preds = %7, %4
%10 = phi i32 [ -1, %4 ], [ 0, %7 ]
ret i32 %10
}
void post_process_buffer(void) {}


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

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

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

LLVM IR (-O2):
define void @post_process_buffer() {
ret void
}
double getDelta(double a, double b, double c) { return b * b - 4 * a * c; }


x86 assembly (clang, -O0):
<getDelta>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  0xedb(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDelta>:
mulsd  0xef8(%rip),%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @getDelta(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %5
%8 = load double, double* %5
%9 = load double, double* %4
%10 = fmul double 4.000000e+00, %9
%11 = load double, double* %6
%12 = fmul double %10, %11
%13 = fneg double %12
%14 = call double @llvm.fmuladd.f64(double %7, double %8, double %13)
ret double %14
}

LLVM IR (-O2):
define double @getDelta(double %0, double %1, double %2) {
%4 = fmul double %0, -4.000000e+00
%5 = fmul double %4, %2
%6 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %5)
ret double %6
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t bit_rotl_u32(uint32_t x, int r) {
  return ((x << r) | (x >> (32 - r)));
}


x86 assembly (clang, -O0):
<bit_rotl_u32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_rotl_u32>:
mov    %esi,%ecx
mov    %edi,%eax
shl    %cl,%eax
neg    %cl
sar    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @bit_rotl_u32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = shl i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 32, %9
%11 = ashr i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @bit_rotl_u32(i32 %0, i32 %1) {
%3 = shl i32 %0, %1
%4 = sub nsw i32 32, %1
%5 = ashr i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void Help(void) {
  printf("capmerge -o <output file> <input file A> <inputfile B> .. \n");
  printf("\n");
  printf("-v                 : verbose output\n");
  printf("\n");
}


x86 assembly (clang, -O0):
<Help>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
call   1030 <printf@plt>
lea    0xf09(%rip),%rdi
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Help>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xefd(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [60 x i8] c"capmerge -o <output file> <input file A> <inputfile B> .. \0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [37 x i8] c"-v : verbose output\0A\00"
define void @Help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [59 x i8] c"capmerge -o <output file> <input file A> <inputfile B> .. \00"
@str.3 = [36 x i8] c"-v : verbose output\00"
define void @Help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
struct editor {
  int dummy;
};

/* Variables and functions */
char *editor_prompt(struct editor *, char *, int /*<<< orphan*/ *);
char *editor_prompt_filename(struct editor *e, char *prompt) {
  return editor_prompt(e, prompt, NULL);
}


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

x86 assembly (clang, -O2):
<editor_prompt_filename>:
xor    %edx,%edx
jmp    1030 <editor_prompt@plt>

LLVM IR (-O0):
%struct.editor = type { i32 }
define i8* @editor_prompt_filename(%struct.editor* %0, i8* %1) {
%3 = alloca %struct.editor*
%4 = alloca i8*
store %struct.editor* %0, %struct.editor** %3
store i8* %1, i8** %4
%5 = load %struct.editor*, %struct.editor** %3
%6 = load i8*, i8** %4
%7 = call i8* @editor_prompt(%struct.editor* %5, i8* %6, i32* null)
ret i8* %7
}

LLVM IR (-O2):
%struct.editor = type { i32 }
define i8* @editor_prompt_filename(%struct.editor* %0, i8* %1) {
%3 = tail call i8* @editor_prompt(%struct.editor* %0, i8* %1, i32* null)
ret i8* %3
}
void lib(void) {}


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

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

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

LLVM IR (-O2):
define void @lib() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdout;
void vuln() {
  char buf[128];
  gets(buf);
  puts(buf);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<vuln>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x80(%rbp),%rdi
call   1040 <gets@plt>
lea    -0x80(%rbp),%rdi
call   1030 <puts@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vuln>:
push   %rbx
sub    $0x80,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
define void @vuln() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%5 = call i32 @puts(i8* %4)
%6 = load i32, i32* @stdout
%7 = call i32 @fflush(i32 %6)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @vuln() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = call i32 @puts(i8* %2)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
ret void
}
/* Variables and functions */
scalar_t__ cset82(unsigned char const *, int const, int /*<<< orphan*/, int,
                  int, int *, int *, char *);
int x1__20(const unsigned char *data, const int data_len, int *p_err_no,
           int *p_err_posn, char err_msg[50]) {
  return data_len >= 1 && data_len <= 20 &&
         cset82(data, data_len, 0, 1, 20, p_err_no, p_err_posn, err_msg);
}


x86 assembly (clang, -O0):
<x1__20>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0xc(%rbp)
mov    %al,-0x29(%rbp)
jl     1181 <x1__20+0x71>
xor    %eax,%eax
cmpl   $0x14,-0xc(%rbp)
mov    %al,-0x29(%rbp)
jg     1181 <x1__20+0x71>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x14,%r8d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <cset82@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x1__20>:
mov    %rcx,%r10
lea    -0x1(%rsi),%ecx
xor    %eax,%eax
cmp    $0x13,%ecx
ja     114d <x1__20+0x3d>
push   %rax
mov    %r8,%r11
mov    %rdx,%r9
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x14,%r8d
push   %r11
push   %r10
call   1030 <cset82@plt>
add    $0x10,%rsp
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @x1__20(i8* %0, i32 %1, i32* %2, i32* %3, i8* %4) {
%6 = add i32 %1, -1
%7 = icmp ult i32 %6, 20
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = tail call i64 @cset82(i8* %0, i32 %1, i32 0, i32 1, i32 20, i32* %2, i32* %3, i8* %4)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %8, %5
%13 = phi i32 [ 0, %5 ], [ %11, %8 ]
ret i32 %13
}
void avcodec_dct_get_class() {}


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

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

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

LLVM IR (-O2):
define void @avcodec_dct_get_class() {
ret void
}
int test_imm_1Cuint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x1C << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_1Cuint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 28
%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_1Cuint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 28
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int ndb_cif_remove_datablock_by_name(datablockName)
char *datablockName;
{
  int datablockId;
  datablockId = ndb_cif_get_datablock_id(datablockName);
  if (datablockId == 0)
    return 0;
  else
    return (ndb_cif_remove_datablock_by_id(datablockId));
}


x86 assembly (clang, -O0):
<ndb_cif_remove_datablock_by_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <ndb_cif_get_datablock_id@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1150 <ndb_cif_remove_datablock_by_name+0x30>
movl   $0x0,-0x4(%rbp)
jmp    115d <ndb_cif_remove_datablock_by_name+0x3d>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1040 <ndb_cif_remove_datablock_by_id@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndb_cif_remove_datablock_by_name>:
push   %rax
xor    %eax,%eax
call   1030 <ndb_cif_get_datablock_id@plt>
test   %eax,%eax
je     1136 <ndb_cif_remove_datablock_by_name+0x16>
mov    %eax,%edi
xor    %eax,%eax
pop    %rcx
jmp    1040 <ndb_cif_remove_datablock_by_id@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ndb_cif_remove_datablock_by_name(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @ndb_cif_get_datablock_id to i32 (i8*, ...)*)(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %13
10: ; preds = %1
%11 = load i32, i32* %4
%12 = call i32 (i32, ...) bitcast (i32 (...)* @ndb_cif_remove_datablock_by_id to i32 (i32, ...)*)(i32 %11)
store i32 %12, i32* %2
br label %13
13: ; preds = %10, %9
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @ndb_cif_remove_datablock_by_name(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @ndb_cif_get_datablock_id to i32 (i8*, ...)*)(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @ndb_cif_remove_datablock_by_id to i32 (i32, ...)*)(i32 %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ test1();
int /*<<< orphan*/ test2();
int /*<<< orphan*/ test3();
int /*<<< orphan*/ test4();
int /*<<< orphan*/ test5();
int /*<<< orphan*/ test6();
int /*<<< orphan*/ test7();
int main(int argc, char *argv[]) {
  test1();
  test2();
  test3();
  test4();
  test5();
  test6();
  test7();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <test1@plt>
mov    $0x0,%al
call   1090 <test2@plt>
mov    $0x0,%al
call   1050 <test3@plt>
mov    $0x0,%al
call   1080 <test4@plt>
mov    $0x0,%al
call   1040 <test5@plt>
mov    $0x0,%al
call   1070 <test6@plt>
mov    $0x0,%al
call   1030 <test7@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <test1@plt>
xor    %eax,%eax
call   1090 <test2@plt>
xor    %eax,%eax
call   1050 <test3@plt>
xor    %eax,%eax
call   1080 <test4@plt>
xor    %eax,%eax
call   1040 <test5@plt>
xor    %eax,%eax
call   1070 <test6@plt>
xor    %eax,%eax
call   1030 <test7@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @test1()
%6 = call i32 (...) @test2()
%7 = call i32 (...) @test3()
%8 = call i32 (...) @test4()
%9 = call i32 (...) @test5()
%10 = call i32 (...) @test6()
%11 = call i32 (...) @test7()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test1()
%4 = tail call i32 (...) @test2()
%5 = tail call i32 (...) @test3()
%6 = tail call i32 (...) @test4()
%7 = tail call i32 (...) @test5()
%8 = tail call i32 (...) @test6()
%9 = tail call i32 (...) @test7()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ arch_local_irq_restore(unsigned long);
unsigned long arch_local_save_flags();
unsigned long arch_local_irq_save(void) {
  unsigned long flags;
  flags = arch_local_save_flags();
  arch_local_irq_restore(flags & ~1);
  return flags;
}


x86 assembly (clang, -O0):
<arch_local_irq_save>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <arch_local_save_flags@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
and    $0xfffffffffffffffe,%rdi
call   1030 <arch_local_irq_restore@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arch_local_irq_save>:
push   %rbx
xor    %eax,%eax
call   1040 <arch_local_save_flags@plt>
mov    %rax,%rbx
mov    %rax,%rdi
and    $0xfffffffffffffffe,%rdi
call   1030 <arch_local_irq_restore@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @arch_local_irq_save() {
%1 = alloca i64
%2 = call i64 (...) @arch_local_save_flags()
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = and i64 %3, -2
%5 = call i32 @arch_local_irq_restore(i64 %4)
%6 = load i64, i64* %1
ret i64 %6
}

LLVM IR (-O2):
define i64 @arch_local_irq_save() {
%1 = tail call i64 (...) @arch_local_save_flags()
%2 = and i64 %1, -2
%3 = tail call i32 @arch_local_irq_restore(i64 %2)
ret i64 %1
}
OP(fd, e8) {
  illegal_1();
  op_e8();
}


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_1@plt>
mov    $0x0,%al
call   1040 <op_e8@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @OP(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = call i32 (...) @illegal_1()
%7 = call i32 (...) @op_e8()
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_1()
%4 = tail call i32 (...) @op_e8()
ret i32 undef
}
/* Type definitions */
typedef int uint32_t;
typedef scalar_t__ time_t;
typedef int /*<<< orphan*/ out_msg;

/* Variables and functions */
int /*<<< orphan*/ _xmit(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, long);
scalar_t__ time(int /*<<< orphan*/ *);
void _modify_job(long my_job_id) {
  time_t now = time(NULL);
  char out_msg[256];
  snprintf(out_msg, sizeof(out_msg),
           "TS=%u AUTH=root DT=CMD=MODIFYJOB ARG=%ld "
           "TIMELIMIT=10 BANK=test_bank",
           (uint32_t)now, my_job_id);
  _xmit(out_msg);
}


x86 assembly (clang, -O0):
<_modify_job>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %rax,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%r8
mov    $0x100,%esi
lea    0xe97(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x110(%rbp),%rdi
call   1040 <_xmit@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_modify_job>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
call   1050 <time@plt>
lea    0xeb5(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x100,%esi
mov    %eax,%ecx
mov    %rbx,%r8
call   1030 <snprintf@plt>
mov    %r14,%rdi
call   1040 <_xmit@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [69 x i8] c"TS=%u AUTH=root DT=CMD=MODIFYJOB ARG=%ld TIMELIMIT=10 BANK=test_bank\00"
define void @_modify_job(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca [256 x i8]
store i64 %0, i64* %2
%5 = call i64 @time(i32* null)
store i64 %5, i64* %3
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = load i64, i64* %3
%8 = trunc i64 %7 to i32
%9 = load i64, i64* %2
%10 = call i32 @snprintf(i8* %6, i32 256, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i32 %8, i64 %9)
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%12 = call i32 @_xmit(i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [69 x i8] c"TS=%u AUTH=root DT=CMD=MODIFYJOB ARG=%ld TIMELIMIT=10 BANK=test_bank\00"
define void @_modify_job(i64 %0) {
%2 = alloca [256 x i8]
%3 = tail call i64 @time(i32* null)
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = trunc i64 %3 to i32
%6 = call i32 @snprintf(i8* %4, i32 256, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i32 %5, i64 %0)
%7 = call i32 @_xmit(i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  printf("Enter number:");
  scanf("%d", &a);
  if (a % 2 == 0)
    printf("четное\n");
  else
    printf("нечётное\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1170 <main+0x50>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <main+0x5c>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
testb  $0x1,0x4(%rsp)
lea    0xec8(%rip),%rax
lea    0xeb0(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Enter number:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"\D1\87\D0\B5\D1\82\D0\BD\D0\BE\D0\B5\0A\00"
@.str.3 = [18 x i8] c"\D0\BD\D0\B5\D1\87\D1\91\D1\82\D0\BD\D0\BE\D0\B5\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = srem i32 %5, 2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Enter number:\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [17 x i8] c"\D0\BD\D0\B5\D1\87\D1\91\D1\82\D0\BD\D0\BE\D0\B5\00"
@str.4 = [13 x i8] c"\D1\87\D0\B5\D1\82\D0\BD\D0\BE\D0\B5\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0)
%9 = call i32 @puts(i8* dereferenceable(1) %8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
char *dictfile_word_next(char *word, FILE *dictfile) {
  if (fscanf(dictfile, "%s", word) != EOF)
    return word;
  return NULL;
}


x86 assembly (clang, -O0):
<dictfile_word_next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rsi
call   1030 <fscanf@plt>
mov    0x2ead(%rip),%rcx
cmp    (%rcx),%rax
je     1151 <dictfile_word_next+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1159 <dictfile_word_next+0x49>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dictfile_word_next>:
push   %rbx
mov    %rsi,%rax
mov    %rdi,%rbx
lea    0xee2(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
call   1030 <fscanf@plt>
mov    0x2eb8(%rip),%rdx
xor    %ecx,%ecx
cmp    (%rdx),%rax
cmovne %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
define i8* @dictfile_word_next(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 i32*, i32** %5
%7 = load i8*, i8** %4
%8 = call i64 @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i64, i64* @EOF
%10 = icmp ne i64 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i8*, i8** %4
store i8* %12, i8** %3
br label %14
13: ; preds = %2
store i8* null, i8** %3
br label %14
14: ; preds = %13, %11
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
define i8* @dictfile_word_next(i8* %0, i32* nocapture %1) {
%3 = tail call i64 @fscanf(i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
%6 = select i1 %5, i8* null, i8* %0
ret i8* %6
}
/* Variables and functions */
int japi_getviewportwidth(int);
int j_getviewportwidth(int arg0) { return (japi_getviewportwidth(arg0)); }


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

x86 assembly (clang, -O2):
<j_getviewportwidth>:
jmp    1030 <japi_getviewportwidth@plt>

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

LLVM IR (-O2):
define i32 @j_getviewportwidth(i32 %0) {
%2 = tail call i32 @japi_getviewportwidth(i32 %0)
ret i32 %2
}
void debug(void) { __asm __volatile("xchg %bx, %bx"); }


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

x86 assembly (clang, -O2):
<debug>:
xchg   %bx,%bx
ret

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

LLVM IR (-O2):
define void @debug() {
tail call void asm sideeffect "xchg %bx, %bx", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void gui_console_only(void) { return; }


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

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

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

LLVM IR (-O2):
define void @gui_console_only() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
scalar_t__ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void wait_child(int sig) {
  while (waitpid(-1, NULL, WNOHANG) > 0)
    ;
}


x86 assembly (clang, -O0):
<wait_child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <waitpid@plt>
cmp    $0x0,%rax
jle    1141 <wait_child+0x31>
jmp    111b <wait_child+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_child>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <waitpid@plt>
test   %rax,%rax
jg     1120 <wait_child+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @wait_child(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* @WNOHANG
%5 = call i64 @waitpid(i32 -1, i32* null, i32 %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @wait_child(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = load i32, i32* @WNOHANG
%4 = tail call i64 @waitpid(i32 -1, i32* null, i32 %3)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gentable();
int /*<<< orphan*/ getinput();
int /*<<< orphan*/ initmaps();
int /*<<< orphan*/ parsearg(int, char **);
int /*<<< orphan*/ writetable();
int main(int argc, char *argv[]) {
  parsearg(argc, argv);
  initmaps();
  getinput();
  gentable();
  writetable();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <parsearg@plt>
mov    $0x0,%al
call   1060 <initmaps@plt>
mov    $0x0,%al
call   1040 <getinput@plt>
mov    $0x0,%al
call   1050 <gentable@plt>
mov    $0x0,%al
call   1030 <writetable@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1070 <parsearg@plt>
xor    %eax,%eax
call   1060 <initmaps@plt>
xor    %eax,%eax
call   1040 <getinput@plt>
xor    %eax,%eax
call   1050 <gentable@plt>
xor    %eax,%eax
call   1030 <writetable@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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 i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @parsearg(i32 %6, i8** %7)
%9 = call i32 (...) @initmaps()
%10 = call i32 (...) @getinput()
%11 = call i32 (...) @gentable()
%12 = call i32 (...) @writetable()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @parsearg(i32 %0, i8** %1)
%4 = tail call i32 (...) @initmaps()
%5 = tail call i32 (...) @getinput()
%6 = tail call i32 (...) @gentable()
%7 = tail call i32 (...) @writetable()
ret i32 0
}
char to_hex_char(int val) { return ("0123456789abcdef"[val & 0xf]); }


x86 assembly (clang, -O0):
<to_hex_char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0xee9(%rip),%rax
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_hex_char>:
and    $0xf,%edi
lea    0xef6(%rip),%rax
mov    (%rdi,%rax,1),%al
ret

LLVM IR (-O0):
@.str = [17 x i8] c"0123456789abcdef\00"
define signext i8 @to_hex_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 15
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %5
%7 = load i8, i8* %6
ret i8 %7
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789abcdef\00"
define signext i8 @to_hex_char(i32 %0) {
%2 = and i32 %0, 15
%3 = zext i32 %2 to i64
%4 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %3
%5 = load i8, i8* %4
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main() {
  printf("%f\n", 5);
  printf("%d\n", 5.01);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rdi
movsd  0xee5(%rip),%xmm0
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
movsd  0xec9(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 5.000000e+00)
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double 5.010000e+00)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 5.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double 5.010000e+00)
ret i32 0
}
int func(void) {
  int n = 3;
  short m = 5;
  n = ((int)m);
  return 0;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x4(%rbp)
movw   $0x5,-0x6(%rbp)
movswl -0x6(%rbp),%eax
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @func() {
%1 = alloca i32
%2 = alloca i16
store i32 3, i32* %1
store i16 5, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
store i32 %4, i32* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @func() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
main() {
  unsigned int a = 0xffff;
  a = ~a;
  printf("%x", + +a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xece(%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    $0xffff0000,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 -65536)
ret i32 0
}