xunge/DecIR huggingface dataset:
void Dump(a, lo, hi) int a[], lo, hi;
{
  int i;
  for (i = lo; i <= hi; i++)
    printf("%d ", a[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<Dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     115b <Dump+0x4b>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1128 <Dump+0x18>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Dump>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    %edx,%esi
jg     1167 <Dump+0x47>
mov    %edx,%r12d
movslq %esi,%rax
lea    (%rdi,%rax,4),%r15
sub    %esi,%r12d
add    $0x1,%r12d
lea    0xebc(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1150 <Dump+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @Dump(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, %2
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = add i32 %2, 1
br label %8
8: ; preds = %5, %8
%9 = phi i64 [ %6, %5 ], [ %13, %8 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = add nsw i64 %9, 1
%14 = trunc i64 %13 to i32
%15 = icmp eq i32 %7, %14
br i1 %15, label %16, label %8
16: ; preds = %8, %3
%17 = tail call i32 @putchar(i32 10)
ret void
}
unsigned int hash2(const char *s) {
  unsigned int hashval;
  for (hashval = 0; *s != '\0'; s++) {
    hashval = *s + 31 * hashval;
  }
  return hashval % 101;
}


x86 assembly (clang, -O0):
<hash2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1140 <hash2+0x40>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash2+0xf>
mov    -0xc(%rbp),%eax
mov    $0x65,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash2>:
mov    (%rdi),%cl
test   %cl,%cl
je     1147 <hash2+0x47>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash2+0x10>
mov    %eax,%ecx
imul   $0x446f8657,%rcx,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x6,%edx
imul   $0x65,%edx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash2(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 31
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %10, 101
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
int md_server_main();
int main(int argc, char **argv) { return md_server_main(); }


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    $0x0,%al
call   1030 <md_server_main@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
jmp    1030 <md_server_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 = call i32 (...) @md_server_main()
ret i32 %6
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @md_server_main()
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  while (1)
    printf("salam nada!  ");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [14 x i8] c"salam nada! \00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %2
}

LLVM IR (-O2):
@.str = [14 x i8] c"salam nada! \00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %1
}
/* Type definitions */
struct mempool {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bzero(void *, unsigned int);
void *mp_alloc_fast(struct mempool *, unsigned int);
void *mp_alloc_zero(struct mempool *pool, unsigned size) {
  void *ptr = mp_alloc_fast(pool, size);
  bzero(ptr, size);
  return ptr;
}


x86 assembly (clang, -O0):
<mp_alloc_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <mp_alloc_fast@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <bzero@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_alloc_zero>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1030 <mp_alloc_fast@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %ebp,%esi
call   1040 <bzero@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.mempool = type { i32 }
define i8* @mp_alloc_zero(%struct.mempool* %0, i32 %1) {
%3 = alloca %struct.mempool*
%4 = alloca i32
%5 = alloca i8*
store %struct.mempool* %0, %struct.mempool** %3
store i32 %1, i32* %4
%6 = load %struct.mempool*, %struct.mempool** %3
%7 = load i32, i32* %4
%8 = call i8* @mp_alloc_fast(%struct.mempool* %6, i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i32, i32* %4
%11 = call i32 @bzero(i8* %9, i32 %10)
%12 = load i8*, i8** %5
ret i8* %12
}

LLVM IR (-O2):
%struct.mempool = type { i32 }
define i8* @mp_alloc_zero(%struct.mempool* %0, i32 %1) {
%3 = tail call i8* @mp_alloc_fast(%struct.mempool* %0, i32 %1)
%4 = tail call i32 @bzero(i8* %3, i32 %1)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int setvbuf(FILE *stream, char *buf, int mode, size_t size) { return 0; }


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

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

LLVM IR (-O0):
define i32 @setvbuf(i32* %0, i8* %1, i32 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i64
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i64 %3, i64* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @setvbuf(i32* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i64 %3) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void JoinStyle(int msg) { exit(0); }


x86 assembly (clang, -O0):
<JoinStyle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<JoinStyle>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @JoinStyle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @JoinStyle(i32 %0) {
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
struct read {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ destroy_read(struct read *);
int /*<<< orphan*/ free(struct read *);
void free_read(struct read *r) {
  if (r) {
    destroy_read(r);
    free(r);
  }
}


x86 assembly (clang, -O0):
<free_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1149 <free_read+0x29>
mov    -0x8(%rbp),%rdi
call   1040 <destroy_read@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_read>:
test   %rdi,%rdi
je     1137 <free_read+0x17>
push   %rbx
mov    %rdi,%rbx
call   1040 <destroy_read@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
%struct.read = type { i32 }
define void @free_read(%struct.read* %0) {
%2 = alloca %struct.read*
store %struct.read* %0, %struct.read** %2
%3 = load %struct.read*, %struct.read** %2
%4 = icmp ne %struct.read* %3, null
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load %struct.read*, %struct.read** %2
%7 = call i32 @destroy_read(%struct.read* %6)
%8 = load %struct.read*, %struct.read** %2
%9 = call i32 @free(%struct.read* %8)
br label %10
10: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
%struct.read = type { i32 }
define void @free_read(%struct.read* %0) {
%2 = icmp eq %struct.read* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @destroy_read(%struct.read* %0)
%5 = tail call i32 @free(%struct.read* %0)
br label %6
6: ; preds = %3, %1
ret void
}
/* Variables and functions */
int abs(int);
int /*<<< orphan*/ loop2();
int main(void) {
  loop2();
  return abs(3);
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @loop2()
%3 = call i32 @abs(i32 3)
ret i32 %3
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @loop2()
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ disp();
int /*<<< orphan*/ getData();
int /*<<< orphan*/ update();
int main() {
  getData();
  update();
  disp();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getData@plt>
mov    $0x0,%al
call   1030 <update@plt>
mov    $0x0,%al
call   1050 <disp@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getData()
%3 = call i32 (...) @update()
%4 = call i32 (...) @disp()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @getData()
%2 = tail call i32 (...) @update()
%3 = tail call i32 (...) @disp()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ emitbool(char *);
int /*<<< orphan*/ emitcondjmp(char *, int);
int /*<<< orphan*/ emitexpr(int);
int /*<<< orphan*/ emitlabel(int);
int newlabel();
void emitlog(int expr1, char cond[], int expr2) {
  emitexpr(expr1);
  int label = newlabel();
  emitcondjmp(cond, label);
  emitexpr(expr2);
  emitlabel(label);
  emitbool("nz");
}


x86 assembly (clang, -O0):
<emitlog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <emitexpr@plt>
mov    $0x0,%al
call   1040 <newlabel@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <emitcondjmp@plt>
mov    -0x14(%rbp),%edi
call   1070 <emitexpr@plt>
mov    -0x18(%rbp),%edi
call   1060 <emitlabel@plt>
lea    0xe69(%rip),%rdi
call   1050 <emitbool@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emitlog>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
call   1070 <emitexpr@plt>
xor    %eax,%eax
call   1040 <newlabel@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <emitcondjmp@plt>
mov    %r14d,%edi
call   1070 <emitexpr@plt>
mov    %ebp,%edi
call   1060 <emitlabel@plt>
lea    0xe78(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <emitbool@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"nz\00"
define void @emitlog(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = call i32 @emitexpr(i32 %8)
%10 = call i32 (...) @newlabel()
store i32 %10, i32* %7
%11 = load i8*, i8** %5
%12 = load i32, i32* %7
%13 = call i32 @emitcondjmp(i8* %11, i32 %12)
%14 = load i32, i32* %6
%15 = call i32 @emitexpr(i32 %14)
%16 = load i32, i32* %7
%17 = call i32 @emitlabel(i32 %16)
%18 = call i32 @emitbool(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"nz\00"
define void @emitlog(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @emitexpr(i32 %0)
%5 = tail call i32 (...) @newlabel()
%6 = tail call i32 @emitcondjmp(i8* %1, i32 %5)
%7 = tail call i32 @emitexpr(i32 %2)
%8 = tail call i32 @emitlabel(i32 %5)
%9 = tail call i32 @emitbool(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned int arikkei_ucs2_strlen(const unsigned short *str) {
  const unsigned short *s;
  s = str;
  while (*s)
    s += 1;
  return (unsigned int)(s - str);
}


x86 assembly (clang, -O0):
<arikkei_ucs2_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpw   $0x0,(%rax)
je     112f <arikkei_ucs2_strlen+0x2f>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <arikkei_ucs2_strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sar    $0x1,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @arikkei_ucs2_strlen(i16* %0) {
%2 = alloca i16*
%3 = alloca i16*
store i16* %0, i16** %2
%4 = load i16*, i16** %2
store i16* %4, i16** %3
br label %5
5: ; preds = %9, %1
%6 = load i16*, i16** %3
%7 = load i16, i16* %6
%8 = icmp ne i16 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i16*, i16** %3
%11 = getelementptr inbounds i16, i16* %10, i64 1
store i16* %11, i16** %3
br label %5
12: ; preds = %5
%13 = load i16*, i16** %3
%14 = load i16*, i16** %2
%15 = ptrtoint i16* %13 to i64
%16 = ptrtoint i16* %14 to i64
%17 = sub i64 %15, %16
%18 = sdiv exact i64 %17, 2
%19 = trunc i64 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @arikkei_ucs2_strlen(i16* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i16* [ %0, %1 ], [ %6, %2 ]
%4 = load i16, i16* %3
%5 = icmp eq i16 %4, 0
%6 = getelementptr inbounds i16, i16* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i16* %3 to i64
%9 = ptrtoint i16* %0 to i64
%10 = sub i64 %8, %9
%11 = lshr exact i64 %10, 1
%12 = trunc i64 %11 to i32
ret i32 %12
}
int v_lanes32(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @v_lanes32() {
ret i32 1
}

LLVM IR (-O2):
define i32 @v_lanes32() {
ret i32 1
}
int int_cmp_fun(const void *v1, const void *v2) {
  const int *i1 = v1;
  const int *i2 = v2;
  int result;
  if (*i1 == *i2) {
    result = 0;
  } else if (*i1 < *i2) {
    result = -1;
  } else {
    result = 1;
  }
  return result;
}


x86 assembly (clang, -O0):
<int_cmp_fun>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jne    113a <int_cmp_fun+0x3a>
movl   $0x0,-0x24(%rbp)
jmp    1164 <int_cmp_fun+0x64>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    1158 <int_cmp_fun+0x58>
movl   $0xffffffff,-0x24(%rbp)
jmp    115f <int_cmp_fun+0x5f>
movl   $0x1,-0x24(%rbp)
jmp    1164 <int_cmp_fun+0x64>
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_cmp_fun>:
mov    (%rdi),%eax
xor    %ecx,%ecx
xor    %edx,%edx
cmp    (%rsi),%eax
setge  %dl
lea    -0x1(%rdx,%rdx,1),%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @int_cmp_fun(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp eq i32 %5, %6
%8 = icmp slt i32 %5, %6
%9 = select i1 %8, i32 -1, i32 1
%10 = select i1 %7, i32 0, i32 %9
ret i32 %10
}
/* Type definitions */
struct vm {
  int dummy;
};
struct op {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ addr_inc(struct vm *);
void op_inc_addr(struct vm *vm, const struct op const *op) { addr_inc(vm); }


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

x86 assembly (clang, -O2):
<op_inc_addr>:
jmp    1030 <addr_inc@plt>

LLVM IR (-O0):
%struct.vm = type { i32 }
%struct.op = type { i32 }
define void @op_inc_addr(%struct.vm* %0, %struct.op* %1) {
%3 = alloca %struct.vm*
%4 = alloca %struct.op*
store %struct.vm* %0, %struct.vm** %3
store %struct.op* %1, %struct.op** %4
%5 = load %struct.vm*, %struct.vm** %3
%6 = call i32 @addr_inc(%struct.vm* %5)
ret void
}

LLVM IR (-O2):
%struct.vm = type { i32 }
%struct.op = type { i32 }
define void @op_inc_addr(%struct.vm* %0, %struct.op* nocapture readnone %1) {
%3 = tail call i32 @addr_inc(%struct.vm* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ portctl(char, int, char *);
int aux5off() {
  int pin = 0;
  char mask = 0x40;
  portctl(mask, pin, "aux5off");
  return 0;
}


x86 assembly (clang, -O0):
<aux5off>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x40,-0x5(%rbp)
mov    -0x5(%rbp),%al
mov    -0x4(%rbp),%esi
lea    0xed0(%rip),%rdx
movsbl %al,%edi
call   1030 <portctl@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aux5off>:
push   %rax
lea    0xee8(%rip),%rdx
mov    $0x40,%edi
xor    %esi,%esi
call   1030 <portctl@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"aux5off\00"
define i32 @aux5off() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 64, i8* %2
%3 = load i8, i8* %2
%4 = load i32, i32* %1
%5 = call i32 @portctl(i8 signext %3, i32 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"aux5off\00"
define i32 @aux5off() {
%1 = tail call i32 @portctl(i8 signext 64, i32 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_p224_mul(uintptr_t, uintptr_t, uintptr_t);
void fiat_p224_mul(uint64_t out1[4], const uint64_t arg1[4],
                   const uint64_t arg2[4]) {
  internal_fiat_p224_mul((uintptr_t)out1, (uintptr_t)arg1, (uintptr_t)arg2);
}


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

x86 assembly (clang, -O2):
<fiat_p224_mul>:
jmp    1030 <internal_fiat_p224_mul@plt>

LLVM IR (-O0):
define void @fiat_p224_mul(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = load i32*, i32** %5
%10 = ptrtoint i32* %9 to i64
%11 = load i32*, i32** %6
%12 = ptrtoint i32* %11 to i64
%13 = call i32 @internal_fiat_p224_mul(i64 %8, i64 %10, i64 %12)
ret void
}

LLVM IR (-O2):
define void @fiat_p224_mul(i32* %0, i32* %1, i32* %2) {
%4 = ptrtoint i32* %0 to i64
%5 = ptrtoint i32* %1 to i64
%6 = ptrtoint i32* %2 to i64
%7 = tail call i32 @internal_fiat_p224_mul(i64 %4, i64 %5, i64 %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int vasprintf(char **, char const *, int /*<<< orphan*/);
char *vmprintf(const char *fmt, va_list ap) {
  char *s;
  int n;
  n = vasprintf(&s, fmt, ap);
  if (n < 0)
    s = NULL;
  return s;
}


x86 assembly (clang, -O0):
<vmprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    -0x18(%rbp),%rdi
call   1030 <vasprintf@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1144 <vmprintf+0x34>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vmprintf>:
push   %rax
mov    %esi,%edx
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <vasprintf@plt>
test   %eax,%eax
js     1128 <vmprintf+0x18>
mov    (%rsp),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @vmprintf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @vasprintf(i8** %3, i8* %0, i32 %1)
%6 = icmp slt i32 %5, 0
%7 = load i8*, i8** %3
%8 = select i1 %6, i8* null, i8* %7
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ wfile_goodpath(char *, char *);
void wfile_fullname(char *fullname, char *path, char *spec) {
  wfile_goodpath(fullname, path);
  strcat(fullname, spec);
}


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

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

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

LLVM IR (-O2):
define void @wfile_fullname(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @wfile_goodpath(i8* %0, i8* %1)
%5 = tail call i32 @strcat(i8* %0, i8* %2)
ret void
}
void fun3() {}


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

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

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

LLVM IR (-O2):
define void @fun3() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ says(char *const);
void message(char *const path[]) {
  says("/usr/sbin/glibc_post_upgrade: While trying to execute ");
  says(path[0]);
}


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

x86 assembly (clang, -O2):
<message>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <says@plt>
mov    (%rbx),%rdi
pop    %rbx
jmp    1030 <says@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"/usr/sbin/glibc_post_upgrade: While trying to execute \00"
define void @message(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @says(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%4 = load i8**, i8*** %2
%5 = getelementptr inbounds i8*, i8** %4, i64 0
%6 = load i8*, i8** %5
%7 = call i32 @says(i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [55 x i8] c"/usr/sbin/glibc_post_upgrade: While trying to execute \00"
define void @message(i8** nocapture %0) {
%2 = tail call i32 @says(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%3 = load i8*, i8** %0
%4 = tail call i32 @says(i8* %3)
ret void
}
/* Variables and functions */
void *mem_alloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *mem_calloc(size_t n, size_t sz) {
  void *p;
  p = mem_alloc(n * sz);
  if (p)
    memset(p, 0, n * sz);
  return p;
}


x86 assembly (clang, -O0):
<mem_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
imul   -0x10(%rbp),%rdi
call   1040 <mem_alloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1161 <mem_calloc+0x41>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
imul   -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
call   1040 <mem_alloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1148 <mem_calloc+0x28>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @mem_calloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @mem_alloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @memset(i8* %4, i32 0, i64 %3)
br label %8
8: ; preds = %6, %2
ret i8* %4
}
/* Variables and functions */
unsigned char setBit(unsigned char, int /*<<< orphan*/, int);
void xyz_to_gammaS(double x, double y, double z, double g1, double g2,
                   unsigned char T) {
  double temp = 1.0f / (1.0f + z);
  g1 = x * temp;
  g2 = y * temp;
  T = setBit(T, 0, 1);
}


x86 assembly (clang, -O0):
<xyz_to_gammaS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dil,%al
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %al,-0x29(%rbp)
movsd  0xec1(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
movsd  0xeb4(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
xor    %esi,%esi
mov    $0x1,%edx
movzbl -0x29(%rbp),%edi
call   1030 <setBit@plt>
mov    %al,-0x29(%rbp)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xyz_to_gammaS>:
xor    %esi,%esi
mov    $0x1,%edx
jmp    1030 <setBit@plt>

LLVM IR (-O0):
define void @xyz_to_gammaS(double %0, double %1, double %2, double %3, double %4, i8 zeroext %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i8
%13 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store i8 %5, i8* %12
%14 = load double, double* %9
%15 = fadd double 1.000000e+00, %14
%16 = fdiv double 1.000000e+00, %15
store double %16, double* %13
%17 = load double, double* %7
%18 = load double, double* %13
%19 = fmul double %17, %18
store double %19, double* %10
%20 = load double, double* %8
%21 = load double, double* %13
%22 = fmul double %20, %21
store double %22, double* %11
%23 = load i8, i8* %12
%24 = call zeroext i8 @setBit(i8 zeroext %23, i32 0, i32 1)
store i8 %24, i8* %12
ret void
}

LLVM IR (-O2):
define void @xyz_to_gammaS(double %0, double %1, double %2, double %3, double %4, i8 zeroext %5) {
%7 = tail call zeroext i8 @setBit(i8 zeroext %5, i32 0, i32 1)
ret void
}
unsigned __lshrhi3(unsigned int a, int b) { return a >> b; }


x86 assembly (clang, -O0):
<__lshrhi3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__lshrhi3>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
ret

LLVM IR (-O0):
define i32 @__lshrhi3(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 = lshr i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @__lshrhi3(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
ret i32 %3
}
void caller_2_2_1_1_2_1_1() {}


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

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

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

LLVM IR (-O2):
define void @caller_2_2_1_1_2_1_1() {
ret void
}
void rop3_207_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~T;
  stk1 = S | stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


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

LLVM IR (-O0):
define void @rop3_207_0_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 = xor i32 %10, -1
%12 = trunc i32 %11 to i8
store i8 %12, i8* %8
%13 = load i8, i8* %5
%14 = zext i8 %13 to i32
%15 = load i8, i8* %8
%16 = zext i8 %15 to i32
%17 = or i32 %14, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %7
%19 = load i8, i8* %7
%20 = zext i8 %19 to i32
%21 = load i8, i8* %5
%22 = zext i8 %21 to i32
%23 = and i32 %20, %22
%24 = load i8, i8* %7
%25 = zext i8 %24 to i32
%26 = load i8, i8* %6
%27 = zext i8 %26 to i32
%28 = xor i32 %27, -1
%29 = and i32 %25, %28
%30 = or i32 %23, %29
%31 = load i8, i8* %6
%32 = zext i8 %31 to i32
%33 = load i8, i8* %5
%34 = zext i8 %33 to i32
%35 = xor i32 %34, -1
%36 = and i32 %32, %35
%37 = load i8*, i8** %4
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = and i32 %36, %39
%41 = or i32 %30, %40
%42 = trunc i32 %41 to i8
%43 = load i8*, i8** %4
store i8 %42, i8* %43
ret void
}

LLVM IR (-O2):
define void @rop3_207_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = zext i8 %2 to i32
%5 = xor i32 %4, -1
%6 = zext i8 %1 to i32
%7 = trunc i32 %5 to i8
%8 = or i8 %7, %1
%9 = zext i8 %8 to i32
%10 = and i32 %9, %5
%11 = or i32 %10, %6
%12 = xor i32 %6, -1
%13 = and i32 %4, %12
%14 = load i8, i8* %0
%15 = zext i8 %14 to i32
%16 = and i32 %13, %15
%17 = or i32 %11, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct macan_key {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ macan_aes_cmac(struct macan_key *, unsigned int,
                                  int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
void macan_sign(struct macan_key *skey, uint8_t *cmac4, uint8_t *plain,
                unsigned len) {
  uint8_t cmac[16];
  macan_aes_cmac(skey, len, cmac, plain);
  memcpy(cmac4, cmac, 4);
}


x86 assembly (clang, -O0):
<macan_sign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x60(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <macan_aes_cmac@plt>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macan_sign>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%rax
mov    %rsi,%rbx
mov    %rsp,%r14
mov    %ecx,%esi
mov    %r14,%rdx
mov    %rax,%rcx
call   1030 <macan_aes_cmac@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.macan_key = type { i32 }
define void @macan_sign(%struct.macan_key* %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca %struct.macan_key*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca [16 x i32]
store %struct.macan_key* %0, %struct.macan_key** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%10 = load %struct.macan_key*, %struct.macan_key** %5
%11 = load i32, i32* %8
%12 = getelementptr inbounds [16 x i32], [16 x i32]* %9, i64 0, i64 0
%13 = load i32*, i32** %7
%14 = call i32 @macan_aes_cmac(%struct.macan_key* %10, i32 %11, i32* %12, i32* %13)
%15 = load i32*, i32** %6
%16 = getelementptr inbounds [16 x i32], [16 x i32]* %9, i64 0, i64 0
%17 = call i32 @memcpy(i32* %15, i32* %16, i32 4)
ret void
}

LLVM IR (-O2):
%struct.macan_key = type { i32 }
define void @macan_sign(%struct.macan_key* %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca [16 x i32]
%6 = bitcast [16 x i32]* %5 to i8*
%7 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 0
%8 = call i32 @macan_aes_cmac(%struct.macan_key* %0, i32 %3, i32* %7, i32* %2)
%9 = call i32 @memcpy(i32* %1, i32* %7, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ append_user_flags(char *, unsigned short);
int /*<<< orphan*/ net_send(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
void irc_user_set(char *user, unsigned short int flags) {
  char msg[(512 - 3)];
  snprintf(msg, (512 - 3), "%s %s +", "MODE", user);
  append_user_flags(msg, flags);
  net_send(msg);
}


x86 assembly (clang, -O0):
<irc_user_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%r8
mov    $0x1fd,%esi
lea    0xea3(%rip),%rdx
lea    0xea4(%rip),%rcx
call   1030 <snprintf@plt>
lea    -0x210(%rbp),%rdi
movzwl -0xa(%rbp),%esi
call   1050 <append_user_flags@plt>
lea    -0x210(%rbp),%rdi
call   1040 <net_send@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_user_set>:
push   %rbp
push   %rbx
sub    $0x208,%rsp
mov    %esi,%ebp
mov    %rdi,%r8
lea    0xebb(%rip),%rdx
lea    0xebc(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1fd,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <append_user_flags@plt>
mov    %rbx,%rdi
call   1040 <net_send@plt>
add    $0x208,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s %s +\00"
@.str.1 = [5 x i8] c"MODE\00"
define void @irc_user_set(i8* %0, i16 zeroext %1) {
%3 = alloca i8*
%4 = alloca i16
%5 = alloca [509 x i8]
store i8* %0, i8** %3
store i16 %1, i16* %4
%6 = getelementptr inbounds [509 x i8], [509 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = call i32 @snprintf(i8* %6, i32 509, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [509 x i8], [509 x i8]* %5, i64 0, i64 0
%10 = load i16, i16* %4
%11 = call i32 @append_user_flags(i8* %9, i16 zeroext %10)
%12 = getelementptr inbounds [509 x i8], [509 x i8]* %5, i64 0, i64 0
%13 = call i32 @net_send(i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s %s +\00"
@.str.1 = [5 x i8] c"MODE\00"
define void @irc_user_set(i8* %0, i16 zeroext %1) {
%3 = alloca [509 x i8]
%4 = getelementptr inbounds [509 x i8], [509 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 509, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = call i32 @append_user_flags(i8* %4, i16 zeroext %1)
%7 = call i32 @net_send(i8* %4)
ret void
}
/* Type definitions */
struct impl {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct impl *);
void destroy(void *impl) { free((struct impl *)impl); }


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

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

LLVM IR (-O0):
%struct.impl = type { i32 }
define void @destroy(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.impl*
%5 = call i32 @free(%struct.impl* %4)
ret void
}

LLVM IR (-O2):
%struct.impl = type { i32 }
define void @destroy(i8* nocapture %0) {
%2 = bitcast i8* %0 to %struct.impl*
%3 = tail call i32 @free(%struct.impl* %2)
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int irqn;

/* Variables and functions */
void nvic_enable_irq(int irqn) {
  *((volatile uint32_t *)(((0xe000e100) + (((irqn) >> 5)) * 4))) =
      ((1 << ((irqn)&0x1f)));
}


x86 assembly (clang, -O0):
<nvic_enable_irq>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
sar    $0x5,%eax
shl    $0x2,%eax
add    $0xe000e100,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvic_enable_irq>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
sar    $0x3,%ecx
add    $0xe000e100,%ecx
and    $0xfffffffc,%ecx
mov    %eax,(%rcx)
ret

LLVM IR (-O0):
define void @nvic_enable_irq(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 31
%5 = shl i32 1, %4
%6 = load i32, i32* %2
%7 = ashr i32 %6, 5
%8 = mul nsw i32 %7, 4
%9 = add i32 -536813312, %8
%10 = zext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
store volatile i32 %5, i32* %11
ret void
}

LLVM IR (-O2):
define void @nvic_enable_irq(i32 %0) {
%2 = and i32 %0, 31
%3 = shl nuw i32 1, %2
%4 = ashr i32 %0, 3
%5 = add nsw i32 %4, -536813312
%6 = and i32 %5, -4
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store volatile i32 %3, i32* %8
ret void
}
/* Variables and functions */
int char_to_r40(char);
int r40_valid_str(char *str, int allow_lowercase) {
  while (*str) {
    if (char_to_r40(*str) == -1) {
      return 0;
    }
    str++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<r40_valid_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115e <r40_valid_str+0x4e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <char_to_r40@plt>
cmp    $0xffffffff,%eax
jne    114d <r40_valid_str+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1165 <r40_valid_str+0x55>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111f <r40_valid_str+0xf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r40_valid_str>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114c <r40_valid_str+0x3c>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <char_to_r40@plt>
cmp    $0xffffffff,%eax
je     114a <r40_valid_str+0x3a>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <r40_valid_str+0x20>
jmp    114c <r40_valid_str+0x3c>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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

/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int _chown(const char *path, uid_t owner, gid_t group) {
  _exit(-1);
  return -1;
}


x86 assembly (clang, -O0):
<_chown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<_chown>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @_chown(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 @_exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define i32 @_chown(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = tail call i32 @_exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int n;
  int i = 50;
  n = (i ^ 2 + (i + 1) ^ 2) / (i + 2);
  printf("%d", n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x32,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
add    $0x2,%ecx
xor    %ecx,%eax
xor    $0x2,%eax
mov    -0x8(%rbp),%ecx
add    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 50, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
%6 = add nsw i32 2, %5
%7 = xor i32 %3, %6
%8 = xor i32 %7, 2
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 2
%11 = sdiv i32 %8, %10
store i32 %11, i32* %1
%12 = load i32, i32* %1
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}

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