xunge/DecIR huggingface dataset:
/* Variables and functions */
double HUGE_VAL;
double strtod(char const *, char **);
int parse_double(const char *str, double *f) {
  char *end;
  double x = strtod(str, &end);
  if (*end)
    return 1;
  if (x == HUGE_VAL)
    return 1;
  *f = x;
  return 0;
}


x86 assembly (clang, -O0):
<parse_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <parse_double+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1187 <parse_double+0x77>
movsd  -0x28(%rbp),%xmm0
mov    0x2e91(%rip),%rax
ucomisd (%rax),%xmm0
jne    1173 <parse_double+0x63>
jp     1173 <parse_double+0x63>
movl   $0x1,-0x4(%rbp)
jmp    1187 <parse_double+0x77>
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_double>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
call   1030 <strtod@plt>
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
mov    $0x1,%eax
jne    1146 <parse_double+0x36>
mov    0x2eb0(%rip),%rcx
ucomisd (%rcx),%xmm0
jne    1140 <parse_double+0x30>
jnp    1146 <parse_double+0x36>
movsd  %xmm0,(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@HUGE_VAL = global double 0.000000e+00
define i32 @parse_double(i8* %0, double* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i8*
%7 = alloca double
store i8* %0, i8** %4
store double* %1, double** %5
%8 = load i8*, i8** %4
%9 = call double @strtod(i8* %8, i8** %6)
store double %9, double* %7
%10 = load i8*, i8** %6
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 1, i32* %3
br label %22
14: ; preds = %2
%15 = load double, double* %7
%16 = load double, double* @HUGE_VAL
%17 = fcmp oeq double %15, %16
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 1, i32* %3
br label %22
19: ; preds = %14
%20 = load double, double* %7
%21 = load double*, double** %5
store double %20, double* %21
store i32 0, i32* %3
br label %22
22: ; preds = %19, %18, %13
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@HUGE_VAL = global double 0.000000e+00
define i32 @parse_double(i8* %0, double* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call double @strtod(i8* %0, i8** %3)
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
%9 = load double, double* @HUGE_VAL
%10 = fcmp oeq double %5, %9
%11 = select i1 %8, i1 true, i1 %10
br i1 %11, label %13, label %12
12: ; preds = %2
store double %5, double* %1
br label %13
13: ; preds = %2, %12
%14 = phi i32 [ 0, %12 ], [ 1, %2 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ base64_encode_padded(char *, int, unsigned long);
const char *snum2str(unsigned long snum) {
  static char buf[2 + 1];
  base64_encode_padded(buf, sizeof(buf), snum);
  return buf;
}


x86 assembly (clang, -O0):
<snum2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0x2f02(%rip),%rdi
mov    $0x3,%esi
call   1030 <base64_encode_padded@plt>
lea    0x2ef1(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snum2str>:
push   %rbx
mov    %rdi,%rdx
lea    0x2f0e(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <base64_encode_padded@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@snum2str.buf = internal global [3 x i8] zeroinitializer
define i8* @snum2str(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @base64_encode_padded(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @snum2str.buf, i64 0, i64 0), i32 3, i64 %3)
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @snum2str.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@snum2str.buf = internal global [3 x i8] zeroinitializer
define i8* @snum2str(i64 %0) {
%2 = tail call i32 @base64_encode_padded(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @snum2str.buf, i64 0, i64 0), i32 3, i64 %0)
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @snum2str.buf, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int syscall(int, int, char const *, int /*<<< orphan*/);
int inotify_add_watch(int fd, const char *name, uint32_t mask) {
  return syscall(254, fd, name, mask);
}


x86 assembly (clang, -O0):
<inotify_add_watch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0xfe,%edi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inotify_add_watch>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0xfe,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @inotify_add_watch(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @syscall(i32 254, i32 %7, i8* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @inotify_add_watch(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @syscall(i32 254, i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void kernel__Char__output(char self) {
  printf("%c", self);
RET_LABEL:;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @kernel__Char__output(i8 signext %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %0)
ret void
}
/* Variables and functions */
int pm8058_mpp_config(unsigned int, int, unsigned int, unsigned int);
int pm8058_mpp_config_dtest_sink(unsigned mpp, unsigned level,
                                 unsigned control) {
  return pm8058_mpp_config(mpp, 6, level, control);
}


x86 assembly (clang, -O0):
<pm8058_mpp_config_dtest_sink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    $0x6,%esi
call   1030 <pm8058_mpp_config@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pm8058_mpp_config_dtest_sink>:
mov    %edx,%ecx
mov    %esi,%edx
mov    $0x6,%esi
jmp    1030 <pm8058_mpp_config@plt>

LLVM IR (-O0):
define i32 @pm8058_mpp_config_dtest_sink(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @pm8058_mpp_config(i32 %7, i32 6, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @pm8058_mpp_config_dtest_sink(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @pm8058_mpp_config(i32 %0, i32 6, i32 %1, i32 %2)
ret i32 %4
}
int ld_eq_rc1(long double a1) { return (((a1) == (100))); }


x86 assembly (clang, -O0):
<ld_eq_rc1>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
flds   0xeed(%rip)
fucomip %st(1),%st
fstp   %st(0)
setnp  %cl
sete   %al
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_eq_rc1>:
fldt   0x8(%rsp)
flds   0xef6(%rip)
fucomip %st(1),%st
fstp   %st(0)
setnp  %al
sete   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @ld_eq_rc1(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fcmp oeq x86_fp80 %3, 0xK4005C800000000000000
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @ld_eq_rc1(x86_fp80 %0) {
%2 = fcmp oeq x86_fp80 %0, 0xK4005C800000000000000
%3 = zext i1 %2 to i32
ret i32 %3
}
extern int logInfo(const char *format, ...) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @logInfo(i8* nocapture readnone %0, ...) {
ret i32 0
}
/* Variables and functions */
double rand1();
void InitReserve(int puno, double prop, int *R) {
  int i;
  for (i = 0; i < puno; i++)
    R[i] = rand1() < prop ? 1 : 0;
}


x86 assembly (clang, -O0):
<InitReserve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    116d <InitReserve+0x5d>
mov    $0x0,%al
call   1030 <rand1@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
xor    %edx,%edx
mov    $0x1,%eax
ucomisd %xmm1,%xmm0
cmova  %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <InitReserve+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InitReserve>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %edi,%edi
jle    1153 <InitReserve+0x43>
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebx,%ebx
movsd  %xmm0,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand1@plt>
xor    %eax,%eax
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
seta   %al
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <InitReserve+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @InitReserve(i32 %0, double %1, i32* nocapture writeonly %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %13, %7 ]
%9 = tail call double (...) @rand1()
%10 = fcmp olt double %9, %1
%11 = zext i1 %10 to i32
%12 = getelementptr inbounds i32, i32* %2, i64 %8
store i32 %11, i32* %12
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %15, label %7
15: ; preds = %7, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(char);
int is_numeric(char *str) {
  char *c = str;
  while (*c) {
    if (!isdigit(*c))
      return 0;
    ++c;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_numeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1163 <is_numeric+0x53>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1152 <is_numeric+0x42>
movl   $0x0,-0x4(%rbp)
jmp    116a <is_numeric+0x5a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1124 <is_numeric+0x14>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_numeric>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <is_numeric+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1149 <is_numeric+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <is_numeric+0x20>
jmp    114b <is_numeric+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @is_numeric(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i32 @isdigit(i8 signext %8)
%11 = icmp eq i32 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
float lib_sqrtapprox(float x) {
  int32_t i;
  i = *((int32_t *)&x);
  i = 0x1fc00000 + (i >> 1);
  x = *((float *)&i);
  return x;
}


x86 assembly (clang, -O0):
<lib_sqrtapprox>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
add    $0x1fc00000,%eax
mov    %eax,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lib_sqrtapprox>:
movd   %xmm0,%eax
sar    %eax
add    $0x1fc00000,%eax
movd   %eax,%xmm0
ret

LLVM IR (-O0):
define float @lib_sqrtapprox(float %0) {
%2 = alloca float
%3 = alloca i32
store float %0, float* %2
%4 = bitcast float* %2 to i32*
%5 = load i32, i32* %4
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = ashr i32 %6, 1
%8 = add nsw i32 532676608, %7
store i32 %8, i32* %3
%9 = bitcast i32* %3 to float*
%10 = load float, float* %9
store float %10, float* %2
%11 = load float, float* %2
ret float %11
}

LLVM IR (-O2):
define float @lib_sqrtapprox(float %0) {
%2 = bitcast float %0 to i32
%3 = ashr i32 %2, 1
%4 = add nsw i32 %3, 532676608
%5 = bitcast i32 %4 to float
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ close(int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  close(STDIN_FILENO);
  sleep(1);
  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    0x2ea3(%rip),%rax
mov    (%rax),%edi
call   1030 <close@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
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* @STDIN_FILENO
%7 = call i32 @close(i32 %6)
%8 = call i32 @sleep(i32 1)
ret i32 0
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @STDIN_FILENO
%4 = tail call i32 @close(i32 %3)
%5 = tail call i32 @sleep(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help(void) {
  printf(" ?          : print help\n"
         " q          : quit\n"
         " p          : print tasks\n"
         " k <id>     : kill task identified by id\n"
         " e <program>: execute program\n"
         " h <id>     : set task identified by id to high priority\n"
         " l <id>     : set task identified by id to low priority\n");
}


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

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

LLVM IR (-O0):
@.str = [255 x i8] c" ? : print help\0A q : quit\0A p : print tasks\0A k <id> : kill task identified by id\0A e <program>: execute program\0A h <id> : set task identified by id to high priority\0A l <id> : set task identified by id to low priority\0A\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([255 x i8], [255 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [254 x i8] c" ? : print help\0A q : quit\0A p : print tasks\0A k <id> : kill task identified by id\0A e <program>: execute program\0A h <id> : set task identified by id to high priority\0A l <id> : set task identified by id to low priority\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([254 x i8], [254 x i8]* @str, i64 0, i64 0))
ret void
}
int getGCD(int a, int b) {
  if (b == 0)
    return a;
  else
    return getGCD(b, a % b);
}


x86 assembly (clang, -O0):
<getGCD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <getGCD+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <getGCD+0x37>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <getGCD@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getGCD>:
mov    %edi,%eax
test   %esi,%esi
je     111d <getGCD+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <getGCD+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @getGCD(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 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %4
store i32 %9, i32* %3
br label %16
10: ; preds = %2
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = srem i32 %12, %13
%15 = call i32 @getGCD(i32 %11, i32 %14)
store i32 %15, i32* %3
br label %16
16: ; preds = %10, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @getGCD(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
/* Variables and functions */
int pop();
int /*<<< orphan*/ push(int);
void apply_sub(void) {
  int arg2 = pop();
  int arg1 = pop();
  push(arg1 - arg2);
}


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

x86 assembly (clang, -O2):
<apply_sub>:
push   %rbx
xor    %eax,%eax
call   1030 <pop@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <pop@plt>
sub    %ebx,%eax
mov    %eax,%edi
pop    %rbx
jmp    1040 <push@plt>

LLVM IR (-O0):
define void @apply_sub() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @pop()
store i32 %3, i32* %1
%4 = call i32 (...) @pop()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %1
%7 = sub nsw i32 %5, %6
%8 = call i32 @push(i32 %7)
ret void
}

LLVM IR (-O2):
define void @apply_sub() {
%1 = tail call i32 (...) @pop()
%2 = tail call i32 (...) @pop()
%3 = sub nsw i32 %2, %1
%4 = tail call i32 @push(i32 %3)
ret void
}
/* Variables and functions */
int f8(int *);
int f9(int *p) { return f8(p); }


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

x86 assembly (clang, -O2):
<f9>:
jmp    1030 <f8@plt>

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

LLVM IR (-O2):
define i32 @f9(i32* %0) {
%2 = tail call i32 @f8(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void __attribute__((constructor)) init(void) { write(1, "4", 1); }


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edx
lea    0xee0(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"4\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @init, i8* null }]
define void @init() {
%1 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"4\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @init, i8* null }]
define void @init() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void GetLine(char *str, FILE *in) {
  char *result;
  result = fgets(str, 1024, in);
  if ((result == NULL) && !feof(in))
    fprintf(stderr, "Error occurred while reading from file\n");
}


x86 assembly (clang, -O0):
<GetLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1030 <fgets@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1188 <GetLine+0x58>
mov    -0x10(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
jne    1188 <GetLine+0x58>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetLine>:
push   %rbx
mov    %rsi,%rbx
mov    $0x400,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
test   %rax,%rax
jne    1152 <GetLine+0x22>
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %eax,%eax
je     1154 <GetLine+0x24>
pop    %rbx
ret
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
pop    %rbx
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"Error occurred while reading from file\0A\00"
define void @GetLine(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i8*, i8** %3
%7 = load i32*, i32** %4
%8 = call i8* @fgets(i8* %6, i32 1024, i32* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32*, i32** %4
%13 = call i32 @feof(i32* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %15, %11, %2
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"Error occurred while reading from file\0A\00"
define void @GetLine(i8* %0, i32* nocapture %1) {
%3 = tail call i8* @fgets(i8* %0, i32 1024, i32* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = tail call i32 @feof(i32* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8, %5, %2
ret void
}
/* Type definitions */
typedef int ssize_t;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int __getdents(int, char *, size_t);
int /*<<< orphan*/ __lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
ssize_t getdirentries(int fd, char *buf, size_t nbytes, off_t *basep) {
  off_t base = __lseek(fd, (off_t)0, SEEK_CUR);
  ssize_t result;
  result = __getdents(fd, buf, nbytes);
  if (result != -1)
    *basep = base;
  return result;
}


x86 assembly (clang, -O0):
<getdirentries>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <__lseek@plt>
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <__getdents@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
je     1173 <getdirentries+0x53>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getdirentries>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x2eae(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <__lseek@plt>
mov    %eax,%r15d
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1030 <__getdents@plt>
cmp    $0xffffffff,%eax
je     115b <getdirentries+0x3b>
mov    %r15d,(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@SEEK_CUR = global i32 0
define i32 @getdirentries(i32 %0, i8* %1, i64 %2, i32* nocapture writeonly %3) {
%5 = load i32, i32* @SEEK_CUR
%6 = tail call i32 @__lseek(i32 %0, i32 0, i32 %5)
%7 = tail call i32 @__getdents(i32 %0, i8* %1, i64 %2)
%8 = icmp eq i32 %7, -1
br i1 %8, label %10, label %9
9: ; preds = %4
store i32 %6, i32* %3
br label %10
10: ; preds = %9, %4
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ quicksortHelper(double *, int /*<<< orphan*/, int);
void quicksort(double lyst[], int size) { quicksortHelper(lyst, 0, size - 1); }


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <quicksortHelper@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <quicksortHelper@plt>

LLVM IR (-O0):
define void @quicksort(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load double*, double** %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %6, 1
%8 = call i32 @quicksortHelper(double* %5, i32 0, i32 %7)
ret void
}

LLVM IR (-O2):
define void @quicksort(double* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @quicksortHelper(double* %0, i32 0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ permutationR(char *, char *);
int permutationWithRecurrence(char *string) {
  if (string == NULL) {
    return -1;
  }
  permutationR(string, string);
  return 0;
}


x86 assembly (clang, -O0):
<permutationWithRecurrence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <permutationWithRecurrence+0x23>
movl   $0xffffffff,-0x4(%rbp)
jmp    1147 <permutationWithRecurrence+0x37>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <permutationR@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<permutationWithRecurrence>:
test   %rdi,%rdi
je     1125 <permutationWithRecurrence+0x15>
push   %rax
mov    %rdi,%rsi
call   1030 <permutationR@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @permutationWithRecurrence(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @permutationR(i8* %0, i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ 0, %3 ], [ -1, %1 ]
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ *malloc(int);
int /*<<< orphan*/ mbstowcs(int /*<<< orphan*/ *, char *, int);
wchar_t *str2wide(char *src) {
  int len = mbstowcs(NULL, src, 0) + 1;
  wchar_t *dest = malloc((len + 1) * sizeof(wchar_t));
  mbstowcs(dest, src, len);
  return dest;
}


x86 assembly (clang, -O0):
<str2wide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
xor    %edx,%edx
call   1030 <mbstowcs@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <mbstowcs@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str2wide>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <mbstowcs@plt>
lea    0x1(%rax),%r14d
lea    0x8(,%rax,4),%edi
call   1040 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <mbstowcs@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32* @str2wide(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @mbstowcs(i32* null, i8* %5, i32 0)
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 4
%12 = trunc i64 %11 to i32
%13 = call i32* @malloc(i32 %12)
store i32* %13, i32** %4
%14 = load i32*, i32** %4
%15 = load i8*, i8** %2
%16 = load i32, i32* %3
%17 = call i32 @mbstowcs(i32* %14, i8* %15, i32 %16)
%18 = load i32*, i32** %4
ret i32* %18
}

LLVM IR (-O2):
define i32* @str2wide(i8* %0) {
%2 = tail call i32 @mbstowcs(i32* null, i8* %0, i32 0)
%3 = add nsw i32 %2, 1
%4 = shl i32 %2, 2
%5 = add i32 %4, 8
%6 = tail call i32* @malloc(i32 %5)
%7 = tail call i32 @mbstowcs(i32* %6, i8* %0, i32 %3)
ret i32* %6
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
void BigEndianWriteU16(uint16_t value, uint8_t *bytes) {
  bytes[0] = (uint8_t)(value >> 8);
  bytes[1] = (uint8_t)value;
}


x86 assembly (clang, -O0):
<BigEndianWriteU16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movslq -0x4(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BigEndianWriteU16>:
movslq %edi,%rax
sar    $0x8,%edi
movslq %edi,%rcx
mov    %rcx,(%rsi)
mov    %rax,0x8(%rsi)
ret

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

LLVM IR (-O2):
define void @BigEndianWriteU16(i32 %0, i64* nocapture writeonly %1) {
%3 = ashr i32 %0, 8
%4 = sext i32 %3 to i64
store i64 %4, i64* %1
%5 = sext i32 %0 to i64
%6 = getelementptr inbounds i64, i64* %1, i64 1
store i64 %5, i64* %6
ret void
}
__attribute__((weak)) void USART2_IrqHandler(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<USART2_IrqHandler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <USART2_IrqHandler+0x9>
jmp    1109 <USART2_IrqHandler+0x9>

x86 assembly (clang, -O2):
<USART2_IrqHandler>:
jmp    1100 <USART2_IrqHandler>

LLVM IR (-O0):
define weak void @USART2_IrqHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define weak void @USART2_IrqHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ cnd_t;

/* Variables and functions */
void cnd_destroy(cnd_t *cond) { (void)cond; }


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

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

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

LLVM IR (-O2):
define void @cnd_destroy(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void DUMP(const char *s, size_t n) {
  unsigned int i;
  for (i = 0; i < n; i++)
    printf("0x%x ", s[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<DUMP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%rax
jae    115b <DUMP+0x4b>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <DUMP+0x17>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DUMP>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1157 <DUMP+0x37>
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xec6(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    %r12,%rbx
jb     1140 <DUMP+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"0x%x \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @DUMP(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
store i32 0, i32* %5
br label %6
6: ; preds = %19, %2
%7 = load i32, i32* %5
%8 = zext i32 %7 to i64
%9 = load i64, i64* %4
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = load i32, i32* %5
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %11
%20 = load i32, i32* %5
%21 = add i32 %20, 1
store i32 %21, i32* %5
br label %6
22: ; preds = %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"0x%x \00"
define void @DUMP(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %11, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = add nuw nsw i64 %5, 1
%11 = and i64 %10, 4294967295
%12 = icmp ult i64 %11, %1
br i1 %12, label %4, label %13
13: ; preds = %4, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
scalar_t__ write(int, char *, int);
void file_write(int fd, char *data) {
  int i = 0;
  while (1) {
    if (!data[i])
      break;
    if (write(fd, &data[i], 1) <= 0) {
      break;
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<file_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
jne    113d <file_write+0x2d>
jmp    1172 <file_write+0x62>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x0,%rax
jg     1164 <file_write+0x54>
jmp    1172 <file_write+0x62>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <file_write+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_write>:
push   %rbp
push   %rbx
push   %rax
cmpb   $0x0,(%rsi)
je     113e <file_write+0x2e>
mov    %rsi,%rbx
mov    %edi,%ebp
nopl   (%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
test   %rax,%rax
jle    113e <file_write+0x2e>
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <file_write+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @file_write(i32 %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %9
5: ; preds = %9
%6 = getelementptr inbounds i8, i8* %1, i64 %14
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %2, %5
%10 = phi i64 [ %14, %5 ], [ 0, %2 ]
%11 = phi i8* [ %6, %5 ], [ %1, %2 ]
%12 = tail call i64 @write(i32 %0, i8* %11, i32 1)
%13 = icmp slt i64 %12, 1
%14 = add nuw i64 %10, 1
br i1 %13, label %15, label %5
15: ; preds = %5, %9, %2
ret void
}
/* Variables and functions */
char *test_decl() { return NULL; }


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

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

LLVM IR (-O0):
define i8* @test_decl() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @test_decl() {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int volatile);
int main() {
  volatile unsigned a = 150, b = -1;
  printf("%d\n", a ^ b);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store volatile i32 150, i32* %1
%4 = bitcast i32* %2 to i8*
store volatile i32 -1, i32* %2
%5 = load volatile i32, i32* %1
%6 = load volatile i32, i32* %2
%7 = xor i32 %6, %5
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int vect_mus_audio_write(int, char *, int);
int mus_audio_write(int id, char *buf, int bytes) {
  return (vect_mus_audio_write(id, buf, bytes));
}


x86 assembly (clang, -O0):
<mus_audio_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <vect_mus_audio_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mus_audio_write>:
jmp    1030 <vect_mus_audio_write@plt>

LLVM IR (-O0):
define i32 @mus_audio_write(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @vect_mus_audio_write(i32 %7, i8* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @mus_audio_write(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @vect_mus_audio_write(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
__attribute__((noipa)) void fcas3(char a[3]) {
  sink(0, a[0]);
  sink(0, a[1]);
  sink(0, a[2]);
  sink(0, a[3]);
}


x86 assembly (clang, -O0):
<fcas3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
xor    %edi,%edi
mov    $0x0,%al
call   1030 <sink@plt>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%esi
xor    %edi,%edi
mov    $0x0,%al
call   1030 <sink@plt>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%esi
xor    %edi,%edi
mov    $0x0,%al
call   1030 <sink@plt>
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%esi
xor    %edi,%edi
mov    $0x0,%al
call   1030 <sink@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcas3>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%esi
xor    %edi,%edi
xor    %eax,%eax
call   1030 <sink@plt>
movsbl 0x1(%rbx),%esi
xor    %edi,%edi
xor    %eax,%eax
call   1030 <sink@plt>
movsbl 0x2(%rbx),%esi
xor    %edi,%edi
xor    %eax,%eax
call   1030 <sink@plt>
movsbl 0x3(%rbx),%esi
xor    %edi,%edi
xor    %eax,%eax
pop    %rbx
jmp    1030 <sink@plt>

LLVM IR (-O0):
define void @fcas3(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = call i32 (i32, i32, ...) bitcast (i32 (...)* @sink to i32 (i32, i32, ...)*)(i32 0, i32 %6)
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = call i32 (i32, i32, ...) bitcast (i32 (...)* @sink to i32 (i32, i32, ...)*)(i32 0, i32 %11)
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = call i32 (i32, i32, ...) bitcast (i32 (...)* @sink to i32 (i32, i32, ...)*)(i32 0, i32 %16)
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 3
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = call i32 (i32, i32, ...) bitcast (i32 (...)* @sink to i32 (i32, i32, ...)*)(i32 0, i32 %21)
ret void
}

LLVM IR (-O2):
define void @fcas3(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @sink to i32 (i32, i32, ...)*)(i32 0, i32 %3)
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @sink to i32 (i32, i32, ...)*)(i32 0, i32 %7)
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @sink to i32 (i32, i32, ...)*)(i32 0, i32 %11)
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @sink to i32 (i32, i32, ...)*)(i32 0, i32 %15)
ret void
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMR94_get(void) { return U_WMRCORENONE_get("U_WMR94"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR94\00"
define i32 @U_WMR94_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR94\00"
define i32 @U_WMR94_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
int my_strlen(char *arg) {
  int len = 0;
  while (arg[len] != '\0') {
    len++;
  }
  return len;
}


x86 assembly (clang, -O0):
<my_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <my_strlen+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <my_strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <my_strlen+0x10>
ret

LLVM IR (-O0):
define i32 @my_strlen(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 i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @my_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}