xunge/DecIR huggingface dataset:
/* Type definitions */
struct stat {
  int st_mode;
};

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
short files_get_permissions(char *path) {
  struct stat buffer;
  if (stat(path, &buffer))
    return -1;
  else
    return (short)(buffer.st_mode & 0777);
}


x86 assembly (clang, -O0):
<files_get_permissions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     113e <files_get_permissions+0x2e>
movw   $0xffff,-0x2(%rbp)
jmp    114a <files_get_permissions+0x3a>
mov    -0x18(%rbp),%eax
and    $0x1ff,%eax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<files_get_permissions>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
movzwl (%rsp),%ecx
and    $0x1ff,%ecx
neg    %rax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define signext i16 @files_get_permissions(i8* %0) {
%2 = alloca i16
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i16 -1, i16* %2
br label %14
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = and i32 %11, 511
%13 = trunc i32 %12 to i16
store i16 %13, i16* %2
br label %14
14: ; preds = %9, %8
%15 = load i16, i16* %2
ret i16 %15
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define signext i16 @files_get_permissions(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = trunc i32 %7 to i16
%9 = and i16 %8, 511
%10 = select i1 %5, i16 %9, i16 -1
ret i16 %10
}
/* Variables and functions */
double exp(int);
double potential(double x) {
  double V = -3 * x;
  double x_ = x + 4;
  V += -50.0 * exp(-(1 + x_ * x_));
  return V;
}


x86 assembly (clang, -O0):
<potential>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef3(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xed9(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb1(%rip),%xmm1
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <exp@plt>
movsd  -0x10(%rbp),%xmm1
movsd  0xe78(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<potential>:
push   %rax
movsd  0xee7(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
addsd  0xede(%rip),%xmm0
mulsd  %xmm0,%xmm0
addsd  0xeda(%rip),%xmm0
xorpd  0xee2(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <exp@plt>
mulsd  0xec9(%rip),%xmm0
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @potential(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = fmul double -3.000000e+00, %5
store double %6, double* %3
%7 = load double, double* %2
%8 = fadd double %7, 4.000000e+00
store double %8, double* %4
%9 = load double, double* %4
%10 = load double, double* %4
%11 = call double @llvm.fmuladd.f64(double %9, double %10, double 1.000000e+00)
%12 = fneg double %11
%13 = fptosi double %12 to i32
%14 = call double @exp(i32 %13)
%15 = load double, double* %3
%16 = call double @llvm.fmuladd.f64(double -5.000000e+01, double %14, double %15)
store double %16, double* %3
%17 = load double, double* %3
ret double %17
}

LLVM IR (-O2):
define double @potential(double %0) {
%2 = fmul double %0, -3.000000e+00
%3 = fadd double %0, 4.000000e+00
%4 = tail call double @llvm.fmuladd.f64(double %3, double %3, double 1.000000e+00)
%5 = fneg double %4
%6 = fptosi double %5 to i32
%7 = tail call double @exp(i32 %6)
%8 = tail call double @llvm.fmuladd.f64(double %7, double -5.000000e+01, double %2)
ret double %8
}
int main(void) {
  int a = 2;
  return ((a) * (4));
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 8
}
void alrm_handler(int signo __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
define void @alrm_handler(i32 %0) {
ret void
}
float level(float v, float h) {
  float r = (v / h + 1.0f) * 0.5f;
  if (r < 0.0)
    r = 0.0f;
  if (r > 1.0)
    r = 1.0f;
  return r;
}


x86 assembly (clang, -O0):
<level>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  0xee4(%rip),%xmm1
addss  %xmm1,%xmm0
movss  0xed4(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1153 <level+0x53>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    117b <level+0x7b>
movss  0xe8e(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<level>:
divss  %xmm1,%xmm0
movss  0xef4(%rip),%xmm1
addss  %xmm1,%xmm0
mulss  0xeec(%rip),%xmm0
xorps  %xmm2,%xmm2
maxss  %xmm0,%xmm2
minss  %xmm2,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @level(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %4
%8 = fdiv float %6, %7
%9 = fadd float %8, 1.000000e+00
%10 = fmul float %9, 5.000000e-01
store float %10, float* %5
%11 = load float, float* %5
%12 = fpext float %11 to double
%13 = fcmp olt double %12, 0.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %2
store float 0.000000e+00, float* %5
br label %15
15: ; preds = %14, %2
%16 = load float, float* %5
%17 = fpext float %16 to double
%18 = fcmp ogt double %17, 1.000000e+00
br i1 %18, label %19, label %20
19: ; preds = %15
store float 1.000000e+00, float* %5
br label %20
20: ; preds = %19, %15
%21 = load float, float* %5
ret float %21
}

LLVM IR (-O2):
define float @level(float %0, float %1) {
%3 = fdiv float %0, %1
%4 = fadd float %3, 1.000000e+00
%5 = fmul float %4, 5.000000e-01
%6 = fcmp olt float %5, 0.000000e+00
%7 = select i1 %6, float 0.000000e+00, float %5
%8 = fcmp ogt float %7, 1.000000e+00
%9 = select i1 %8, float 1.000000e+00, float %7
ret float %9
}
/* Variables and functions */
int get_byte(unsigned char **);
unsigned short get_word(unsigned char **p) {
  return (get_byte(p) | (get_byte(p) << 8));
}


x86 assembly (clang, -O0):
<get_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_byte@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_byte@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
shl    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_word>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <get_byte@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <get_byte@plt>
shl    $0x8,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i16 @get_word(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = call i32 @get_byte(i8** %3)
%5 = load i8**, i8*** %2
%6 = call i32 @get_byte(i8** %5)
%7 = shl i32 %6, 8
%8 = or i32 %4, %7
%9 = trunc i32 %8 to i16
ret i16 %9
}

LLVM IR (-O2):
define zeroext i16 @get_word(i8** %0) {
%2 = tail call i32 @get_byte(i8** %0)
%3 = tail call i32 @get_byte(i8** %0)
%4 = shl i32 %3, 8
%5 = or i32 %4, %2
%6 = trunc i32 %5 to i16
ret i16 %6
}
void inc_zcache_eph_zpages(void) {}


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

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

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

LLVM IR (-O2):
define void @inc_zcache_eph_zpages() {
ret void
}
/* Variables and functions */
int O_CREAT;
int O_WRONLY;
int /*<<< orphan*/ exit(int);
int open(char const *, int, int);
int /*<<< orphan*/ perror(char *);
void do_open_wr(const char *fname, int *fd) {
  *fd = open(fname, O_WRONLY | O_CREAT, 0644);
  if (*fd < 0) {
    perror("open");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<do_open_wr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e85(%rip),%rax
mov    (%rax),%esi
mov    0x2ea4(%rip),%rax
or     (%rax),%esi
mov    $0x1a4,%edx
call   1030 <open@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jge    118b <do_open_wr+0x5b>
lea    0xe84(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_open_wr>:
push   %rbx
mov    %rsi,%rbx
mov    0x2e95(%rip),%rax
mov    0x2eb6(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    $0x1a4,%edx
call   1030 <open@plt>
mov    %eax,(%rbx)
test   %eax,%eax
js     1158 <do_open_wr+0x28>
pop    %rbx
ret
lea    0xea1(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@.str = [5 x i8] c"open\00"
define void @do_open_wr(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = load i32, i32* @O_WRONLY
%7 = load i32, i32* @O_CREAT
%8 = or i32 %6, %7
%9 = call i32 @open(i8* %5, i32 %8, i32 420)
%10 = load i32*, i32** %4
store i32 %9, i32* %10
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
ret void
}

LLVM IR (-O2):
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@.str = [5 x i8] c"open\00"
define void @do_open_wr(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* @O_WRONLY
%4 = load i32, i32* @O_CREAT
%5 = or i32 %4, %3
%6 = tail call i32 @open(i8* %0, i32 %5, i32 420)
store i32 %6, i32* %1
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ omp_lock_t;

/* Variables and functions */
int /*<<< orphan*/ omp_init_lock(int /*<<< orphan*/ *);
void Init_locks(omp_lock_t locks[], int n) {
  int i;
  for (i = 0; i < n; i++)
    omp_init_lock(&locks[i]);
}


x86 assembly (clang, -O0):
<Init_locks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1154 <Init_locks+0x44>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <omp_init_lock@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <Init_locks+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Init_locks>:
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    1132 <Init_locks+0x22>
mov    %rdi,%rbx
mov    %esi,%r14d
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <omp_init_lock@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r14
jne    1120 <Init_locks+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @Init_locks(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = tail call i32 @omp_init_lock(i32* %8)
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret void
}
void Draw_ClearBounds(void) {}


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

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

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

LLVM IR (-O2):
define void @Draw_ClearBounds() {
ret void
}
unsigned short swapu16_1(unsigned short x) { return (x << 8) | (x >> 8); }


x86 assembly (clang, -O0):
<swapu16_1>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
shl    $0x8,%eax
movzwl -0x2(%rbp),%ecx
sar    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapu16_1>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @swapu16_1(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = shl i32 %4, 8
%6 = load i16, i16* %2
%7 = zext i16 %6 to i32
%8 = ashr i32 %7, 8
%9 = or i32 %5, %8
%10 = trunc i32 %9 to i16
ret i16 %10
}

LLVM IR (-O2):
define zeroext i16 @swapu16_1(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int count_digits(uint64_t value) {
  int len = 0;
  if (value == 0)
    return 1;
  while (value) {
    value /= 10;
    len++;
  }
  return len;
}


x86 assembly (clang, -O0):
<count_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1124 <count_digits+0x24>
movl   $0x1,-0x4(%rbp)
jmp    1155 <count_digits+0x55>
jmp    1129 <count_digits+0x29>
cmpl   $0x0,-0x8(%rbp)
je     114f <count_digits+0x4f>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <count_digits+0x29>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_digits>:
test   %edi,%edi
je     1133 <count_digits+0x33>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x1,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <count_digits+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @count_digits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = sdiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = add i32 %5, 9
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 1, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void aix_info(void) {
  puts("\n\tThere is a valid AIX label on this disk.\n"
       "\tUnfortunately Linux cannot handle these\n"
       "\tdisks at the moment.  Nevertheless some\n"
       "\tadvice:\n"
       "\t1. fdisk will destroy its contents on write.\n"
       "\t2. Be sure that this disk is NOT a still vital\n"
       "\t   part of a volume group. (Otherwise you may\n"
       "\t   erase the other disks as well, if unmirrored.)\n"
       "\t3. Before deleting this physical volume be sure\n"
       "\t   to remove the disk logically from your AIX\n"
       "\t   machine.  (Otherwise you become an AIXpert).");
}


x86 assembly (clang, -O0):
<aix_info>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<aix_info>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [471 x i8] c"\0A\09There is a valid AIX label on this disk.\0A\09Unfortunately Linux cannot handle these\0A\09disks at the moment. Nevertheless some\0A\09advice:\0A\091. fdisk will destroy its contents on write.\0A\092. Be sure that this disk is NOT a still vital\0A\09 part of a volume group. (Otherwise you may\0A\09 erase the other disks as well, if unmirrored.)\0A\093. Before deleting this physical volume be sure\0A\09 to remove the disk logically from your AIX\0A\09 machine. (Otherwise you become an AIXpert).\00"
define void @aix_info() {
%1 = call i32 @puts(i8* getelementptr inbounds ([471 x i8], [471 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [471 x i8] c"\0A\09There is a valid AIX label on this disk.\0A\09Unfortunately Linux cannot handle these\0A\09disks at the moment. Nevertheless some\0A\09advice:\0A\091. fdisk will destroy its contents on write.\0A\092. Be sure that this disk is NOT a still vital\0A\09 part of a volume group. (Otherwise you may\0A\09 erase the other disks as well, if unmirrored.)\0A\093. Before deleting this physical volume be sure\0A\09 to remove the disk logically from your AIX\0A\09 machine. (Otherwise you become an AIXpert).\00"
define void @aix_info() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([471 x i8], [471 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int ivory_serialize_unpack_prim_4_le(int /*<<< orphan*/ const *);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int *, int);
void ivory_serialize_unpack_int32_le(const uint8_t *src, uint32_t offs,
                                     int32_t *dst) {
  uint32_t tmp = ivory_serialize_unpack_prim_4_le(src + offs);
  memcpy(dst, &tmp, sizeof(*dst));
}


x86 assembly (clang, -O0):
<ivory_serialize_unpack_int32_le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <ivory_serialize_unpack_prim_4_le@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivory_serialize_unpack_int32_le>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
movslq %esi,%rax
lea    (%rdi,%rax,4),%rdi
call   1030 <ivory_serialize_unpack_prim_4_le@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ivory_serialize_unpack_int32_le(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = tail call i32 @ivory_serialize_unpack_prim_4_le(i32* %7)
store i32 %8, i32* %4
%9 = call i32 @memcpy(i32* %2, i32* %4, i32 4)
ret void
}
void reshape(int w, int h) {}


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

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

LLVM IR (-O0):
define void @reshape(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 @reshape(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
uint32_t good_rand(int32_t x) {
  int32_t hi, lo;
  if (x == 0)
    x = 123459876;
  hi = x / 127773;
  lo = x % 127773;
  x = 16807 * lo - 2836 * hi;
  if (x < 0)
    x += 0x7fffffff;
  return (x);
}


x86 assembly (clang, -O0):
<good_rand>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1118 <good_rand+0x18>
movl   $0x75bd924,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x1f31d,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x1f31d,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
imul   $0x41a7,-0xc(%rbp),%eax
imul   $0xb14,-0x8(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    115c <good_rand+0x5c>
mov    -0x4(%rbp),%eax
add    $0x7fffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<good_rand>:
test   %edi,%edi
mov    $0x75bd924,%eax
cmovne %edi,%eax
cltq
imul   $0xffffffff834e0b5f,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x10,%ecx
add    %edx,%ecx
imul   $0x1f31d,%ecx,%edx
sub    %edx,%eax
imul   $0x41a7,%eax,%edx
imul   $0xfffff4ec,%ecx,%ecx
lea    (%rcx,%rdx,1),%eax
add    $0x7fffffff,%eax
add    %edx,%ecx
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @good_rand(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 123459876, i32* %2
br label %8
8: ; preds = %7, %1
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 127773
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = srem i32 %11, 127773
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = mul nsw i32 16807, %13
%15 = load i32, i32* %3
%16 = mul nsw i32 2836, %15
%17 = sub nsw i32 %14, %16
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %8
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 2147483647
store i32 %22, i32* %2
br label %23
23: ; preds = %20, %8
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @good_rand(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i32 123459876, i32 %0
%4 = sdiv i32 %3, 127773
%5 = srem i32 %3, 127773
%6 = mul nsw i32 %5, 16807
%7 = mul nsw i32 %4, -2836
%8 = add i32 %7, %6
%9 = icmp slt i32 %8, 0
%10 = add nsw i32 %8, 2147483647
%11 = select i1 %9, i32 %10, i32 %8
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ __nr_to_section(unsigned long);
int valid_section(int /*<<< orphan*/);
__attribute__((always_)) int pfn_valid(unsigned long pfn) {
  if (((pfn) >> (27 - 12)) >= (1UL << (46 - 27)))
    return 0;
  return valid_section(__nr_to_section(((pfn) >> (27 - 12))));
}


x86 assembly (clang, -O0):
<pfn_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0xf,%rax
cmp    $0x80000,%rax
jb     114c <pfn_valid+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1163 <pfn_valid+0x43>
mov    -0x10(%rbp),%rdi
shr    $0xf,%rdi
call   1030 <__nr_to_section@plt>
mov    %eax,%edi
call   1040 <valid_section@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pfn_valid>:
mov    %rdi,%rax
shr    $0x22,%rax
je     112c <pfn_valid+0xc>
xor    %eax,%eax
ret
push   %rax
shr    $0xf,%rdi
call   1030 <__nr_to_section@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <valid_section@plt>

LLVM IR (-O0):
define i32 @pfn_valid(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = lshr i64 %4, 15
%6 = icmp uge i64 %5, 524288
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %13
8: ; preds = %1
%9 = load i64, i64* %3
%10 = lshr i64 %9, 15
%11 = call i32 @__nr_to_section(i64 %10)
%12 = call i32 @valid_section(i32 %11)
store i32 %12, i32* %2
br label %13
13: ; preds = %8, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @pfn_valid(i64 %0) {
%2 = icmp ugt i64 %0, 17179869183
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = lshr i64 %0, 15
%5 = tail call i32 @__nr_to_section(i64 %4)
%6 = tail call i32 @valid_section(i32 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
void window_dropdown_emptysub() {}


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

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

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

LLVM IR (-O2):
define void @window_dropdown_emptysub() {
ret void
}
int kpt_min(const int a, const int b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<kpt_min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <kpt_min+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <kpt_min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kpt_min>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @kpt_min(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 = icmp slt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @kpt_min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void die(const char *str) {
  printf("%s\n", str);
  exit(1);
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @die(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int fact = 1;
  int i;
  for (i = 1; i <= 10; i++) {
    fact *= i;
  }
  printf("%d", fact);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jg     114f <main+0x3f>
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xea7(%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    $0x375f00,%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* %2
store i32 1, i32* %3
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 10
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = mul nsw i32 %9, %8
store i32 %10, i32* %2
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %2
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
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 3628800)
ret i32 0
}
void game() {}


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

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

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

LLVM IR (-O2):
define void @game() {
ret void
}
int validate_buffers(char *buffer1, char *buffer2, int size) {
  int i;
  for (i = 0; i < size; i++) {
    if (buffer1[i] != buffer2[i]) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<validate_buffers>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1161 <validate_buffers+0x61>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     114e <validate_buffers+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1168 <validate_buffers+0x68>
jmp    1153 <validate_buffers+0x53>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <validate_buffers+0x16>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_buffers>:
mov    $0x1,%eax
test   %edx,%edx
jle    1122 <validate_buffers+0x22>
mov    %edx,%r8d
xor    %edx,%edx
xchg   %ax,%ax
movzbl (%rdi,%rdx,1),%ecx
cmp    (%rsi,%rdx,1),%cl
jne    1123 <validate_buffers+0x23>
add    $0x1,%rdx
cmp    %rdx,%r8
jne    1110 <validate_buffers+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @validate_buffers(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %1, i64 %10
%14 = load i8, i8* %13
%15 = icmp eq i8 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9, %7, %3
%18 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %18
}
void isr_int_breakpoint() {}


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

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

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

LLVM IR (-O2):
define void @isr_int_breakpoint() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pop();
int /*<<< orphan*/ vid_writef(char *, int /*<<< orphan*/);
void logvar_handler(void) { vid_writef("%d", pop()); }


x86 assembly (clang, -O0):
<logvar_handler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <pop@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
call   1040 <vid_writef@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<logvar_handler>:
push   %rax
xor    %eax,%eax
call   1030 <pop@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <vid_writef@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @logvar_handler() {
%1 = call i32 (...) @pop()
%2 = call i32 @vid_writef(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @logvar_handler() {
%1 = tail call i32 (...) @pop()
%2 = tail call i32 @vid_writef(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ isspace(int);
int isprint(int c) { return isspace(c) || (c >= 32 && c < 127); }


x86 assembly (clang, -O0):
<isprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isspace@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    1154 <isprint+0x44>
xor    %eax,%eax
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     114e <isprint+0x3e>
cmpl   $0x7f,-0x4(%rbp)
setl   %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isprint>:
push   %rbx
mov    %edi,%ebx
call   1030 <isspace@plt>
test   %rax,%rax
setne  %al
add    $0xffffffe0,%ebx
cmp    $0x5f,%ebx
setb   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isprint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isspace(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sge i32 %7, 32
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 127
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ false, %6 ], [ %11, %9 ]
br label %14
14: ; preds = %12, %1
%15 = phi i1 [ true, %1 ], [ %13, %12 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @isprint(i32 %0) {
%2 = tail call i64 @isspace(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = add i32 %0, -32
%5 = icmp ult i32 %4, 95
%6 = or i1 %5, %3
%7 = zext i1 %6 to i32
ret i32 %7
}
void BLANK_STR(char *STRING) {
  int I;
  for (I = 0; I < 8; I++)
    STRING[I] = ' ';
  STRING[8] = '\0';
}


x86 assembly (clang, -O0):
<BLANK_STR>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1133 <BLANK_STR+0x33>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <BLANK_STR+0xf>
mov    -0x8(%rbp),%rax
movb   $0x0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BLANK_STR>:
movabs $0x2020202020202020,%rax
20 20 20
mov    %rax,(%rdi)
movb   $0x0,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @BLANK_STR(i8* nocapture writeonly %0) {
%2 = bitcast i8* %0 to i64*
store i64 2314885530818453536, i64* %2
%3 = getelementptr inbounds i8, i8* %0, i64 8
store i8 0, i8* %3
ret void
}
int is_power_of_2(unsigned int x, unsigned int y) {
  if (y == x) {
    return 1;
  }
  if (y > x) {
    return 0;
  } else {
    is_power_of_2(x, y * 2);
  }
}


x86 assembly (clang, -O0):
<is_power_of_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1136 <is_power_of_2+0x26>
movl   $0x1,-0x4(%rbp)
jmp    115c <is_power_of_2+0x4c>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jbe    114e <is_power_of_2+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    115c <is_power_of_2+0x4c>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
call   1030 <is_power_of_2@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_power_of_2>:
mov    $0x1,%eax
cmp    %edi,%esi
je     1125 <is_power_of_2+0x25>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %edi,%esi
ja     111e <is_power_of_2+0x1e>
add    %esi,%esi
mov    $0x1,%cl
cmp    %edi,%esi
jne    1110 <is_power_of_2+0x10>
jmp    1125 <is_power_of_2+0x25>
xor    %eax,%eax
test   $0x1,%cl
je     1125 <is_power_of_2+0x25>
ret

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

LLVM IR (-O2):
define i32 @is_power_of_2(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, %0
br i1 %3, label %16, label %4
4: ; preds = %2, %9
%5 = phi i1 [ true, %9 ], [ false, %2 ]
%6 = phi i32 [ %11, %9 ], [ undef, %2 ]
%7 = phi i32 [ %10, %9 ], [ %1, %2 ]
%8 = icmp ugt i32 %7, %0
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = shl i32 %7, 1
%11 = select i1 %5, i32 %6, i32 undef
%12 = icmp eq i32 %10, %0
br i1 %12, label %14, label %4
13: ; preds = %4
br i1 %5, label %14, label %16
14: ; preds = %9, %13
%15 = phi i32 [ %6, %13 ], [ %11, %9 ]
br label %16
16: ; preds = %2, %13, %14
%17 = phi i32 [ %15, %14 ], [ 0, %13 ], [ 1, %2 ]
ret i32 %17
}
void strlcpy(char *dst, const char *src, unsigned siz) {
  while (siz > 1 && *src) {
    *dst = *src;
    dst++;
    src++;
    siz--;
  }
  *dst = '\0';
}


x86 assembly (clang, -O0):
<strlcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jbe    112e <strlcpy+0x2e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    113e <strlcpy+0x3e>
jmp    1170 <strlcpy+0x70>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <strlcpy+0xf>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlcpy>:
cmp    $0x2,%edx
jb     1129 <strlcpy+0x29>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi),%eax
test   %al,%al
je     1129 <strlcpy+0x29>
mov    %al,(%rdi)
add    $0x1,%rdi
add    $0x1,%rsi
add    $0xffffffff,%edx
cmp    $0x1,%edx
ja     1110 <strlcpy+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @strlcpy(i8* nocapture writeonly %0, i8* nocapture %1, i32 %2) {
%4 = icmp ugt i32 %2, 1
br i1 %4, label %5, label %16
5: ; preds = %3, %11
%6 = phi i32 [ %14, %11 ], [ %2, %3 ]
%7 = phi i8* [ %13, %11 ], [ %1, %3 ]
%8 = phi i8* [ %12, %11 ], [ %0, %3 ]
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %5
store i8 %9, i8* %8
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = add i32 %6, -1
%15 = icmp ugt i32 %14, 1
br i1 %15, label %5, label %16
16: ; preds = %5, %11, %3
%17 = phi i8* [ %0, %3 ], [ %12, %11 ], [ %8, %5 ]
store i8 0, i8* %17
ret void
}
void SteamAPI_ISteamHTMLSurface_KeyUp(void *self) {
  xlogf("%s(self = %p)\n", __func__, self);
}


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

x86 assembly (clang, -O2):
<SteamAPI_ISteamHTMLSurface_KeyUp>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamHTMLSurface_KeyUp = [33 x i8] c"SteamAPI_ISteamHTMLSurface_KeyUp\00"
define void @SteamAPI_ISteamHTMLSurface_KeyUp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @__func__.SteamAPI_ISteamHTMLSurface_KeyUp, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamHTMLSurface_KeyUp = [33 x i8] c"SteamAPI_ISteamHTMLSurface_KeyUp\00"
define void @SteamAPI_ISteamHTMLSurface_KeyUp(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @__func__.SteamAPI_ISteamHTMLSurface_KeyUp, i64 0, i64 0), i8* %0)
ret void
}
void bcm_host_init(void) {}


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

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

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

LLVM IR (-O2):
define void @bcm_host_init() {
ret void
}
/* Type definitions */
struct passwd {
  int /*<<< orphan*/ pw_uid;
};
struct lastlog {
  int dummy;
};

/* Variables and functions */
struct lastlog *getlluid(int /*<<< orphan*/);
struct passwd *getpwnam(char *);
struct lastlog *getllnam(char *logname) {
  struct passwd *pwd;
  struct lastlog *llent;
  if ((pwd = getpwnam(logname))) {
    llent = getlluid(pwd->pw_uid);
  } else {
    llent = (void *)0;
  }
  return llent;
}


x86 assembly (clang, -O0):
<getllnam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getpwnam@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1157 <getllnam+0x37>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <getlluid@plt>
mov    %rax,-0x18(%rbp)
jmp    115f <getllnam+0x3f>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getllnam>:
push   %rax
call   1040 <getpwnam@plt>
test   %rax,%rax
je     1133 <getllnam+0x13>
mov    (%rax),%edi
pop    %rax
jmp    1030 <getlluid@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.lastlog = type { i32 }
%struct.passwd = type { i32 }
define %struct.lastlog* @getllnam(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.passwd*
%4 = alloca %struct.lastlog*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call %struct.passwd* @getpwnam(i8* %5)
store %struct.passwd* %6, %struct.passwd** %3
%7 = icmp ne %struct.passwd* %6, null
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load %struct.passwd*, %struct.passwd** %3
%10 = getelementptr inbounds %struct.passwd, %struct.passwd* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call %struct.lastlog* @getlluid(i32 %11)
store %struct.lastlog* %12, %struct.lastlog** %4
br label %14
13: ; preds = %1
store %struct.lastlog* null, %struct.lastlog** %4
br label %14
14: ; preds = %13, %8
%15 = load %struct.lastlog*, %struct.lastlog** %4
ret %struct.lastlog* %15
}

LLVM IR (-O2):
%struct.lastlog = type { i32 }
%struct.passwd = type { i32 }
define %struct.lastlog* @getllnam(i8* nocapture %0) {
%2 = tail call %struct.passwd* @getpwnam(i8* %0)
%3 = icmp eq %struct.passwd* %2, null
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = getelementptr inbounds %struct.passwd, %struct.passwd* %2, i64 0, i32 0
%6 = load i32, i32* %5
%7 = tail call %struct.lastlog* @getlluid(i32 %6)
br label %8
8: ; preds = %1, %4
%9 = phi %struct.lastlog* [ %7, %4 ], [ null, %1 ]
ret %struct.lastlog* %9
}
int sys_rewinddir(int fd) {}


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

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

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

LLVM IR (-O2):
define i32 @sys_rewinddir(i32 %0) {
ret i32 undef
}
int Less(int left, int right) { return (left < right); }


x86 assembly (clang, -O0):
<Less>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Less>:
xor    %eax,%eax
cmp    %esi,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @Less(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 = icmp slt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @Less(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ g(char *);
void f() {
  char c;
  g(&c);
}


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

x86 assembly (clang, -O2):
<f>:
push   %rax
lea    0x7(%rsp),%rdi
call   1030 <g@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @f() {
%1 = alloca i8
%2 = call i32 @g(i8* %1)
ret void
}

LLVM IR (-O2):
define void @f() {
%1 = alloca i8
%2 = call i32 @g(i8* %1)
ret void
}