xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
void bitprint(FILE *fp, int i, int n) {
  while (n--)
    putc('0' + (((i) >> (n)) & 1), fp);
  return;
}


x86 assembly (clang, -O0):
<bitprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10(%rbp)
cmp    $0x0,%eax
je     1152 <bitprint+0x42>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%ecx
sar    %cl,%edi
and    $0x1,%edi
add    $0x30,%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
jmp    1122 <bitprint+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitprint>:
push   %rbp
push   %r14
push   %rbx
test   %edx,%edx
je     114a <bitprint+0x3a>
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
add    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14d,%edi
mov    %ebx,%ecx
shr    %cl,%edi
and    $0x1,%edi
or     $0x30,%edi
mov    %rbp,%rsi
call   1030 <putc@plt>
add    $0xffffffff,%ebx
jb     1130 <bitprint+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @bitprint(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
br label %7
7: ; preds = %11, %3
%8 = load i32, i32* %6
%9 = add nsw i32 %8, -1
store i32 %9, i32* %6
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = ashr i32 %12, %13
%15 = and i32 %14, 1
%16 = add nsw i32 48, %15
%17 = load i32*, i32** %4
%18 = call i32 @putc(i32 %16, i32* %17)
br label %7
19: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @bitprint(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %13, label %5
5: ; preds = %3, %5
%6 = phi i32 [ %7, %5 ], [ %2, %3 ]
%7 = add nsw i32 %6, -1
%8 = lshr i32 %1, %7
%9 = and i32 %8, 1
%10 = or i32 %9, 48
%11 = tail call i32 @putc(i32 %10, i32* %0)
%12 = icmp eq i32 %7, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %3
ret void
}
void rop3_179_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D & T;
  stk2 = ~stk2;
  stk1 = S & stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_179_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xa(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_179_1_1>:
mov    (%rdi),%al
mov    %eax,%ecx
and    %dl,%cl
or     %sil,%dl
not    %dl
and    %sil,%al
or     %dl,%al
or     %cl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_179_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i8, i8* %6
%13 = zext i8 %12 to i32
%14 = and i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = xor i32 %17, -1
%19 = trunc i32 %18 to i8
store i8 %19, i8* %8
%20 = load i8, i8* %5
%21 = zext i8 %20 to i32
%22 = load i8, i8* %8
%23 = zext i8 %22 to i32
%24 = and i32 %21, %23
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = zext i8 %26 to i32
%28 = xor i32 %27, -1
%29 = trunc i32 %28 to i8
store i8 %29, i8* %7
%30 = load i8, i8* %7
%31 = zext i8 %30 to i32
%32 = load i8, i8* %5
%33 = zext i8 %32 to i32
%34 = xor i32 %33, -1
%35 = and i32 %31, %34
%36 = load i8, i8* %6
%37 = zext i8 %36 to i32
%38 = xor i32 %37, -1
%39 = and i32 %35, %38
%40 = load i8*, i8** %4
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = load i8, i8* %5
%44 = zext i8 %43 to i32
%45 = and i32 %42, %44
%46 = or i32 %39, %45
%47 = load i8*, i8** %4
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = load i8, i8* %6
%51 = zext i8 %50 to i32
%52 = and i32 %49, %51
%53 = or i32 %46, %52
%54 = trunc i32 %53 to i8
%55 = load i8*, i8** %4
store i8 %54, i8* %55
ret void
}

LLVM IR (-O2):
define void @rop3_179_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %2
%6 = or i8 %2, %1
%7 = xor i8 %6, -1
%8 = and i8 %4, %1
%9 = or i8 %8, %7
%10 = or i8 %9, %5
store i8 %10, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ aucRef;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int contains_data(int /*<<< orphan*/ *, int, unsigned char *, int);
int is_br(FILE *fp) {
  unsigned char aucRef[] = {0x55, 0xAA};
  return contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
}


x86 assembly (clang, -O0):
<is_br>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xedd(%rip),%ax
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xa(%rbp),%rdx
mov    $0x1fe,%esi
mov    $0x2,%ecx
call   1030 <contains_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_br>:
push   %rax
movw   $0xaa55,0x6(%rsp)
lea    0x6(%rsp),%rdx
mov    $0x1fe,%esi
mov    $0x2,%ecx
call   1030 <contains_data@plt>
pop    %rcx
ret

LLVM IR (-O0):
@__const.is_br.aucRef = [2 x i8] c"U\AA"
define i32 @is_br(i32* %0) {
%2 = alloca i32*
%3 = alloca [2 x i8]
store i32* %0, i32** %2
%4 = bitcast [2 x i8]* %3 to i8*
%5 = load i32*, i32** %2
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%7 = call i32 @contains_data(i32* %5, i32 510, i8* %6, i32 2)
ret i32 %7
}

LLVM IR (-O2):
define i32 @is_br(i32* %0) {
%2 = alloca i16
%3 = bitcast i16* %2 to i8*
store i16 -21931, i16* %2
%4 = call i32 @contains_data(i32* %0, i32 510, i8* %3, i32 2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("usage: index <inverted-index file name> <directory or file name>\n");
}


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

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

LLVM IR (-O0):
@.str = [66 x i8] c"usage: index <inverted-index file name> <directory or file name>\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [65 x i8] c"usage: index <inverted-index file name> <directory or file name>\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LOCK_EX;
int flock(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int main(void) {
  int result = flock(0, LOCK_EX);
  if (result)
    perror("flock(0, LOCK_EX)");
  return (result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1040 <flock@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1158 <main+0x38>
lea    0xead(%rip),%rdi
call   1030 <perror@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1040 <flock@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    113b <main+0x1b>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xebe(%rip),%rdi
call   1030 <perror@plt>
jmp    1137 <main+0x17>

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

LLVM IR (-O2):
@LOCK_EX = global i32 0
@.str = [18 x i8] c"flock(0, LOCK_EX)\00"
define i32 @main() {
%1 = load i32, i32* @LOCK_EX
%2 = tail call i32 @flock(i32 0, i32 %1)
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
ret i32 %2
}
int log_2(int i) {
  int l;
  for (l = -1; i > 0; l++) {
    i = i >> 1;
  }
  return l;
}


x86 assembly (clang, -O0):
<log_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    112f <log_2+0x2f>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <log_2+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_2>:
mov    $0xffffffff,%eax
test   %edi,%edi
jle    111c <log_2+0x1c>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    %ecx
add    $0x1,%eax
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <log_2+0x10>
ret

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

LLVM IR (-O2):
define i32 @log_2(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ -1, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nsw i32 %4, 1
%8 = icmp ult i32 %5, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ -1, %1 ], [ %7, %3 ]
ret i32 %10
}
long fib(int n) {
  long x, y;
  if (n < 2)
    return n;
#pragma omp taskgroup
  {
#pragma omp task untied shared(x) firstprivate(n) depend(in : n) depend(out : x)
    x = fib(n - 1);
#pragma omp task untied shared(y) firstprivate(n) depend(in : n) depend(out : y)
    y = fib(n - 2);
  }
  return x + y;
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1132 <fib+0x22>
movslq -0xc(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115c <fib+0x4c>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%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
xor    %r14d,%r14d
cmp    $0x2,%edi
jl     1135 <fib+0x25>
mov    %edi,%ebx
xchg   %ax,%ax
lea    -0x1(%rbx),%edi
call   1030 <fib@plt>
lea    -0x2(%rbx),%edi
add    %rax,%r14
cmp    $0x4,%ebx
mov    %edi,%ebx
jae    1120 <fib+0x10>
movslq %edi,%rax
add    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fib(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %3, label %8
3: ; preds = %8, %1
%4 = phi i64 [ 0, %1 ], [ %14, %8 ]
%5 = phi i32 [ %0, %1 ], [ %13, %8 ]
%6 = sext i32 %5 to i64
%7 = add nsw i64 %4, %6
ret i64 %7
8: ; preds = %1, %8
%9 = phi i32 [ %13, %8 ], [ %0, %1 ]
%10 = phi i64 [ %14, %8 ], [ 0, %1 ]
%11 = add nsw i32 %9, -1
%12 = tail call i64 @fib(i32 %11)
%13 = add nsw i32 %9, -2
%14 = add nsw i64 %12, %10
%15 = icmp ult i32 %9, 4
br i1 %15, label %3, label %8
}
/* Variables and functions */
int /*<<< orphan*/ eiki_print_d(int /*<<< orphan*/);
int /*<<< orphan*/ eiki_print_s(char *);
int /*<<< orphan*/ getpid();
void eiki_print_pid_prefix() {
  eiki_print_s("==");
  eiki_print_d(getpid());
  eiki_print_s("== ");
}


x86 assembly (clang, -O0):
<eiki_print_pid_prefix>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <eiki_print_s@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
call   1050 <eiki_print_d@plt>
lea    0xeae(%rip),%rdi
call   1040 <eiki_print_s@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<eiki_print_pid_prefix>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <eiki_print_s@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%edi
call   1050 <eiki_print_d@plt>
lea    0xeb1(%rip),%rdi
pop    %rax
jmp    1040 <eiki_print_s@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"==\00"
@.str.1 = [4 x i8] c"== \00"
define void @eiki_print_pid_prefix() {
%1 = tail call i32 @eiki_print_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @eiki_print_d(i32 %2)
%4 = tail call i32 @eiki_print_s(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int memcmp(void *, void *, char);
int sha_cmp(void *sha1, void *sha2, char sha_bytes) {
  return memcmp(sha1, sha2, sha_bytes);
}


x86 assembly (clang, -O0):
<sha_cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x11(%rbp),%al
movsbl %al,%edx
call   1030 <memcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sha_cmp>:
jmp    1030 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @sha_cmp(i8* %0, i8* %1, i8 signext %2) {
%4 = tail call i32 @memcmp(i8* %0, i8* %1, i8 signext %2)
ret i32 %4
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ stat(char const *, struct stat *);
int exists(const char *str) {
  struct stat buf;
  return !stat(str, &buf);
}


x86 assembly (clang, -O0):
<exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exists>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @exists(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @stat(i8* %4, %struct.stat* %3)
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @exists(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
double sqrt(double);
double Phys_ThermLineWidth(double T_k, double m_a) {
  static const double k = 1.380650300000000e-23;
  return sqrt(2.0 * k * T_k / m_a);
}


x86 assembly (clang, -O0):
<Phys_ThermLineWidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xed6(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Phys_ThermLineWidth>:
mulsd  0xee8(%rip),%xmm0
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     112b <Phys_ThermLineWidth+0x1b>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
@Phys_ThermLineWidth.k = internal constant double 0x3B30B0E7DD0A406E
define double @Phys_ThermLineWidth(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fmul double 0x3B40B0E7DD0A406E, %5
%7 = load double, double* %4
%8 = fdiv double %6, %7
%9 = call double @sqrt(double %8)
ret double %9
}

LLVM IR (-O2):
define double @Phys_ThermLineWidth(double %0, double %1) {
%3 = fmul double %0, 0x3B40B0E7DD0A406E
%4 = fdiv double %3, %1
%5 = tail call double @sqrt(double %4)
ret double %5
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *vfs_basename(const char *path) {
  const char *basename;
  if (basename = strrchr(path, '/')) {
    basename++;
  } else if (basename = strrchr(path, ':')) {
    basename++;
  } else {
    basename = path;
  }
  return basename;
}


x86 assembly (clang, -O0):
<vfs_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1149 <vfs_basename+0x39>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1183 <vfs_basename+0x73>
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1176 <vfs_basename+0x66>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    117e <vfs_basename+0x6e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1183 <vfs_basename+0x73>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vfs_basename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1129 <vfs_basename+0x19>
add    $0x1,%rax
pop    %rbx
ret
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1030 <strrchr@plt>
mov    %rax,%rcx
add    $0x1,%rax
test   %rcx,%rcx
cmove  %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @vfs_basename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
br label %11
6: ; preds = %1
%7 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 58)
%8 = icmp eq i8* %7, null
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = select i1 %8, i8* %0, i8* %9
br label %11
11: ; preds = %6, %4
%12 = phi i8* [ %5, %4 ], [ %10, %6 ]
ret i8* %12
}
/* Variables and functions */
int mkdir(char const *, int);
int c0x_createdir(const char *dir) { return (mkdir(dir, 0777)); }


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

x86 assembly (clang, -O2):
<c0x_createdir>:
mov    $0x1ff,%esi
jmp    1030 <mkdir@plt>

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

LLVM IR (-O2):
define i32 @c0x_createdir(i8* nocapture %0) {
%2 = tail call i32 @mkdir(i8* %0, i32 511)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ XExposeEvent;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XExposeEvent(void) {
  XExposeEvent *_p = (XExposeEvent *)malloc(sizeof(XExposeEvent));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XExposeEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XExposeEvent+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XExposeEvent>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XExposeEvent+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XExposeEvent() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XExposeEvent() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ Extrae_user_function(int);
int /*<<< orphan*/ printf(char *);
void fA(void) {
  Extrae_user_function(1);
  printf("fA\n");
  Extrae_user_function(0);
}


x86 assembly (clang, -O0):
<fA>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1040 <Extrae_user_function@plt>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <Extrae_user_function@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fA>:
push   %rax
mov    $0x1,%edi
call   1040 <Extrae_user_function@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <Extrae_user_function@plt>

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

LLVM IR (-O2):
@str = [3 x i8] c"fA\00"
define void @fA() {
%1 = tail call i32 @Extrae_user_function(i32 1)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @Extrae_user_function(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GL_DEPTH_TEST;
int /*<<< orphan*/ GL_FRONT_AND_BACK;
int /*<<< orphan*/ GL_LIGHTING;
int /*<<< orphan*/ GL_LINE;
int /*<<< orphan*/ GL_NORMALIZE;
int /*<<< orphan*/ glDisable(int /*<<< orphan*/);
int /*<<< orphan*/ glPolygonMode(int /*<<< orphan*/, int /*<<< orphan*/);
void disable(void) {
  glDisable(GL_LIGHTING);
  glDisable(GL_DEPTH_TEST);
  glDisable(GL_NORMALIZE);
  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}


x86 assembly (clang, -O0):
<disable>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <glDisable@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1040 <glDisable@plt>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
call   1040 <glDisable@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
call   1030 <glPolygonMode@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<disable>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1040 <glDisable@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1040 <glDisable@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <glDisable@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    0x2e85(%rip),%rax
mov    (%rax),%esi
pop    %rax
jmp    1030 <glPolygonMode@plt>

LLVM IR (-O0):
@GL_LIGHTING = global i32 0
@GL_DEPTH_TEST = global i32 0
@GL_NORMALIZE = global i32 0
@GL_FRONT_AND_BACK = global i32 0
@GL_LINE = global i32 0
define void @disable() {
%1 = load i32, i32* @GL_LIGHTING
%2 = call i32 @glDisable(i32 %1)
%3 = load i32, i32* @GL_DEPTH_TEST
%4 = call i32 @glDisable(i32 %3)
%5 = load i32, i32* @GL_NORMALIZE
%6 = call i32 @glDisable(i32 %5)
%7 = load i32, i32* @GL_FRONT_AND_BACK
%8 = load i32, i32* @GL_LINE
%9 = call i32 @glPolygonMode(i32 %7, i32 %8)
ret void
}

LLVM IR (-O2):
@GL_LIGHTING = global i32 0
@GL_DEPTH_TEST = global i32 0
@GL_NORMALIZE = global i32 0
@GL_FRONT_AND_BACK = global i32 0
@GL_LINE = global i32 0
define void @disable() {
%1 = load i32, i32* @GL_LIGHTING
%2 = tail call i32 @glDisable(i32 %1)
%3 = load i32, i32* @GL_DEPTH_TEST
%4 = tail call i32 @glDisable(i32 %3)
%5 = load i32, i32* @GL_NORMALIZE
%6 = tail call i32 @glDisable(i32 %5)
%7 = load i32, i32* @GL_FRONT_AND_BACK
%8 = load i32, i32* @GL_LINE
%9 = tail call i32 @glPolygonMode(i32 %7, i32 %8)
ret void
}
void fill_double_init() {}


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

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

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

LLVM IR (-O2):
define void @fill_double_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int main(int argc, char **argv) {
  int a;
#pragma omp target data
  {}
L1:
  foo();
#pragma omp target data map(a)
  {
    foo();
    goto L1;
  }
  goto L2;
#pragma omp target data map(a)
L2:
  foo();
#pragma omp target data map(a)(i)
  { foo(); }
#pragma omp target unknown
  { foo(); }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
jmp    1126 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %7, %2
%8 = call i32 (...) @foo()
%9 = call i32 (...) @foo()
br label %7
10: ; No predecessors!
%11 = call i32 (...) @foo()
%12 = call i32 (...) @foo()
%13 = call i32 (...) @foo()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 (...) @foo()
%5 = tail call i32 (...) @foo()
br label %3
}
/* Variables and functions */
scalar_t__ sqlite3_stricmp(char const *, char const *);
int rbuStrCompare(const char *z1, const char *z2) {
  if (z1 == 0 && z2 == 0)
    return 0;
  if (z1 == 0 || z2 == 0)
    return 1;
  return (sqlite3_stricmp(z1, z2) != 0);
}


x86 assembly (clang, -O0):
<rbuStrCompare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1142 <rbuStrCompare+0x32>
cmpq   $0x0,-0x18(%rbp)
jne    1142 <rbuStrCompare+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1180 <rbuStrCompare+0x70>
cmpq   $0x0,-0x10(%rbp)
je     1158 <rbuStrCompare+0x48>
cmpq   $0x0,-0x18(%rbp)
jne    1164 <rbuStrCompare+0x54>
movl   $0x1,-0x4(%rbp)
jmp    1180 <rbuStrCompare+0x70>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <sqlite3_stricmp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rbuStrCompare>:
xor    %eax,%eax
mov    %rdi,%rcx
or     %rsi,%rcx
je     113e <rbuStrCompare+0x2e>
mov    $0x1,%eax
test   %rdi,%rdi
je     113e <rbuStrCompare+0x2e>
test   %rsi,%rsi
je     113e <rbuStrCompare+0x2e>
push   %rax
call   1030 <sqlite3_stricmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @rbuStrCompare(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = or i1 %3, %4
br i1 %7, label %12, label %8
8: ; preds = %6
%9 = tail call i64 @sqlite3_stricmp(i8* %0, i8* %1)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %2, %8
%13 = phi i32 [ %11, %8 ], [ 0, %2 ], [ 1, %6 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 5;
  printf("The a is %d\n", a);
  return 0;
}


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

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

LLVM IR (-O2):
@.str = [13 x i8] c"The a is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 5)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int32_t u32_to_s32(uint32_t v) { return *((int32_t *)&v); }


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

x86 assembly (clang, -O2):
<u32_to_s32>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @u32_to_s32(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int strlen(char *);
char *xstrndup(char *, int);
char *xstrdup(char *str) {
  int len = strlen(str);
  return xstrndup(str, len);
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <xstrndup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <xstrndup@plt>

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = call i8* @xstrndup(i8* %6, i32 %7)
ret i8* %8
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i8* @xstrndup(i8* %0, i32 %2)
ret i8* %3
}
/* Variables and functions */
void *realloc(void *, size_t);
void *DefRealloc(void *ptr, size_t size, void *pUser) {
  (void)pUser;
  return realloc(ptr, size);
}


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

x86 assembly (clang, -O2):
<DefRealloc>:
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define noalias i8* @DefRealloc(i8* nocapture %0, i64 %1, i8* nocapture readnone %2) {
%4 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ writeCommand2parm(char *, unsigned int, unsigned int);
int led(unsigned int id, unsigned int state) {
  char str[100];
  char s_id[100];
  char s_state[100];
  if ((id <= 3) && (state <= 1)) {
    writeCommand2parm("LED", id, state);
  } else {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<led>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x3,-0x8(%rbp)
ja     114c <led+0x3c>
cmpl   $0x1,-0xc(%rbp)
ja     114c <led+0x3c>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xebe(%rip),%rdi
call   1030 <writeCommand2parm@plt>
jmp    1158 <led+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <led+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<led>:
mov    $0xffffffff,%eax
cmp    $0x3,%edi
ja     1136 <led+0x26>
mov    %esi,%edx
cmp    $0x1,%esi
ja     1136 <led+0x26>
push   %rax
mov    %edi,%esi
lea    0xed5(%rip),%rdi
call   1030 <writeCommand2parm@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"LED\00"
define i32 @led(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
%9 = load i32, i32* %4
%10 = icmp ule i32 %9, 3
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* %5
%13 = icmp ule i32 %12, 1
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = call i32 @writeCommand2parm(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16)
br label %19
18: ; preds = %11, %2
store i32 -1, i32* %3
br label %20
19: ; preds = %14
store i32 0, i32* %3
br label %20
20: ; preds = %19, %18
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [4 x i8] c"LED\00"
define i32 @led(i32 %0, i32 %1) {
%3 = icmp ult i32 %0, 4
%4 = icmp ult i32 %1, 2
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @writeCommand2parm(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ 0, %6 ], [ -1, %2 ]
ret i32 %9
}
/* Type definitions */
struct token {
  int dummy;
};
struct compile_state {
  int dummy;
};

/* Variables and functions */
struct token *do_eat_token(struct compile_state *, int);
int /*<<< orphan*/ raw_peek(struct compile_state *);
struct token *raw_eat(struct compile_state *state, int tok) {
  raw_peek(state);
  return do_eat_token(state, tok);
}


x86 assembly (clang, -O0):
<raw_eat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <raw_peek@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <do_eat_token@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raw_eat>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <raw_peek@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <do_eat_token@plt>

LLVM IR (-O0):
%struct.token = type { i32 }
%struct.compile_state = type { i32 }
define %struct.token* @raw_eat(%struct.compile_state* %0, i32 %1) {
%3 = alloca %struct.compile_state*
%4 = alloca i32
store %struct.compile_state* %0, %struct.compile_state** %3
store i32 %1, i32* %4
%5 = load %struct.compile_state*, %struct.compile_state** %3
%6 = call i32 @raw_peek(%struct.compile_state* %5)
%7 = load %struct.compile_state*, %struct.compile_state** %3
%8 = load i32, i32* %4
%9 = call %struct.token* @do_eat_token(%struct.compile_state* %7, i32 %8)
ret %struct.token* %9
}

LLVM IR (-O2):
%struct.token = type { i32 }
%struct.compile_state = type { i32 }
define %struct.token* @raw_eat(%struct.compile_state* %0, i32 %1) {
%3 = tail call i32 @raw_peek(%struct.compile_state* %0)
%4 = tail call %struct.token* @do_eat_token(%struct.compile_state* %0, i32 %1)
ret %struct.token* %4
}
int tgetflag(char *name) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @tgetflag(i8* nocapture readnone %0) {
ret i32 -1
}
void gdk_device_get_state() {}


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

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

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

LLVM IR (-O2):
define void @gdk_device_get_state() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int read(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int i2c_read(int fd, uint8_t *buffer, uint8_t num_bytes) {
  return (read(fd, buffer, num_bytes));
}


x86 assembly (clang, -O0):
<i2c_read>:
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 <read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_read>:
jmp    1030 <read@plt>

LLVM IR (-O0):
define i32 @i2c_read(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 @read(i32 %7, i32* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @i2c_read(i32 %0, i32* nocapture %1, i32 %2) {
%4 = tail call i32 @read(i32 %0, i32* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ print_menu();
main(int argc, const char *argv[]) { print_menu(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <print_menu@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @print_menu()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @print_menu()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ rtc_action(int);
void rtc_wait_next_it(void) { rtc_action(2); }


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

x86 assembly (clang, -O2):
<rtc_wait_next_it>:
mov    $0x2,%edi
jmp    1030 <rtc_action@plt>

LLVM IR (-O0):
define void @rtc_wait_next_it() {
%1 = call i32 @rtc_action(i32 2)
ret void
}

LLVM IR (-O2):
define void @rtc_wait_next_it() {
%1 = tail call i32 @rtc_action(i32 2)
ret void
}
/* Type definitions */
struct CoSimComm {
  int dummy;
};

/* Variables and functions */
int writeMessage(char *, struct CoSimComm *, int /*<<< orphan*/);
int sendAccept(struct CoSimComm *comm) { return writeMessage("1", comm, 0); }


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

x86 assembly (clang, -O2):
<sendAccept>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
xor    %edx,%edx
jmp    1030 <writeMessage@plt>

LLVM IR (-O0):
%struct.CoSimComm = type { i32 }
@.str = [2 x i8] c"1\00"
define i32 @sendAccept(%struct.CoSimComm* %0) {
%2 = alloca %struct.CoSimComm*
store %struct.CoSimComm* %0, %struct.CoSimComm** %2
%3 = load %struct.CoSimComm*, %struct.CoSimComm** %2
%4 = call i32 @writeMessage(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.CoSimComm* %3, i32 0)
ret i32 %4
}

LLVM IR (-O2):
%struct.CoSimComm = type { i32 }
@.str = [2 x i8] c"1\00"
define i32 @sendAccept(%struct.CoSimComm* %0) {
%2 = tail call i32 @writeMessage(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.CoSimComm* %0, i32 0)
ret i32 %2
}
short __VERIFIER_nondet_short(void) {
  short s;
  { return (s); }
}


x86 assembly (clang, -O0):
<__VERIFIER_nondet_short>:
push   %rbp
mov    %rsp,%rbp
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i16 @__VERIFIER_nondet_short() {
ret i16 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pipe(int pipefd[2]) {
  printf("TODO: pipe() not yet implemented!\n");
  return -1;
}


x86 assembly (clang, -O0):
<pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [35 x i8] c"TODO: pipe() not yet implemented!\0A\00"
define i32 @pipe(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@str = [34 x i8] c"TODO: pipe() not yet implemented!\00"
define i32 @pipe(i32* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret i32 -1
}
int count_digits(int num) {
  int count = 0;
  if (num < 0) {
    return (0);
  }
  while (num) {
    num = num / 10;
    ++count;
  }
  return (count);
}


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

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

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

LLVM IR (-O2):
define i32 @count_digits(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = sdiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = add i32 %5, 9
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
void hug_mutex_close() {}


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

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

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

LLVM IR (-O2):
define void @hug_mutex_close() {
ret void
}