xunge/DecIR huggingface dataset:
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *, int /*<<< orphan*/);
int read_standard_target_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(11, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<read_standard_target_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xb,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_standard_target_system>:
mov    $0xb,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @read_standard_target_system() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 11, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @read_standard_target_system() {
%1 = tail call i32 @_ada_use_c2phc(i32 11, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
unsigned int get_4_be(const unsigned char *ptr) {
  return ptr[3] | (ptr[2] << 8) | (ptr[1] << 16) | (ptr[0] << 24);
}


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

x86 assembly (clang, -O2):
<get_4_be>:
mov    (%rdi),%eax
bswap  %eax
ret

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

LLVM IR (-O2):
define i32 @get_4_be(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 16
%14 = or i32 %9, %13
%15 = load i8, i8* %0
%16 = zext i8 %15 to i32
%17 = shl nuw i32 %16, 24
%18 = or i32 %14, %17
ret i32 %18
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int x;
  int y;
  int res;
  x = __VERIFIER_nondet_int();
  y = __VERIFIER_nondet_int();
  res = 0;
  while (x > y) {
    y = x + 1;
    res = res + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    115d <main+0x4d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113a <main+0x2a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}
int detab(char line[], int s) {
  int t;
  for (t = 0; t < 4; ++t) {
    line[s + t] = ' ';
  }
  return (s + 4 - 1);
}


x86 assembly (clang, -O0):
<detab>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    113b <detab+0x3b>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <detab+0x12>
mov    -0xc(%rbp),%eax
add    $0x4,%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<detab>:
movslq %esi,%rax
movl   $0x20202020,(%rdi,%rax,1)
add    $0x3,%eax
ret

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

LLVM IR (-O2):
define i32 @detab(i8* nocapture writeonly %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr i8, i8* %0, i64 %3
%5 = bitcast i8* %4 to i32*
store i32 538976288, i32* %5
%6 = add nsw i32 %1, 3
ret i32 %6
}
/* Variables and functions */
int tracepoint_probe_unregister(char *, void *);
__attribute__((always_)) int unregister_trace_mm_page_free_direct(
    void (*probe)(struct page *page, unsigned int order)) {
  return tracepoint_probe_unregister("mm_page_free_direct", (void *)probe);
}


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

x86 assembly (clang, -O2):
<unregister_trace_mm_page_free_direct>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <tracepoint_probe_unregister@plt>

LLVM IR (-O0):
%struct.page = type opaque
@.str = [20 x i8] c"mm_page_free_direct\00"
define i32 @unregister_trace_mm_page_free_direct(void (%struct.page*, i32)* %0) {
%2 = alloca void (%struct.page*, i32)*
store void (%struct.page*, i32)* %0, void (%struct.page*, i32)** %2
%3 = load void (%struct.page*, i32)*, void (%struct.page*, i32)** %2
%4 = bitcast void (%struct.page*, i32)* %3 to i8*
%5 = call i32 @tracepoint_probe_unregister(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.page = type opaque
@.str = [20 x i8] c"mm_page_free_direct\00"
define i32 @unregister_trace_mm_page_free_direct(void (%struct.page*, i32)* %0) {
%2 = bitcast void (%struct.page*, i32)* %0 to i8*
%3 = tail call i32 @tracepoint_probe_unregister(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ consolePrintLinesList(int /*<<< orphan*/);
int /*<<< orphan*/ utilStrListOfLines(char *);
void consolePrint(char *str) { consolePrintLinesList(utilStrListOfLines(str)); }


x86 assembly (clang, -O0):
<consolePrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <utilStrListOfLines@plt>
mov    %eax,%edi
call   1040 <consolePrintLinesList@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<consolePrint>:
push   %rax
call   1030 <utilStrListOfLines@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <consolePrintLinesList@plt>

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

LLVM IR (-O2):
define void @consolePrint(i8* %0) {
%2 = tail call i32 @utilStrListOfLines(i8* %0)
%3 = tail call i32 @consolePrintLinesList(i32 %2)
ret void
}
/* Type definitions */
struct passwd {
  long pw_uid;
};

/* Variables and functions */
int /*<<< orphan*/ bb_error_msg_and_die(char *, char const *);
struct passwd *getpwnam(char const *);
long my_getpwnam(const char *name) {
  struct passwd *myuser;
  myuser = getpwnam(name);
  if (myuser == NULL)
    bb_error_msg_and_die("unknown user name: %s", name);
  return myuser->pw_uid;
}


x86 assembly (clang, -O0):
<my_getpwnam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getpwnam@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <my_getpwnam+0x34>
mov    -0x8(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1040 <bb_error_msg_and_die@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_getpwnam>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <getpwnam@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <my_getpwnam+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1040 <bb_error_msg_and_die@plt>
mov    (%rbx),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.passwd = type { i64 }
@.str = [22 x i8] c"unknown user name: %s\00"
define i64 @my_getpwnam(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.passwd*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call %struct.passwd* @getpwnam(i8* %4)
store %struct.passwd* %5, %struct.passwd** %3
%6 = load %struct.passwd*, %struct.passwd** %3
%7 = icmp eq %struct.passwd* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @bb_error_msg_and_die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %1
%12 = load %struct.passwd*, %struct.passwd** %3
%13 = getelementptr inbounds %struct.passwd, %struct.passwd* %12, i32 0, i32 0
%14 = load i64, i64* %13
ret i64 %14
}

LLVM IR (-O2):
%struct.passwd = type { i64 }
@.str = [22 x i8] c"unknown user name: %s\00"
define i64 @my_getpwnam(i8* %0) {
%2 = tail call %struct.passwd* @getpwnam(i8* %0)
%3 = icmp eq %struct.passwd* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @bb_error_msg_and_die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %1
%7 = getelementptr inbounds %struct.passwd, %struct.passwd* %2, i64 0, i32 0
%8 = load i64, i64* %7
ret i64 %8
}
/* Variables and functions */
void *ChebCellStruct_create(long long, int *);
void *cheb_init_cell(int level, long long morton_index, int *tree_position,
                     double *spatial_position, void *KernelDatas) {
  return ChebCellStruct_create(morton_index, tree_position);
}


x86 assembly (clang, -O0):
<cheb_init_cell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <ChebCellStruct_create@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cheb_init_cell>:
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1030 <ChebCellStruct_create@plt>

LLVM IR (-O0):
define i8* @cheb_init_cell(i32 %0, i64 %1, i32* %2, double* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32*
%9 = alloca double*
%10 = alloca i8*
store i32 %0, i32* %6
store i64 %1, i64* %7
store i32* %2, i32** %8
store double* %3, double** %9
store i8* %4, i8** %10
%11 = load i64, i64* %7
%12 = load i32*, i32** %8
%13 = call i8* @ChebCellStruct_create(i64 %11, i32* %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @cheb_init_cell(i32 %0, i64 %1, i32* %2, double* nocapture readnone %3, i8* nocapture readnone %4) {
%6 = tail call i8* @ChebCellStruct_create(i64 %1, i32* %2)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ is_pow2(unsigned long);
int log2i(unsigned long);
unsigned long ceil_pow2(unsigned long x) {
  if (!is_pow2(x))
    return (unsigned long)1 << (log2i(x) + 1);
  else
    return x;
}


x86 assembly (clang, -O0):
<ceil_pow2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <is_pow2@plt>
cmp    $0x0,%eax
jne    115f <ceil_pow2+0x3f>
mov    -0x10(%rbp),%rdi
call   1030 <log2i@plt>
add    $0x1,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,-0x8(%rbp)
jmp    1167 <ceil_pow2+0x47>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil_pow2>:
push   %rbx
mov    %rdi,%rbx
call   1040 <is_pow2@plt>
test   %eax,%eax
jne    1140 <ceil_pow2+0x20>
mov    %rbx,%rdi
call   1030 <log2i@plt>
lea    0x1(%rax),%ecx
mov    $0x1,%ebx
shl    %cl,%rbx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @ceil_pow2(i64 %0) {
%2 = tail call i32 @is_pow2(i64 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i32 @log2i(i64 %0)
%6 = add nsw i32 %5, 1
%7 = zext i32 %6 to i64
%8 = shl nuw i64 1, %7
br label %9
9: ; preds = %1, %4
%10 = phi i64 [ %8, %4 ], [ %0, %1 ]
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ _Z80SimPrintCharacter(char);
void _Z80SimPrintString(char *String) {
  int i;
  i = 0;
  while (String[i] != '\0') {
    _Z80SimPrintCharacter(String[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<_Z80SimPrintString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1157 <_Z80SimPrintString+0x47>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <_Z80SimPrintCharacter@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <_Z80SimPrintString+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Z80SimPrintString>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <_Z80SimPrintString+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <_Z80SimPrintCharacter@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <_Z80SimPrintString+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @_Z80SimPrintString(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @_Z80SimPrintCharacter(i8 signext %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
int compar(const char *s1, const char *s2) {
  int ret;
  while ((ret = *s1 - *s2++) == 0 && *s1++ != '\0')
    continue;
  return ret;
}


x86 assembly (clang, -O0):
<compar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movsbl (%rax),%eax
sub    %eax,%ecx
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
jne    1153 <compar+0x53>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1163 <compar+0x63>
jmp    1168 <compar+0x68>
jmp    110c <compar+0xc>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compar>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rdi,%rcx,1),%edx
movsbl (%rsi,%rcx,1),%r8d
mov    %edx,%eax
sub    %r8d,%eax
jne    1128 <compar+0x28>
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <compar+0x10>
ret

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

LLVM IR (-O2):
define i32 @compar(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %12, %3 ]
%5 = phi i8* [ %0, %2 ], [ %13, %3 ]
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %7, %9
%11 = icmp ne i32 %10, 0
%12 = getelementptr inbounds i8, i8* %4, i64 1
%13 = getelementptr inbounds i8, i8* %5, i64 1
%14 = icmp eq i8 %6, 0
%15 = select i1 %11, i1 true, i1 %14
br i1 %15, label %16, label %3
16: ; preds = %3
ret i32 %10
}
int test_imm_76uint32_mem(unsigned int *val) {
  return ((*val) & (0x76 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_76uint32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0x76,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_76uint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 118
%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_76uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 118
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ strcmp(char *, char *);
void __attribute__((no)) foo(char *str) {
  if (strcmp(str, "THIS IS A TEST") != 0)
    abort();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     114d <foo+0x2d>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1134 <foo+0x14>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"THIS IS A TEST\00"
define void @foo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"THIS IS A TEST\00"
define void @foo(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %1
ret void
}
unsigned affine(unsigned x) {
  return 0xff & (0x63 ^ x ^ (x >> 4) ^ (x << 4) ^ (x >> 5) ^ (x << 3) ^
                 (x >> 6) ^ (x << 2) ^ (x >> 7) ^ (x << 1));
}


x86 assembly (clang, -O0):
<affine>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0x63,%eax
mov    -0x4(%rbp),%ecx
shr    $0x4,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x4,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
shr    $0x5,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x3,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
shr    $0x6,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
shr    $0x7,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
xor    %ecx,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<affine>:
mov    %edi,%eax
shr    $0x4,%eax
xor    %edi,%eax
mov    %edi,%ecx
shl    $0x4,%ecx
mov    %edi,%edx
shr    $0x5,%edx
xor    %ecx,%edx
xor    %eax,%edx
lea    0x0(,%rdi,8),%eax
mov    %edi,%ecx
shr    $0x6,%ecx
xor    %eax,%ecx
lea    0x0(,%rdi,4),%eax
xor    %ecx,%eax
xor    %edx,%eax
mov    %edi,%ecx
shr    $0x7,%ecx
add    %edi,%edi
xor    %ecx,%edi
xor    %eax,%edi
movzbl %dil,%eax
xor    $0x63,%eax
ret

LLVM IR (-O0):
define i32 @affine(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = xor i32 99, %3
%5 = load i32, i32* %2
%6 = lshr i32 %5, 4
%7 = xor i32 %4, %6
%8 = load i32, i32* %2
%9 = shl i32 %8, 4
%10 = xor i32 %7, %9
%11 = load i32, i32* %2
%12 = lshr i32 %11, 5
%13 = xor i32 %10, %12
%14 = load i32, i32* %2
%15 = shl i32 %14, 3
%16 = xor i32 %13, %15
%17 = load i32, i32* %2
%18 = lshr i32 %17, 6
%19 = xor i32 %16, %18
%20 = load i32, i32* %2
%21 = shl i32 %20, 2
%22 = xor i32 %19, %21
%23 = load i32, i32* %2
%24 = lshr i32 %23, 7
%25 = xor i32 %22, %24
%26 = load i32, i32* %2
%27 = shl i32 %26, 1
%28 = xor i32 %25, %27
%29 = and i32 255, %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @affine(i32 %0) {
%2 = lshr i32 %0, 4
%3 = xor i32 %2, %0
%4 = shl i32 %0, 4
%5 = xor i32 %3, %4
%6 = lshr i32 %0, 5
%7 = xor i32 %5, %6
%8 = shl i32 %0, 3
%9 = xor i32 %7, %8
%10 = lshr i32 %0, 6
%11 = xor i32 %9, %10
%12 = shl i32 %0, 2
%13 = xor i32 %11, %12
%14 = lshr i32 %0, 7
%15 = xor i32 %13, %14
%16 = shl i32 %0, 1
%17 = xor i32 %15, %16
%18 = and i32 %17, 255
%19 = xor i32 %18, 99
ret i32 %19
}
double FTtoMM(double FT) { return FT * 304.8; }


x86 assembly (clang, -O0):
<FTtoMM>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<FTtoMM>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @FTtoMM(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 3.048000e+02
ret double %4
}

LLVM IR (-O2):
define double @FTtoMM(double %0) {
%2 = fmul double %0, 3.048000e+02
ret double %2
}
void foo_smp_v2() {}


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

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

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

LLVM IR (-O2):
define void @foo_smp_v2() {
ret void
}
/* Variables and functions */
int getnpar(int /*<<< orphan*/, char *, char *, double *);
int getpardouble(char *name, double *ptr) { return getnpar(0, name, "d", ptr); }


x86 assembly (clang, -O0):
<getpardouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rcx
xor    %edi,%edi
lea    0xecf(%rip),%rdx
call   1030 <getnpar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getpardouble>:
mov    %rsi,%rcx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdx
xor    %edi,%edi
jmp    1030 <getnpar@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"d\00"
define i32 @getpardouble(i8* %0, double* %1) {
%3 = tail call i32 @getnpar(i32 0, i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), double* %1)
ret i32 %3
}
void log_process_stack_size() {}


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

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

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

LLVM IR (-O2):
define void @log_process_stack_size() {
ret void
}
int iobroker_max_usable_fds(void) { return 256UL; }


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

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

LLVM IR (-O0):
define i32 @iobroker_max_usable_fds() {
ret i32 256
}

LLVM IR (-O2):
define i32 @iobroker_max_usable_fds() {
ret i32 256
}
/* Variables and functions */
int close(int);
int sock_close(int sock) { return close(sock); }


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

x86 assembly (clang, -O2):
<sock_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @sock_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
void rop3_20_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = T ^ S;
  stk2 = ~stk2;
  stk1 = *D | stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_20_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)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
or     %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_20_1_1>:
or     %edx,%esi
and    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_20_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* %6
%10 = zext i8 %9 to i32
%11 = load i8, i8* %5
%12 = zext i8 %11 to i32
%13 = xor i32 %10, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %8
%15 = load i8, i8* %8
%16 = zext i8 %15 to i32
%17 = xor i32 %16, -1
%18 = trunc i32 %17 to i8
store i8 %18, i8* %8
%19 = load i8*, i8** %4
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = load i8, i8* %8
%23 = zext i8 %22 to i32
%24 = or 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_20_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %2, %1
%6 = and i8 %4, %5
store i8 %6, i8* %0
ret void
}
/* Variables and functions */
int foo(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  printf("foo(%d)=%d\n", 2, foo(2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
call   1040 <foo@plt>
mov    %eax,%edx
lea    0xebe(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1040 <foo@plt>
lea    0xece(%rip),%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"foo(%d)=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @foo(i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2, i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int write(int, char const *, int);
int serialport_writebytes(int fd, const char *str, int len) {
  int n = write(fd, str, len);
  if (n != len) {
    perror("serialport_write: couldn't write whole array\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<serialport_writebytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1168 <serialport_writebytes+0x48>
lea    0xea9(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    116f <serialport_writebytes+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialport_writebytes>:
push   %rbx
mov    %edx,%ebx
call   1030 <write@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
jne    1132 <serialport_writebytes+0x12>
pop    %rbx
ret
lea    0xec7(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"serialport_write: couldn't write whole array\0A\00"
define i32 @serialport_writebytes(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = call i32 @write(i32 %9, i8* %10, i32 %11)
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = load i32, i32* %7
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %3
%17 = call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %19
18: ; preds = %3
store i32 0, i32* %4
br label %19
19: ; preds = %18, %16
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
@.str = [46 x i8] c"serialport_write: couldn't write whole array\0A\00"
define i32 @serialport_writebytes(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
%5 = icmp eq i32 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ -1, %6 ], [ 0, %3 ]
ret i32 %9
}
/* Variables and functions */
int clone(void *(*)(void *), void *, void *);
void *malloc(int);
int mypthread_create(void *(start_routine)(void *), void *arg) {
  int pid;
  void *stack = malloc(4096);
  pid = clone(start_routine, arg, stack);
  return pid;
}


x86 assembly (clang, -O0):
<mypthread_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1000,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <clone@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mypthread_create>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x1000,%edi
call   1040 <malloc@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <clone@plt>

LLVM IR (-O0):
define i32 @mypthread_create(i8* (i8*)* %0, i8* %1) {
%3 = alloca i8* (i8*)*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* (i8*)* %0, i8* (i8*)** %3
store i8* %1, i8** %4
%7 = call i8* @malloc(i32 4096)
store i8* %7, i8** %6
%8 = load i8* (i8*)*, i8* (i8*)** %3
%9 = load i8*, i8** %4
%10 = load i8*, i8** %6
%11 = call i32 @clone(i8* (i8*)* %8, i8* %9, i8* %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @mypthread_create(i8* (i8*)* %0, i8* %1) {
%3 = tail call dereferenceable_or_null(4096) i8* @malloc(i32 4096)
%4 = tail call i32 @clone(i8* (i8*)* %0, i8* %1, i8* %3)
ret i32 %4
}
double floor(double x) {}


x86 assembly (clang, -O0):
<floor>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define double @floor(double %0) {
ret double undef
}
void eabs(x) unsigned short x[];
{ x[6 - 1] &= 0x7fff; }


x86 assembly (clang, -O0):
<eabs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl 0xa(%rax),%ecx
and    $0x7fff,%ecx
mov    %cx,0xa(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<eabs>:
andb   $0x7f,0xb(%rdi)
ret

LLVM IR (-O0):
define void @eabs(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = getelementptr inbounds i16, i16* %3, i64 5
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
%7 = and i32 %6, 32767
%8 = trunc i32 %7 to i16
store i16 %8, i16* %4
ret void
}

LLVM IR (-O2):
define void @eabs(i16* nocapture %0) {
%2 = getelementptr inbounds i16, i16* %0, i64 5
%3 = load i16, i16* %2
%4 = and i16 %3, 32767
store i16 %4, i16* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int calculateTriangularNumber(int n) {
  int i, triangularNumber = 0;
  for (i = 1; i <= n; ++i)
    triangularNumber += i;
  printf("Triangular number %i is %i\n", n, triangularNumber);
  return (triangularNumber);
}


x86 assembly (clang, -O0):
<calculateTriangularNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     114c <calculateTriangularNumber+0x3c>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <calculateTriangularNumber+0x19>
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateTriangularNumber>:
push   %rbx
mov    %edi,%esi
test   %edi,%edi
jle    112c <calculateTriangularNumber+0x1c>
lea    -0x1(%rsi),%eax
lea    -0x2(%rsi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rsi,2),%ebx
add    $0xffffffff,%ebx
jmp    112e <calculateTriangularNumber+0x1e>
xor    %ebx,%ebx
lea    0xecb(%rip),%rdi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Triangular number %i is %i\0A\00"
define i32 @calculateTriangularNumber(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
store i32 1, i32* %3
br label %5
5: ; preds = %13, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = add nsw i32 %11, %10
store i32 %12, i32* %4
br label %13
13: ; preds = %9
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %5
16: ; preds = %5
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
@.str = [28 x i8] c"Triangular number %i is %i\0A\00"
define i32 @calculateTriangularNumber(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = shl nuw i32 %0, 1
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add nsw i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -1
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
%16 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %15)
ret i32 %15
}
cbuf16(f, n) int f, n;
{ cbuf(f, n, 16); }


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

x86 assembly (clang, -O2):
<cbuf16>:
mov    $0x10,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf16(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %6, i32 %7, i32 16)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @cbuf16(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 16)
ret i32 undef
}
int ft_strlen(char *str) {
  int a;
  a = 0;
  while (str[a] != '\0') {
    a++;
  }
  return (a);
}


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

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

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

LLVM IR (-O2):
define i32 @ft_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
void CInc(ptr) char **ptr;
{
  if (**ptr != '\0')
    (*ptr)++;
  else
    return;
  SkipComments(ptr);
}


x86 assembly (clang, -O0):
<CInc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1142 <CInc+0x32>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1147 <CInc+0x37>
jmp    1152 <CInc+0x42>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <SkipComments@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CInc>:
mov    (%rdi),%rax
cmpb   $0x0,(%rax)
je     1126 <CInc+0x16>
add    $0x1,%rax
mov    %rax,(%rdi)
xor    %eax,%eax
jmp    1030 <SkipComments@plt>
ret

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

LLVM IR (-O2):
define void @CInc(i8** %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %6, i8** %0
%7 = tail call i32 (i8**, ...) bitcast (i32 (...)* @SkipComments to i32 (i8**, ...)*)(i8** %0)
br label %8
8: ; preds = %1, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void Point_print() { printf("Point\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"Point\00"
define void @Point_print() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void *mac_free_packet(char *packet) { free(packet); }


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

x86 assembly (clang, -O2):
<mac_free_packet>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define noalias i8* @mac_free_packet(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret i8* undef
}
/* Variables and functions */
int bcrypt_string_base64(char *, char *, int /*<<< orphan*/, char const *,
                         int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int cryptstring(char *st, const char *key) {
  return bcrypt_string_base64(st, st, strlen(st), key, 0);
}


x86 assembly (clang, -O0):
<cryptstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
mov    -0x10(%rbp),%rcx
xor    %r8d,%r8d
call   1040 <bcrypt_string_base64@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cryptstring>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
mov    %r14,%rcx
xor    %r8d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <bcrypt_string_base64@plt>

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

LLVM IR (-O2):
define i32 @cryptstring(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @bcrypt_string_base64(i8* %0, i8* %0, i32 %3, i8* %1, i32 0)
ret i32 %4
}