xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ isspace(int /*<<< orphan*/);
bool blank(char *s) {
  while (*s)
    if (!isspace(*s++))
      return false;
  return true;
}


x86 assembly (clang, -O0):
<blank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115a <blank+0x4a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    1155 <blank+0x45>
movl   $0x0,-0x4(%rbp)
jmp    1161 <blank+0x51>
jmp    111c <blank+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blank>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx),%edi
test   %edi,%edi
je     1138 <blank+0x28>
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %eax,%eax
jne    1120 <blank+0x10>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @blank(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = sext i8 %4 to i32
%9 = tail call i32 @isspace(i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %2
11: ; preds = %2, %6
%12 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %12
}
/* Variables and functions */
int get_stcadc1(int, int, int *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int);
void print_stcadc1(int a, int b, int mask) {
  int f, r;
  f = get_stcadc1(a, b, &r);
  f &= mask;
  printf("stcadc"
         " 1"
         " %08x %08x %08x %08x %08x\n",
         a, b, r, f, mask);
}


x86 assembly (clang, -O0):
<print_stcadc1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x14(%rbp),%rdx
call   1040 <get_stcadc1@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0xc(%rbp),%r9d
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_stcadc1>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xc(%rsp),%rdx
call   1040 <get_stcadc1@plt>
and    %r14d,%eax
mov    0xc(%rsp),%ecx
lea    0xeb9(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%r8d
mov    %r14d,%r9d
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"stcadc 1 %08x %08x %08x %08x %08x\0A\00"
define void @print_stcadc1(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call i32 @get_stcadc1(i32 %9, i32 %10, i32* %8)
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = and i32 %13, %12
store i32 %14, i32* %7
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = load i32, i32* %8
%18 = load i32, i32* %7
%19 = load i32, i32* %6
%20 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16, i32 %17, i32 %18, i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"stcadc 1 %08x %08x %08x %08x %08x\0A\00"
define void @print_stcadc1(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @get_stcadc1(i32 %0, i32 %1, i32* %4)
%7 = and i32 %6, %2
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %8, i32 %7, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ sys_write(int, char *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  char buf[128];
  snprintf(buf, 128, "Hello, world %d argc\n", argc);
  sys_write(1, buf, strlen(buf));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    $0x80,%esi
lea    0xea1(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x98(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1050 <sys_write@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
mov    %edi,%ecx
lea    0xebf(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <sys_write@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Hello, world %d argc\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%8 = load i32, i32* %4
%9 = call i32 @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = call i32 @sys_write(i32 1, i8* %10, i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Hello, world %d argc\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = call i32 @strlen(i8* %4)
%7 = call i32 @sys_write(i32 1, i8* %4, i32 %6)
ret i32 0
}
/* Variables and functions */
size_t fib(size_t n) {
  if (n < 2)
    return n;
  return fib(n - 2) + fib(n - 1);
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x2,-0x10(%rbp)
jae    1134 <fib+0x24>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1160 <fib+0x50>
mov    -0x10(%rbp),%rdi
sub    $0x2,%rdi
call   1030 <fib@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <fib@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %r14d,%r14d
cmp    $0x2,%rdi
jb     113b <fib+0x2b>
lea    -0x2(%rbx),%rdi
call   1030 <fib@plt>
add    $0xffffffffffffffff,%rbx
add    %rax,%r14
cmp    $0x1,%rbx
ja     1120 <fib+0x10>
mov    $0x1,%ebx
add    %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fib(i64 %0) {
%2 = icmp ult i64 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ %0, %1 ]
%5 = phi i64 [ %9, %3 ], [ 0, %1 ]
%6 = add i64 %4, -2
%7 = tail call i64 @fib(i64 %6)
%8 = add i64 %4, -1
%9 = add i64 %7, %5
%10 = icmp ult i64 %8, 2
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i64 [ 0, %1 ], [ %9, %3 ]
%13 = phi i64 [ %0, %1 ], [ 1, %3 ]
%14 = add i64 %13, %12
ret i64 %14
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *);
int /*<<< orphan*/ stderr;
void rtpp_socket_settimestamp_fin(void *pub) {
  fprintf(stderr,
          "Method rtpp_socket@%p::settimestamp (rtpp_socket_settimestamp) is "
          "invoked after destruction\x0a",
          pub);
  abort();
}


x86 assembly (clang, -O0):
<rtpp_socket_settimestamp_fin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<rtpp_socket_settimestamp_fin>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [93 x i8] c"Method rtpp_socket@%p::settimestamp (rtpp_socket_settimestamp) is invoked after destruction\0A\00"
define void @rtpp_socket_settimestamp_fin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [93 x i8] c"Method rtpp_socket@%p::settimestamp (rtpp_socket_settimestamp) is invoked after destruction\0A\00"
define void @rtpp_socket_settimestamp_fin(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @abort()
unreachable
}
double sun_delta2subsec(long delta_day, long delta_sec, double delta_subsec) {
  return (double)(delta_day * (60 * 60 * 24) + delta_sec) + delta_subsec;
}


x86 assembly (clang, -O0):
<sun_delta2subsec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
imul   $0x15180,-0x8(%rbp),%rax
add    -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
addsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sun_delta2subsec>:
imul   $0x15180,%rdi,%rax
add    %rsi,%rax
cvtsi2sd %rax,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @sun_delta2subsec(i64 %0, i64 %1, double %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca double
store i64 %0, i64* %4
store i64 %1, i64* %5
store double %2, double* %6
%7 = load i64, i64* %4
%8 = mul nsw i64 %7, 86400
%9 = load i64, i64* %5
%10 = add nsw i64 %8, %9
%11 = sitofp i64 %10 to double
%12 = load double, double* %6
%13 = fadd double %11, %12
ret double %13
}

LLVM IR (-O2):
define double @sun_delta2subsec(i64 %0, i64 %1, double %2) {
%4 = mul nsw i64 %0, 86400
%5 = add nsw i64 %4, %1
%6 = sitofp i64 %5 to double
%7 = fadd double %6, %2
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void f29(long j) {
  if ((j & ((1UL << (29)) - 1)) >= ((1UL << ((29) - 1)) + 2))
    abort();
}


x86 assembly (clang, -O0):
<f29>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1fffffff,%rax
cmp    $0x10000002,%rax
jb     1139 <f29+0x29>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f29>:
and    $0x1ffffffe,%edi
cmp    $0x10000002,%edi
jae    111f <f29+0xf>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @f29(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 536870911
%5 = icmp uge i64 %4, 268435458
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @f29(i64 %0) {
%2 = and i64 %0, 536870910
%3 = icmp ugt i64 %2, 268435457
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %1
ret void
}
unsigned long Read32(unsigned char *pByte) {
  unsigned long value = 0;
  value |= (unsigned long)pByte[0] << 24;
  value |= (unsigned long)pByte[1] << 16;
  value |= (unsigned long)pByte[2] << 8;
  value |= (unsigned long)pByte[3];
  return value;
}


x86 assembly (clang, -O0):
<Read32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x10,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
shl    $0x8,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Read32>:
mov    (%rdi),%eax
shl    $0x20,%rax
bswap  %rax
ret

LLVM IR (-O0):
define i64 @Read32(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = shl i64 %7, 24
%9 = load i64, i64* %3
%10 = or i64 %9, %8
store i64 %10, i64* %3
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = zext i8 %13 to i64
%15 = shl i64 %14, 16
%16 = load i64, i64* %3
%17 = or i64 %16, %15
store i64 %17, i64* %3
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %19
%21 = zext i8 %20 to i64
%22 = shl i64 %21, 8
%23 = load i64, i64* %3
%24 = or i64 %23, %22
store i64 %24, i64* %3
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i64 3
%27 = load i8, i8* %26
%28 = zext i8 %27 to i64
%29 = load i64, i64* %3
%30 = or i64 %29, %28
store i64 %30, i64* %3
%31 = load i64, i64* %3
ret i64 %31
}

LLVM IR (-O2):
define i64 @Read32(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i64
%4 = shl nuw nsw i64 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = shl nuw nsw i64 %7, 16
%9 = or i64 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = shl nuw nsw i64 %12, 8
%14 = or i64 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i64
%18 = or i64 %14, %17
ret i64 %18
}
void detect_clock(void) {}


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

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

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

LLVM IR (-O2):
define void @detect_clock() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern double shmem_double_swap(double *target, double value, int pe) {
  printf("\nOpenSHMEM Analyzer\n");
}


x86 assembly (clang, -O0):
<shmem_double_swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"\0AOpenSHMEM Analyzer\0A\00"
define double @shmem_double_swap(double* %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double
%7 = alloca i32
store double* %0, double** %5
store double %1, double* %6
store i32 %2, i32* %7
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = load double, double* %4
ret double %9
}

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define double @shmem_double_swap(double* nocapture readnone %0, double %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret double undef
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
int /*<<< orphan*/ stdout;
void bytes_show(char *bytes, size_t szBytes) {
  while (szBytes) {
    fprintf(stdout, "\\x%2x", *bytes & 0xff);
    bytes++;
    szBytes--;
  }
}


x86 assembly (clang, -O0):
<bytes_show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116c <bytes_show+0x5c>
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
and    $0xff,%eax
lea    0xeb9(%rip),%rsi
movsbl %al,%edx
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <bytes_show+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytes_show>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rsi,%rsi
je     115a <bytes_show+0x4a>
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
mov    0x2eb3(%rip),%r13
lea    0xecc(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%r13),%edi
movsbl (%r14,%rbx,1),%edx
mov    %r15,%rsi
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <bytes_show+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [6 x i8] c"\\x%2x\00"
define void @bytes_show(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
br label %5
5: ; preds = %8, %2
%6 = load i64, i64* %4
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* @stdout
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
%15 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %14)
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
%18 = load i64, i64* %4
%19 = add i64 %18, -1
store i64 %19, i64* %4
br label %5
20: ; preds = %5
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [6 x i8] c"\\x%2x\00"
define void @bytes_show(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 ], [ %1, %2 ]
%6 = phi i8* [ %10, %4 ], [ %0, %2 ]
%7 = load i32, i32* @stdout
%8 = load i8, i8* %6
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %8)
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = add i64 %5, -1
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  int numb = 1;
  for (i = 1; i < 11; i += 1) {
    numb *= i;
  }
  printf("%d\n", numb);
  return 0;
}


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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3628800)
ret i32 0
}
/* Variables and functions */
size_t strlen(char *);
char *clean_path(char *path) {
  int i, j;
  size_t len = strlen(path);
  for (i = 0; i < len; i++) {
  }
  return path;
}


x86 assembly (clang, -O0):
<clean_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1151 <clean_path+0x41>
jmp    1143 <clean_path+0x33>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1130 <clean_path+0x20>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_path>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @clean_path(i8* returned %0) {
ret i8* %0
}
int selinux_setup(char *const argv[]) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @selinux_setup(i8** nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void initializer(void) {
  printf("initializer run\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<initializer>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<initializer>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"initializer run\0A\00"
@stdout = global i32 0
define void @initializer() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@str = [16 x i8] c"initializer run\00"
define void @initializer() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
ret void
}
int test_imm_6Duint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x6D << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_6Duint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 7143424
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ yield();
void foo(int count, const char *text) {
  int i;
  for (i = 0; i != count; ++i) {
    printf("%s\n", text);
    yield();
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     1167 <foo+0x47>
mov    -0x10(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <yield@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <foo+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
je     1157 <foo+0x37>
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xecc(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <yield@plt>
add    $0xffffffff,%ebp
jne    1140 <foo+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @foo(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %10, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ 0, %2 ]
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%7 = tail call i32 (...) @yield()
%8 = add nuw nsw i32 %5, 1
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %4
10: ; preds = %4, %2
ret void
}
void test62_Test_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @test62_Test_targetInit__I() {
ret void
}
char *procprt_FSGID_e(struct tstat *curstat, int avgval, int nsecs) {
  return "-       ";
}


x86 assembly (clang, -O0):
<procprt_FSGID_e>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xeeb(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<procprt_FSGID_e>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
%struct.tstat = type opaque
@.str = [9 x i8] c"- \00"
define i8* @procprt_FSGID_e(%struct.tstat* %0, i32 %1, i32 %2) {
%4 = alloca %struct.tstat*
%5 = alloca i32
%6 = alloca i32
store %struct.tstat* %0, %struct.tstat** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tstat = type opaque
@.str = [9 x i8] c"- \00"
define i8* @procprt_FSGID_e(%struct.tstat* nocapture readnone %0, i32 %1, i32 %2) {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
struct miscDevice {
  int dummy;
};
struct device {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ writeDevice(int /*<<< orphan*/ *, struct device *);
void miscWriteDevice(FILE *file, struct miscDevice *dev) {
  writeDevice(file, (struct device *)dev);
}


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

x86 assembly (clang, -O2):
<miscWriteDevice>:
jmp    1030 <writeDevice@plt>

LLVM IR (-O0):
%struct.miscDevice = type { i32 }
%struct.device = type { i32 }
define void @miscWriteDevice(i32* %0, %struct.miscDevice* %1) {
%3 = alloca i32*
%4 = alloca %struct.miscDevice*
store i32* %0, i32** %3
store %struct.miscDevice* %1, %struct.miscDevice** %4
%5 = load i32*, i32** %3
%6 = load %struct.miscDevice*, %struct.miscDevice** %4
%7 = bitcast %struct.miscDevice* %6 to %struct.device*
%8 = call i32 @writeDevice(i32* %5, %struct.device* %7)
ret void
}

LLVM IR (-O2):
%struct.miscDevice = type { i32 }
%struct.device = type { i32 }
define void @miscWriteDevice(i32* %0, %struct.miscDevice* %1) {
%3 = bitcast %struct.miscDevice* %1 to %struct.device*
%4 = tail call i32 @writeDevice(i32* %0, %struct.device* %3)
ret void
}
void ups_version(int *ver_major, int *ver_minor, int *ver_revision) {
  *ver_major = 1;
  *ver_minor = 15;
  *ver_revision = 2;
}


x86 assembly (clang, -O0):
<ups_version>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0xf,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x2,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ups_version>:
movl   $0x1,(%rdi)
movl   $0xf,(%rsi)
movl   $0x2,(%rdx)
ret

LLVM IR (-O0):
define void @ups_version(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
store i32 1, i32* %7
%8 = load i32*, i32** %5
store i32 15, i32* %8
%9 = load i32*, i32** %6
store i32 2, i32* %9
ret void
}

LLVM IR (-O2):
define void @ups_version(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
store i32 1, i32* %0
store i32 15, i32* %1
store i32 2, i32* %2
ret void
}
long XMaxRequestSize() {}


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

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

LLVM IR (-O0):
define i64 @XMaxRequestSize() {
%1 = alloca i64
%2 = load i64, i64* %1
ret i64 %2
}

LLVM IR (-O2):
define i64 @XMaxRequestSize() {
ret i64 undef
}
/* Variables and functions */
int /*<<< orphan*/ free_wrapper(int *, int /*<<< orphan*/);
int *malloc_wrapper_2(int);
void trace_correctly_through_wrappers_bad() {
  int *x = malloc_wrapper_2(1);
  free_wrapper(x, 0);
}


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

x86 assembly (clang, -O2):
<trace_correctly_through_wrappers_bad>:
push   %rax
mov    $0x1,%edi
call   1040 <malloc_wrapper_2@plt>
mov    %rax,%rdi
xor    %esi,%esi
pop    %rax
jmp    1030 <free_wrapper@plt>

LLVM IR (-O0):
define void @trace_correctly_through_wrappers_bad() {
%1 = alloca i32*
%2 = call i32* @malloc_wrapper_2(i32 1)
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @free_wrapper(i32* %3, i32 0)
ret void
}

LLVM IR (-O2):
define void @trace_correctly_through_wrappers_bad() {
%1 = tail call i32* @malloc_wrapper_2(i32 1)
%2 = tail call i32 @free_wrapper(i32* %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void timer_handler(int signum) {
  static int count = 0;
  printf("timer expired %d timers\n", ++count);
}


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

x86 assembly (clang, -O2):
<timer_handler>:
mov    0x2f16(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2f0d(%rip)
lea    0xeda(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@timer_handler.count = internal global i32 0
@.str = [25 x i8] c"timer expired %d timers\0A\00"
define void @timer_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @timer_handler.count
%4 = add nsw i32 %3, 1
store i32 %4, i32* @timer_handler.count
%5 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@timer_handler.count = internal unnamed_addr global i32 0
@.str = [25 x i8] c"timer expired %d timers\0A\00"
define void @timer_handler(i32 %0) {
%2 = load i32, i32* @timer_handler.count
%3 = add nsw i32 %2, 1
store i32 %3, i32* @timer_handler.count
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int checkDivisible(long, int);
long int findDivisibility_brute(int value) {
  long int divisibilityTest = 20;
  while (!0) {
    int isDivisible = checkDivisible(divisibilityTest, value);
    if (isDivisible)
      return divisibilityTest;
    else
      divisibilityTest += 20;
  }
}


x86 assembly (clang, -O0):
<findDivisibility_brute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x14,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <checkDivisible@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1146 <findDivisibility_brute+0x36>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret
mov    -0x10(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x10(%rbp)
jmp    1123 <findDivisibility_brute+0x13>

x86 assembly (clang, -O2):
<findDivisibility_brute>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
add    $0x14,%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <checkDivisible@plt>
test   %eax,%eax
je     1120 <findDivisibility_brute+0x10>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i64 @findDivisibility_brute(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 20, %1 ], [ %6, %2 ]
%4 = tail call i32 @checkDivisible(i64 %3, i32 %0)
%5 = icmp eq i32 %4, 0
%6 = add nuw nsw i64 %3, 20
br i1 %5, label %2, label %7
7: ; preds = %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ init_shell();
int /*<<< orphan*/ loop_forever();
int main(void) {
  init_shell();
  for (;;)
    loop_forever();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <init_shell@plt>
mov    $0x0,%al
call   1030 <loop_forever@plt>
jmp    1136 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <init_shell@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <loop_forever@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @init_shell()
br label %3
3: ; preds = %3, %0
%4 = call i32 (...) @loop_forever()
br label %3
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @init_shell()
br label %2
2: ; preds = %2, %0
%3 = tail call i32 (...) @loop_forever()
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int /*<<< orphan*/);
void iowait(void) {
  outb(0x80, 0);
  return;
}


x86 assembly (clang, -O0):
<iowait>:
push   %rbp
mov    %rsp,%rbp
mov    $0x80,%edi
xor    %esi,%esi
call   1030 <outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<iowait>:
mov    $0x80,%edi
xor    %esi,%esi
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @iowait() {
%1 = call i32 @outb(i32 128, i32 0)
ret void
}

LLVM IR (-O2):
define void @iowait() {
%1 = tail call i32 @outb(i32 128, i32 0)
ret void
}
unsigned uint32_from_buffer(unsigned char *buffer, int offset) {
  return buffer[offset] | (buffer[offset + 1] << 8) |
         (buffer[offset + 2] << 16) | (buffer[offset + 3] << 24);
}


x86 assembly (clang, -O0):
<uint32_from_buffer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x3,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint32_from_buffer>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%eax
ret

LLVM IR (-O0):
define i32 @uint32_from_buffer(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* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = or i32 %10, %18
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = shl i32 %26, 16
%28 = or i32 %19, %27
%29 = load i8*, i8** %3
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %29, i64 %32
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = shl i32 %35, 24
%37 = or i32 %28, %36
ret i32 %37
}

LLVM IR (-O2):
define i32 @uint32_from_buffer(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = add nsw i32 %1, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 8
%13 = or i32 %12, %6
%14 = add nsw i32 %1, 2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl nuw nsw i32 %18, 16
%20 = or i32 %13, %19
%21 = add nsw i32 %1, 3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = shl nuw i32 %25, 24
%27 = or i32 %20, %26
ret i32 %27
}
/* Variables and functions */
int /*<<< orphan*/ console_init();
int /*<<< orphan*/ console_puts(char *);
void kernel(void) {
  console_init();
  console_puts("Ready.\r\n");
}


x86 assembly (clang, -O0):
<kernel>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <console_init@plt>
lea    0xece(%rip),%rdi
call   1040 <console_puts@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"Ready.\0D\0A\00"
define void @kernel() {
%1 = call i32 (...) @console_init()
%2 = call i32 @console_puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Ready.\0D\0A\00"
define void @kernel() {
%1 = tail call i32 (...) @console_init()
%2 = tail call i32 @console_puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Realtime_Initialize();
int /*<<< orphan*/ roadmap_log(int, char *, int, char *);
void roadmap_start_realtime(void) {
  if (!Realtime_Initialize())
    roadmap_log(4,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/"
                "heads/master/roadmap_start.c",
                2242, "roadmap_start() - 'Realtime_Initialize()' had failed");
}


x86 assembly (clang, -O0):
<roadmap_start_realtime>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <Realtime_Initialize@plt>
cmp    $0x0,%eax
jne    1151 <roadmap_start_realtime+0x31>
mov    $0x4,%edi
lea    0xec0(%rip),%rsi
mov    $0x8c2,%edx
lea    0xf47(%rip),%rcx
call   1030 <roadmap_log@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<roadmap_start_realtime>:
push   %rax
xor    %eax,%eax
call   1040 <Realtime_Initialize@plt>
test   %eax,%eax
je     112e <roadmap_start_realtime+0xe>
pop    %rax
ret
lea    0xecb(%rip),%rsi
lea    0xf57(%rip),%rcx
mov    $0x4,%edi
mov    $0x8c2,%edx
pop    %rax
jmp    1030 <roadmap_log@plt>

LLVM IR (-O0):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/heads/master/roadmap_start.c\00"
@.str.1 = [53 x i8] c"roadmap_start() - 'Realtime_Initialize()' had failed\00"
define void @roadmap_start_realtime() {
%1 = call i32 (...) @Realtime_Initialize()
%2 = icmp ne i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = call i32 @roadmap_log(i32 4, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 2242, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/heads/master/roadmap_start.c\00"
@.str.1 = [53 x i8] c"roadmap_start() - 'Realtime_Initialize()' had failed\00"
define void @roadmap_start_realtime() {
%1 = tail call i32 (...) @Realtime_Initialize()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @roadmap_log(i32 4, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 2242, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}
/* Variables and functions */
char *MALLOC(int);
int /*<<< orphan*/ strcat(int /*<<< orphan*/, char const *);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
char *appendStr(const char *s1, const char *s2) {
  char *ret = MALLOC((strlen(s1) + strlen(s2) + 1) * sizeof(char));
  strcat(strcpy(ret, s1), s2);
  return ret;
}


x86 assembly (clang, -O0):
<appendStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <MALLOC@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<appendStr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r15,%rax,1),%edi
add    $0x1,%edi
call   1050 <MALLOC@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @appendStr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = add nsw i32 %7, %9
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = mul i64 %12, 1
%14 = trunc i64 %13 to i32
%15 = call i8* @MALLOC(i32 %14)
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = load i8*, i8** %3
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = load i8*, i8** %4
%20 = call i32 @strcat(i32 %18, i8* %19)
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
define i8* @appendStr(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = add i32 %3, 1
%6 = add i32 %5, %4
%7 = tail call i8* @MALLOC(i32 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* %0)
%9 = tail call i32 @strcat(i32 %8, i8* %1)
ret i8* %7
}
/* Variables and functions */
int strlen(char *);
int /*<<< orphan*/ trim_trailing_space(char *);
void trim_newline(char *s) {
  int n;
  trim_trailing_space(s);
  n = strlen(s);
  if (s[n - 1] == '\n') {
    s[n - 1] = '\0';
  }
}


x86 assembly (clang, -O0):
<trim_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <trim_trailing_space@plt>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    116c <trim_newline+0x4c>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim_newline>:
push   %rbx
mov    %rdi,%rbx
call   1040 <trim_trailing_space@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    113f <trim_newline+0x1f>
movb   $0x0,-0x1(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @trim_newline(i8* %0) {
%2 = tail call i32 @trim_trailing_space(i8* %0)
%3 = tail call i32 @strlen(i8* %0)
%4 = add nsw i32 %3, -1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 10
br i1 %8, label %9, label %10
9: ; preds = %1
store i8 0, i8* %6
br label %10
10: ; preds = %9, %1
ret void
}
/* Variables and functions */
int nrf_802154_pib_promiscuous_get();
bool nrf_802154_promiscuous_get(void) {
  return nrf_802154_pib_promiscuous_get();
}


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

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

LLVM IR (-O0):
define i32 @nrf_802154_promiscuous_get() {
%1 = call i32 (...) @nrf_802154_pib_promiscuous_get()
ret i32 %1
}

LLVM IR (-O2):
define i32 @nrf_802154_promiscuous_get() {
%1 = tail call i32 (...) @nrf_802154_pib_promiscuous_get()
ret i32 %1
}