xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
uint64_t get_cas_id() {
  static uint64_t cas_id = 0;
  return ++cas_id;
}


x86 assembly (clang, -O0):
<get_cas_id>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1d(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2f12(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cas_id>:
mov    0x2f21(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2f16(%rip)
ret

LLVM IR (-O0):
@get_cas_id.cas_id = internal global i64 0
define i64 @get_cas_id() {
%1 = load i64, i64* @get_cas_id.cas_id
%2 = add nsw i64 %1, 1
store i64 %2, i64* @get_cas_id.cas_id
ret i64 %2
}

LLVM IR (-O2):
@get_cas_id.cas_id = internal unnamed_addr global i64 0
define i64 @get_cas_id() {
%1 = load i64, i64* @get_cas_id.cas_id
%2 = add nsw i64 %1, 1
store i64 %2, i64* @get_cas_id.cas_id
ret i64 %2
}
void uDMAChannelEnable(unsigned long ulChannelNum) {
  ;
  (*((volatile unsigned long *)(0x400FF000 + 0x00000028))) =
      1 << (ulChannelNum & 0x1f);
}


x86 assembly (clang, -O0):
<uDMAChannelEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1f,%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
movslq %eax,%rcx
mov    $0x400ff028,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDMAChannelEnable>:
mov    %rdi,%rcx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    %rax,0x400ff028
40
ret

LLVM IR (-O0):
define void @uDMAChannelEnable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 31
%5 = trunc i64 %4 to i32
%6 = shl i32 1, %5
%7 = sext i32 %6 to i64
store volatile i64 %7, i64* inttoptr (i64 1074786344 to i64*)
ret void
}

LLVM IR (-O2):
define void @uDMAChannelEnable(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = and i32 %2, 31
%4 = shl nuw i32 1, %3
%5 = sext i32 %4 to i64
store volatile i64 %5, i64* inttoptr (i64 1074786344 to i64*)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char const *, char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
FILE *Fopen(const char *path, const char *mode) {
  FILE *file = fopen(path, mode);
  if (file == NULL) {
    fprintf(stderr, "Error opening: %s (mode %s). Does the file exist?\n", path,
            mode);
    exit(1);
  }
  return file;
}


x86 assembly (clang, -O0):
<Fopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1183 <Fopen+0x53>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe8c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fopen>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <fopen@plt>
test   %rax,%rax
je     114c <Fopen+0x1c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"Error opening: %s (mode %s). Does the file exist?\0A\00"
define i32* @Fopen(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %6, i8* %7)
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i32*, i32** %5
ret i32* %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"Error opening: %s (mode %s). Does the file exist?\0A\00"
define noalias i32* @Fopen(i8* %0, i8* %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
ret i32* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ __v8hi;
typedef scalar_t__ __m128i;

/* Variables and functions */
int /*<<< orphan*/ __builtin_ia32_pminsw128(int /*<<< orphan*/,
                                            int /*<<< orphan*/);
__m128i __attribute__((__always___, __nodebug__))
_mm_min_epi16(__m128i a, __m128i b) {
  return (__m128i)__builtin_ia32_pminsw128((__v8hi)a, (__v8hi)b);
}


x86 assembly (clang, -O0):
<_mm_min_epi16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edi
mov    -0x10(%rbp),%rax
mov    %eax,%esi
call   1030 <__builtin_ia32_pminsw128@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mm_min_epi16>:
push   %rax
call   1030 <__builtin_ia32_pminsw128@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @_mm_min_epi16(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = trunc i64 %5 to i32
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = call i32 @__builtin_ia32_pminsw128(i32 %6, i32 %8)
%10 = sext i32 %9 to i64
ret i64 %10
}

LLVM IR (-O2):
define i64 @_mm_min_epi16(i64 %0, i64 %1) {
%3 = trunc i64 %0 to i32
%4 = trunc i64 %1 to i32
%5 = tail call i32 @__builtin_ia32_pminsw128(i32 %3, i32 %4)
%6 = sext i32 %5 to i64
ret i64 %6
}
void freeFromX86ToEco(unsigned char *p) {
  int i;
  conv4FromX86ToEco(p);
  p += 4;
  for (i = 0; i < 500; i++) {
    conv4FromX86ToEco(p);
    p += 4;
  }
}


x86 assembly (clang, -O0):
<freeFromX86ToEco>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <conv4FromX86ToEco@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1f4,-0xc(%rbp)
jge    116c <freeFromX86ToEco+0x5c>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <conv4FromX86ToEco@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <freeFromX86ToEco+0x2a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeFromX86ToEco>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <conv4FromX86ToEco@plt>
mov    $0x4,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r14,%rbx,1),%rdi
xor    %eax,%eax
call   1030 <conv4FromX86ToEco@plt>
add    $0x4,%rbx
cmp    $0x7d4,%ebx
jne    1130 <freeFromX86ToEco+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @freeFromX86ToEco(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @conv4FromX86ToEco to i32 (i8*, ...)*)(i8* %0)
br label %3
3: ; preds = %1, %3
%4 = phi i8* [ %0, %1 ], [ %6, %3 ]
%5 = phi i32 [ 0, %1 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 4
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @conv4FromX86ToEco to i32 (i8*, ...)*)(i8* %6)
%8 = add nuw nsw i32 %5, 1
%9 = icmp eq i32 %8, 500
br i1 %9, label %10, label %3
10: ; preds = %3
ret void
}
/* Type definitions */
struct ListNode {
  int dummy;
};

/* Variables and functions */
struct ListNode *merge(struct ListNode **, int /*<<< orphan*/, int);
struct ListNode *mergeKLists(struct ListNode **lists, int listsSize) {
  return merge(lists, 0, listsSize - 1);
}


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

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

LLVM IR (-O0):
%struct.ListNode = type { i32 }
define %struct.ListNode* @mergeKLists(%struct.ListNode** %0, i32 %1) {
%3 = alloca %struct.ListNode**
%4 = alloca i32
store %struct.ListNode** %0, %struct.ListNode*** %3
store i32 %1, i32* %4
%5 = load %struct.ListNode**, %struct.ListNode*** %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %6, 1
%8 = call %struct.ListNode* @merge(%struct.ListNode** %5, i32 0, i32 %7)
ret %struct.ListNode* %8
}

LLVM IR (-O2):
%struct.ListNode = type { i32 }
define %struct.ListNode* @mergeKLists(%struct.ListNode** %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call %struct.ListNode* @merge(%struct.ListNode** %0, i32 0, i32 %3)
ret %struct.ListNode* %4
}
/* Variables and functions */
float CLOCKS_PER_SEC;
int clock();
int /*<<< orphan*/ printf(char *, float);
int main() {
  for (int i = 0; i < 10000000; i++)
    ;
  int ticks = clock();
  printf("%f", (float)ticks / CLOCKS_PER_SEC);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x989680,-0x8(%rbp)
jge    1156 <main+0x36>
jmp    1148 <main+0x28>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0xc(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
mov    0x2e7c(%rip),%rax
divss  (%rax),%xmm0
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <clock@plt>
cvtsi2ss %eax,%xmm0
mov    0x2eb5(%rip),%rax
divss  (%rax),%xmm0
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 10000000
br i1 %6, label %7, label %11
7: ; preds = %4
br label %8
8: ; preds = %7
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %4
11: ; preds = %4
%12 = call i32 (...) @clock()
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = sitofp i32 %13 to float
%15 = load float, float* @CLOCKS_PER_SEC
%16 = fdiv float %14, %15
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
define i32 @main() {
%1 = tail call i32 (...) @clock()
%2 = sitofp i32 %1 to float
%3 = load float, float* @CLOCKS_PER_SEC
%4 = fdiv float %2, %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ foo();
f(int i) {
  if (i & 1)
    foo();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1131 <f+0x21>
mov    $0x0,%al
call   1030 <foo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
test   $0x1,%dil
je     1122 <f+0x12>
push   %rax
xor    %eax,%eax
call   1030 <foo@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @foo()
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @foo()
br label %6
6: ; preds = %4, %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test() { printf("This function returns nothing!\n"); }


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"This function returns nothing!\0A\00"
define void @test() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"This function returns nothing!\00"
define void @test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int aug_main(int, char **);
int main(int argc, char *argv[]) { return aug_main(argc, argv); }


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

x86 assembly (clang, -O2):
<main>:
jmp    1030 <aug_main@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @aug_main(i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ readInt(int);
int read() {
  int ret;
  readInt(ret);
  return ret;
}


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

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

LLVM IR (-O0):
define i32 @read() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @readInt(i32 %2)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @read() {
%1 = tail call i32 @readInt(i32 undef)
ret i32 undef
}
volatile int getidx(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @getidx() {
ret i32 2
}

LLVM IR (-O2):
define i32 @getidx() {
ret i32 2
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ random();
double randomDouble(void) { return (double)random() / (double)RAND_MAX; }


x86 assembly (clang, -O0):
<randomDouble>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <random@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomDouble>:
push   %rax
xor    %eax,%eax
call   1030 <random@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @randomDouble() {
%1 = call i64 (...) @random()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @randomDouble() {
%1 = tail call i64 (...) @random()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ inv_free(void *);
void kfree(void *ptr) { inv_free(ptr); }


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

x86 assembly (clang, -O2):
<kfree>:
jmp    1030 <inv_free@plt>

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

LLVM IR (-O2):
define void @kfree(i8* %0) {
%2 = tail call i32 @inv_free(i8* %0)
ret void
}
char _default_auth_need_root() { return 0; }


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

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

LLVM IR (-O0):
define signext i8 @_default_auth_need_root() {
ret i8 0
}

LLVM IR (-O2):
define signext i8 @_default_auth_need_root() {
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void Port_Sleep(void) { usleep(10000); }


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

x86 assembly (clang, -O2):
<Port_Sleep>:
mov    $0x2710,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @Port_Sleep() {
%1 = call i32 @usleep(i32 10000)
ret void
}

LLVM IR (-O2):
define void @Port_Sleep() {
%1 = tail call i32 @usleep(i32 10000)
ret void
}
int double_param(double *p) {
  *p = 7;
  return 1;
}


x86 assembly (clang, -O0):
<double_param>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xeec(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_param>:
movabs $0x401c000000000000,%rax
mov    %rax,(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @double_param(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
store double 7.000000e+00, double* %3
ret i32 1
}

LLVM IR (-O2):
define i32 @double_param(double* nocapture writeonly %0) {
store double 7.000000e+00, double* %0
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ beep();
void display_beep(void) { beep(); }


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

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

LLVM IR (-O0):
define void @display_beep() {
%1 = call i32 (...) @beep()
ret void
}

LLVM IR (-O2):
define void @display_beep() {
%1 = tail call i32 (...) @beep()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void pmu_adc_disable() {
  mbus_remote_register_write(0x6, 0x3B,
                             ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) |
                              (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) |
                              (1 << 8) | (1 << 9) | (1 << 10) | (0 << 11) |
                              (0 << 12) | (0 << 13) | (1 << 14) | (1 << 15) |
                              (1 << 16) | (1 << 17) | (1 << 18) | (1 << 19)));
  delay(200);
}


x86 assembly (clang, -O0):
<pmu_adc_disable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0x3b,%esi
mov    $0xfc7ff,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmu_adc_disable>:
push   %rax
mov    $0x6,%edi
mov    $0x3b,%esi
mov    $0xfc7ff,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @pmu_adc_disable() {
%1 = call i32 @mbus_remote_register_write(i32 6, i32 59, i32 1034239)
%2 = call i32 @delay(i32 200)
ret void
}

LLVM IR (-O2):
define void @pmu_adc_disable() {
%1 = tail call i32 @mbus_remote_register_write(i32 6, i32 59, i32 1034239)
%2 = tail call i32 @delay(i32 200)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Disp_Resize(int, int);
void App_OnResize(int w, int h) { Disp_Resize(w, h); }


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

x86 assembly (clang, -O2):
<App_OnResize>:
jmp    1030 <Disp_Resize@plt>

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

LLVM IR (-O2):
define void @App_OnResize(i32 %0, i32 %1) {
%3 = tail call i32 @Disp_Resize(i32 %0, i32 %1)
ret void
}
void smpboot_restore_warm_reset_vector(void) {}


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

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

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

LLVM IR (-O2):
define void @smpboot_restore_warm_reset_vector() {
ret void
}
/* Variables and functions */
unsigned short fK(unsigned short, unsigned short);
unsigned short initialP(unsigned short);
unsigned short inverseP(unsigned short);
unsigned short switch_a_roo(unsigned short);
unsigned short encryptDecrypt(unsigned short input, unsigned short kOne,
                              unsigned short kTwo) {
  input = initialP(input);
  input = fK(input, kOne);
  input = switch_a_roo(input);
  input = fK(input, kTwo);
  input = inverseP(input);
  return input;
}


x86 assembly (clang, -O0):
<encryptDecrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dx,%ax
mov    %si,%cx
mov    %di,%dx
mov    %dx,-0x2(%rbp)
mov    %cx,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
movzwl -0x2(%rbp),%edi
call   1060 <initialP@plt>
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
movzwl %ax,%edi
movzwl -0x4(%rbp),%esi
call   1050 <fK@plt>
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edi
call   1030 <switch_a_roo@plt>
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
movzwl %ax,%edi
movzwl -0x6(%rbp),%esi
call   1050 <fK@plt>
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edi
call   1040 <inverseP@plt>
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encryptDecrypt>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
call   1060 <initialP@plt>
movzwl %ax,%edi
mov    %ebp,%esi
call   1050 <fK@plt>
movzwl %ax,%edi
call   1030 <switch_a_roo@plt>
movzwl %ax,%edi
mov    %ebx,%esi
call   1050 <fK@plt>
movzwl %ax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <inverseP@plt>

LLVM IR (-O0):
define zeroext i16 @encryptDecrypt(i16 zeroext %0, i16 zeroext %1, i16 zeroext %2) {
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16
store i16 %0, i16* %4
store i16 %1, i16* %5
store i16 %2, i16* %6
%7 = load i16, i16* %4
%8 = call zeroext i16 @initialP(i16 zeroext %7)
store i16 %8, i16* %4
%9 = load i16, i16* %4
%10 = load i16, i16* %5
%11 = call zeroext i16 @fK(i16 zeroext %9, i16 zeroext %10)
store i16 %11, i16* %4
%12 = load i16, i16* %4
%13 = call zeroext i16 @switch_a_roo(i16 zeroext %12)
store i16 %13, i16* %4
%14 = load i16, i16* %4
%15 = load i16, i16* %6
%16 = call zeroext i16 @fK(i16 zeroext %14, i16 zeroext %15)
store i16 %16, i16* %4
%17 = load i16, i16* %4
%18 = call zeroext i16 @inverseP(i16 zeroext %17)
store i16 %18, i16* %4
%19 = load i16, i16* %4
ret i16 %19
}

LLVM IR (-O2):
define zeroext i16 @encryptDecrypt(i16 zeroext %0, i16 zeroext %1, i16 zeroext %2) {
%4 = tail call zeroext i16 @initialP(i16 zeroext %0)
%5 = tail call zeroext i16 @fK(i16 zeroext %4, i16 zeroext %1)
%6 = tail call zeroext i16 @switch_a_roo(i16 zeroext %5)
%7 = tail call zeroext i16 @fK(i16 zeroext %6, i16 zeroext %2)
%8 = tail call zeroext i16 @inverseP(i16 zeroext %7)
ret i16 %8
}
/* Variables and functions */
void *malloc(unsigned int);
void *realloc(void *, unsigned int);
void *av_realloc(void *ptr, unsigned int size) {
  if (!ptr)
    return malloc(size);
  else
    return realloc(ptr, size);
}


x86 assembly (clang, -O0):
<av_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <av_realloc+0x2b>
mov    -0x14(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
jmp    115b <av_realloc+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_realloc>:
test   %rdi,%rdi
je     112a <av_realloc+0xa>
jmp    1040 <realloc@plt>
mov    %esi,%edi
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define i8* @av_realloc(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @malloc(i32 %1)
br label %8
6: ; preds = %2
%7 = tail call i8* @realloc(i8* %0, i32 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %7, %6 ], [ %5, %4 ]
ret i8* %9
}
const char *_str_chk_null(const char *s) { return s ? s : "<undefined>"; }


x86 assembly (clang, -O0):
<_str_chk_null>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1120 <_str_chk_null+0x20>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1130 <_str_chk_null+0x30>
lea    0xed9(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1130 <_str_chk_null+0x30>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_str_chk_null>:
test   %rdi,%rdi
lea    0xef6(%rip),%rax
cmovne %rdi,%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"<undefined>\00"
define i8* @_str_chk_null(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i8*, i8** %2
br label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %5
%9 = phi i8* [ %6, %5 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %7 ]
ret i8* %9
}

LLVM IR (-O2):
@.str = [12 x i8] c"<undefined>\00"
define i8* @_str_chk_null(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ close_terminal();
int /*<<< orphan*/ stop_kmc_server(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc >= 2 && !strcmp(argv[1], "0"))
    close_terminal();
  stop_kmc_server(NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1174 <main+0x44>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea1(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1174 <main+0x44>
mov    $0x0,%al
call   1030 <close_terminal@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <stop_kmc_server@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     1151 <main+0x21>
mov    0x8(%rsi),%rdi
lea    0xebf(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1151 <main+0x21>
xor    %eax,%eax
call   1030 <close_terminal@plt>
xor    %edi,%edi
call   1050 <stop_kmc_server@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sge i32 %6, 2
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %8
%15 = call i32 (...) @close_terminal()
br label %16
16: ; preds = %14, %8, %2
%17 = call i32 @stop_kmc_server(i32* null)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 (...) @close_terminal()
br label %11
11: ; preds = %9, %4, %2
%12 = tail call i32 @stop_kmc_server(i32* null)
ret i32 0
}
void Injector5ISR() {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @tlib_on_cpu_power_down() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printUsage() {
  printf("factorial: calculate the n factorial value\n");
  printf("USAGE: ./{gcc factorial.c} {n}\n");
}


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

x86 assembly (clang, -O2):
<printUsage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf07(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"factorial: calculate the n factorial value\0A\00"
@.str.1 = [32 x i8] c"USAGE: ./{gcc factorial.c} {n}\0A\00"
define void @printUsage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [43 x i8] c"factorial: calculate the n factorial value\00"
@str.2 = [31 x i8] c"USAGE: ./{gcc factorial.c} {n}\00"
define void @printUsage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ time_t;

/* Variables and functions */
int /*<<< orphan*/ perror(char *);
scalar_t__ time(int /*<<< orphan*/ *);
double get_time() {
  time_t t = time(NULL);
  if (t == (time_t)-1) {
    perror("time");
    return -1.0;
  }
  return (double)t;
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0xffffffffffffffff,-0x10(%rbp)
jne    115e <get_time+0x3e>
lea    0xec1(%rip),%rdi
call   1040 <perror@plt>
movsd  0xeac(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1169 <get_time+0x49>
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
push   %rax
xor    %edi,%edi
call   1030 <time@plt>
cmp    $0xffffffffffffffff,%rax
je     1135 <get_time+0x15>
cvtsi2sd %rax,%xmm0
pop    %rax
ret
lea    0xecc(%rip),%rdi
call   1040 <perror@plt>
movsd  0xeb7(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"time\00"
define double @get_time() {
%1 = alloca double
%2 = alloca i64
%3 = call i64 @time(i32* null)
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store double -1.000000e+00, double* %1
br label %11
8: ; preds = %0
%9 = load i64, i64* %2
%10 = sitofp i64 %9 to double
store double %10, double* %1
br label %11
11: ; preds = %8, %6
%12 = load double, double* %1
ret double %12
}

LLVM IR (-O2):
@.str = [5 x i8] c"time\00"
define double @get_time() {
%1 = tail call i64 @time(i32* null)
%2 = icmp eq i64 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = sitofp i64 %1 to double
br label %7
7: ; preds = %5, %3
%8 = phi double [ -1.000000e+00, %3 ], [ %6, %5 ]
ret double %8
}
int fun398() { return 398; }


x86 assembly (clang, -O0):
<fun398>:
push   %rbp
mov    %rsp,%rbp
mov    $0x18e,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fun398() {
ret i32 398
}

LLVM IR (-O2):
define i32 @fun398() {
ret i32 398
}
long long llabs(long long i) {
  if (i < 0)
    return -i;
  else
    return i;
}


x86 assembly (clang, -O0):
<llabs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1122 <llabs+0x22>
xor    %eax,%eax
sub    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    112a <llabs+0x2a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @llabs(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i64, i64* %3
%8 = sub nsw i64 0, %7
store i64 %8, i64* %2
br label %11
9: ; preds = %1
%10 = load i64, i64* %3
store i64 %10, i64* %2
br label %11
11: ; preds = %9, %6
%12 = load i64, i64* %2
ret i64 %12
}

LLVM IR (-O2):
define i64 @llabs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
void print_str_dummy(void *data, const char *str, unsigned int len) {}


x86 assembly (clang, -O0):
<print_str_dummy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @print_str_dummy(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @print_str_dummy(i8* nocapture %0, i8* nocapture %1, i32 %2) {
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
scalar_t__ strlen(char *);
int GetCommandWord(char *Text, char *Command) {
  if (strlen(Text) == strlen(Command))
    return (strcmp(Text, Command));
  else
    return (1);
}


x86 assembly (clang, -O0):
<GetCommandWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jne    116b <GetCommandWord+0x4b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x4(%rbp)
jmp    1172 <GetCommandWord+0x52>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetCommandWord>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %rax,%rbx
jne    1150 <GetCommandWord+0x30>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <strcmp@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @GetCommandWord(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ 1, %2 ]
ret i32 %9
}
int test_imm_5Cuint16_reg(unsigned short val) {
  return ((val) & (-0x5C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_5Cuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffffa4,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_5Cuint16_reg>:
test   $0xffa4,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_5Cuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -92
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int pclose(FILE *stream) {
  fprintf(stderr, "Warning: pclose() unimplemented\n");
  return -1;
}


x86 assembly (clang, -O0):
<pclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pclose>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Warning: pclose() unimplemented\0A\00"
define i32 @pclose(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Warning: pclose() unimplemented\0A\00"
define i32 @pclose(i32* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void *thread_function2(void *arg) {
  while (1)
    sleep(1);
  return NULL;
}


x86 assembly (clang, -O0):
<thread_function2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <sleep@plt>
jmp    111c <thread_function2+0xc>

x86 assembly (clang, -O2):
<thread_function2>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <sleep@plt>
jmp    1120 <thread_function2+0x10>

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

LLVM IR (-O2):
define noalias i8* @thread_function2(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @sleep(i32 1)
br label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ posix_spawn_file_actions_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *file_actions,
                                     int fildes, int newfildes) {
  ;
  errno = ENOSYS;
  return -1;
  ;
}


x86 assembly (clang, -O0):
<posix_spawn_file_actions_adddup2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%ecx
mov    0x2eba(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<posix_spawn_file_actions_adddup2>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @posix_spawn_file_actions_adddup2(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* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @posix_spawn_file_actions_adddup2(i32* nocapture readnone %0, i32 %1, i32 %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
void fprint_anl_to_direct(FILE *stream, uint8_t direct) {
  fprintf(stream,
          "ANL   "
          "0x%02X"
          ", A                   ",
          direct);
}


x86 assembly (clang, -O0):
<fprint_anl_to_direct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_anl_to_direct>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"ANL 0x%02X, A \00"
define void @fprint_anl_to_direct(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"ANL 0x%02X, A \00"
define void @fprint_anl_to_direct(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void putLDCharKR(void) { printf("\x01B(0\x06E\x01B(B"); }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"\1B(0n\1B(B\00"
define void @putLDCharKR() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
FILE *popen(const char *command, const char *type) {
  fprintf(stderr, "Warning: popen() unimplemented\n");
  return NULL;
}


x86 assembly (clang, -O0):
<popen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<popen>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Warning: popen() unimplemented\0A\00"
define i32* @popen(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret i32* null
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Warning: popen() unimplemented\0A\00"
define noalias i32* @popen(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret i32* null
}
/* Variables and functions */
int execl(char *, char *, char *);
char *find_test(char const *, char const *, char const *);
int /*<<< orphan*/ sysdie(char *, char *);
void test_single(const char *program, const char *source, const char *build) {
  char *path;
  path = find_test(program, source, build);
  if (execl(path, path, (char *)0) == -1)
    sysdie("cannot exec %s", path);
}


x86 assembly (clang, -O0):
<test_single>:
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
mov    -0x18(%rbp),%rdx
call   1040 <find_test@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <execl@plt>
cmp    $0xffffffff,%eax
jne    1183 <test_single+0x53>
mov    -0x20(%rbp),%rsi
lea    0xe82(%rip),%rdi
call   1030 <sysdie@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_single>:
push   %rbx
call   1040 <find_test@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rax,%rsi
xor    %edx,%edx
call   1050 <execl@plt>
cmp    $0xffffffff,%eax
je     114d <test_single+0x1d>
pop    %rbx
ret
lea    0xeac(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <sysdie@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"cannot exec %s\00"
define void @test_single(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i8* @find_test(i8* %8, i8* %9, i8* %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = load i8*, i8** %7
%14 = call i32 @execl(i8* %12, i8* %13, i8* null)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %19
16: ; preds = %3
%17 = load i8*, i8** %7
%18 = call i32 @sysdie(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %16, %3
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"cannot exec %s\00"
define void @test_single(i8* %0, i8* %1, i8* %2) {
%4 = tail call i8* @find_test(i8* %0, i8* %1, i8* %2)
%5 = tail call i32 @execl(i8* %4, i8* %4, i8* null)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @sysdie(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %9
9: ; preds = %7, %3
ret void
}