xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int u_int32_t;

/* Variables and functions */
u_int32_t Long_Little2Big(u_int32_t var) {
  unsigned char *ptmp;
  ptmp = (unsigned char *)&var;
  return (((u_int32_t)ptmp[3] << 24) + ((u_int32_t)ptmp[2] << 16) +
          ((u_int32_t)ptmp[1] << 8) + (u_int32_t)ptmp[0]);
}


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

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

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

LLVM IR (-O2):
define i32 @Long_Little2Big(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ convertToUnibyteStringAndReplaceLastChar(unsigned short *,
                                                            unsigned char *,
                                                            unsigned int const,
                                                            unsigned char);
void LOGI_S16_PLUS(unsigned short *string, const unsigned int length,
                   unsigned char c) {
  unsigned char tmp_buffer[length + 1];
  convertToUnibyteStringAndReplaceLastChar(string, tmp_buffer, length, c);
  ;
}


x86 assembly (clang, -O0):
<LOGI_S16_PLUS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
movzbl -0xd(%rbp),%ecx
call   1030 <convertToUnibyteStringAndReplaceLastChar@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LOGI_S16_PLUS>:
push   %rbp
mov    %rsp,%rbp
mov    %edx,%ecx
mov    %esi,%edx
lea    0x1(%rdx),%eax
mov    %rsp,%rsi
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rsi
mov    %rsi,%rsp
call   1030 <convertToUnibyteStringAndReplaceLastChar@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
define void @LOGI_S16_PLUS(i16* %0, i32 %1, i8 zeroext %2) {
%4 = alloca i16*
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i64
store i16* %0, i16** %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%9 = load i32, i32* %5
%10 = add i32 %9, 1
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %7
%13 = alloca i8, i64 %11
store i64 %11, i64* %8
%14 = load i16*, i16** %4
%15 = load i32, i32* %5
%16 = load i8, i8* %6
%17 = call i32 @convertToUnibyteStringAndReplaceLastChar(i16* %14, i8* %13, i32 %15, i8 zeroext %16)
%18 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
define void @LOGI_S16_PLUS(i16* %0, i32 %1, i8 zeroext %2) {
%4 = add i32 %1, 1
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = call i32 @convertToUnibyteStringAndReplaceLastChar(i16* %0, i8* %6, i32 %1, i8 zeroext %2)
ret void
}
char *alloc(u)
unsigned u;
{
  char *malloc();
  register char *p = malloc(u);
  if (p == 0)
    panic("no space\n");
  return p;
}


x86 assembly (clang, -O0):
<alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1152 <alloc+0x32>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <panic@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc>:
push   %rbx
xor    %eax,%eax
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113e <alloc+0x1e>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <panic@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"no space\0A\00"
define i8* @alloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* (i32, ...) bitcast (i8* (...)* @malloc to i8* (i32, ...)*)(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @panic to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [10 x i8] c"no space\0A\00"
define i8* @alloc(i32 %0) {
%2 = tail call i8* (i32, ...) bitcast (i8* (...)* @malloc to i8* (i32, ...)*)(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @panic to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
long fibonacci(long n) {
  if (n == 0 || n == 1)
    return n;
  return fibonacci(n - 1) + fibonacci(n - 2);
}


x86 assembly (clang, -O0):
<fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1132 <fibonacci+0x22>
cmpq   $0x1,-0x10(%rbp)
jne    113f <fibonacci+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116b <fibonacci+0x5b>
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <fibonacci@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x2,%rdi
call   1030 <fibonacci@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @fibonacci(i64 %0) {
%2 = icmp ult i64 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ %0, %1 ]
%5 = phi i64 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i64 %4, -1
%7 = tail call i64 @fibonacci(i64 %6)
%8 = add nsw i64 %4, -2
%9 = add nsw i64 %7, %5
%10 = icmp ult i64 %8, 2
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i64 [ 0, %1 ], [ %9, %3 ]
%13 = phi i64 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i64 %13, %12
ret i64 %14
}
int constrain(int x, int a, int b) {
  if (x < a)
    return a;
  if (b < x)
    return b;
  return x;
}


x86 assembly (clang, -O0):
<constrain>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1124 <constrain+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <constrain+0x41>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    113b <constrain+0x3b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <constrain+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<constrain>:
mov    %edx,%eax
cmp    %edi,%edx
cmovge %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @constrain(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp slt i32 %2, %0
%6 = select i1 %5, i32 %2, i32 %0
%7 = select i1 %4, i32 %1, i32 %6
ret i32 %7
}
/* Variables and functions */
int lib2fun();
int lib3fun();
int __attribute__((visibility("default"))) libfun() {
  return lib2fun() + lib3fun();
}


x86 assembly (clang, -O0):
<libfun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <lib2fun@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <lib3fun@plt>
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libfun>:
push   %rbx
xor    %eax,%eax
call   1040 <lib2fun@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <lib3fun@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @libfun() {
%1 = call i32 (...) @lib2fun()
%2 = call i32 (...) @lib3fun()
%3 = add nsw i32 %1, %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @libfun() {
%1 = tail call i32 (...) @lib2fun()
%2 = tail call i32 (...) @lib3fun()
%3 = add nsw i32 %2, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_arr(int *arr, int n) {
  int i;
  for (i = 0; i < n; ++i)
    printf("%d ", arr[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_arr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print_arr+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_arr+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_arr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print_arr+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_arr+0x20>
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 @print_arr(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = 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 @print_arr(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
unsigned long rgb(unsigned char r, unsigned char g, unsigned char b) {
  return b | g << 8 | r << 16;
}


x86 assembly (clang, -O0):
<rgb>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
movzbl -0x2(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x1(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgb>:
mov    %edx,%eax
mov    %esi,%ecx
shl    $0x8,%rcx
or     %rax,%rcx
mov    %edi,%eax
shl    $0x10,%rax
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @rgb(i8 zeroext %0, i8 zeroext %1, i8 zeroext %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* %6
%8 = zext i8 %7 to i32
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = or i32 %8, %11
%13 = load i8, i8* %4
%14 = zext i8 %13 to i32
%15 = shl i32 %14, 16
%16 = or i32 %12, %15
%17 = sext i32 %16 to i64
ret i64 %17
}

LLVM IR (-O2):
define i64 @rgb(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = zext i8 %2 to i64
%5 = zext i8 %1 to i64
%6 = shl nuw nsw i64 %5, 8
%7 = or i64 %6, %4
%8 = zext i8 %0 to i64
%9 = shl nuw nsw i64 %8, 16
%10 = or i64 %7, %9
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int open(const char *pathname, int flags) {
  _exit(-1);
  return -1;
}


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

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

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

LLVM IR (-O2):
define i32 @open(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @_exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ ft_putstrn(char *, int /*<<< orphan*/);
int /*<<< orphan*/ ft_strclen(char *, int);
void ft_putcstr(char *str, int c) { ft_putstrn(str, ft_strclen(str, c)); }


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

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

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

LLVM IR (-O2):
define void @ft_putcstr(i8* %0, i32 %1) {
%3 = tail call i32 @ft_strclen(i8* %0, i32 %1)
%4 = tail call i32 @ft_putstrn(i8* %0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void(tlsfPutMem)(void *ptr) { free(ptr); }


x86 assembly (clang, -O0):
<tlsfPutMem>:
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):
<tlsfPutMem>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @tlsfPutMem(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
struct csvparse {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct csvparse *);
void csvparse_delete(struct csvparse *ctx) { free(ctx); }


x86 assembly (clang, -O0):
<csvparse_delete>:
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):
<csvparse_delete>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.csvparse = type { i32 }
define void @csvparse_delete(%struct.csvparse* %0) {
%2 = alloca %struct.csvparse*
store %struct.csvparse* %0, %struct.csvparse** %2
%3 = load %struct.csvparse*, %struct.csvparse** %2
%4 = call i32 @free(%struct.csvparse* %3)
ret void
}

LLVM IR (-O2):
%struct.csvparse = type { i32 }
define void @csvparse_delete(%struct.csvparse* nocapture %0) {
%2 = tail call i32 @free(%struct.csvparse* %0)
ret void
}
/* Variables and functions */
int processInput(char *);
int /*<<< orphan*/ sub(char *, int, int, int);
int /*<<< orphan*/ trans(char *, int);
int cipher(char *text, int lkey, int nkey) {
  int textLength = processInput(text);
  sub(text, lkey, nkey, textLength);
  trans(text, textLength);
  return textLength;
}


x86 assembly (clang, -O0):
<cipher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <processInput@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1050 <sub@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <trans@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cipher>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%rbx
call   1040 <processInput@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %eax,%ecx
call   1050 <sub@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <trans@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cipher(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i32 @processInput(i8* %8)
store i32 %9, i32* %7
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = call i32 @sub(i8* %10, i32 %11, i32 %12, i32 %13)
%15 = load i8*, i8** %4
%16 = load i32, i32* %7
%17 = call i32 @trans(i8* %15, i32 %16)
%18 = load i32, i32* %7
ret i32 %18
}

LLVM IR (-O2):
define i32 @cipher(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @processInput(i8* %0)
%5 = tail call i32 @sub(i8* %0, i32 %1, i32 %2, i32 %4)
%6 = tail call i32 @trans(i8* %0, i32 %4)
ret i32 %4
}
/* Variables and functions */
int yyparse();
int main(void) { return (yyparse()); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @yyparse()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ malloc(unsigned long);
int /*<<< orphan*/ print_error(char *);
void alloc_string(char **dest, unsigned long size) {
  *dest = (char *)malloc(size);
  if (*dest == NULL) {
    print_error("alloc_string: Out of memory for malloc");
    exit((1));
  }
}


x86 assembly (clang, -O0):
<alloc_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1177 <alloc_string+0x47>
lea    0xe98(%rip),%rdi
call   1030 <print_error@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_string>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <malloc@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     1146 <alloc_string+0x16>
pop    %rbx
ret
lea    0xeb3(%rip),%rdi
call   1030 <print_error@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"alloc_string: Out of memory for malloc\00"
define void @alloc_string(i8** %0, i64 %1) {
%3 = alloca i8**
%4 = alloca i64
store i8** %0, i8*** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = call i64 @malloc(i64 %5)
%7 = inttoptr i64 %6 to i8*
%8 = load i8**, i8*** %3
store i8* %7, i8** %8
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @print_error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"alloc_string: Out of memory for malloc\00"
define void @alloc_string(i8** nocapture writeonly %0, i64 %1) {
%3 = tail call i64 @malloc(i64 %1)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %0
%5 = icmp eq i64 %3, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @print_error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
ret void
}
int test_fun(int x, int y) {
  if (x <= 0) {
    return y;
  }
  while (x > y) {
    if (x <= 0) {
      return y;
    }
    y = y + x;
  }
  return y;
}


x86 assembly (clang, -O0):
<test_fun>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     111f <test_fun+0x1f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <test_fun+0x59>
jmp    1124 <test_fun+0x24>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1153 <test_fun+0x53>
cmpl   $0x0,-0x8(%rbp)
jg     1145 <test_fun+0x45>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <test_fun+0x59>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <test_fun+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fun>:
mov    %esi,%eax
test   %edi,%edi
jle    1116 <test_fun+0x16>
sub    %edi,%eax
nopl   0x0(%rax,%rax,1)
add    %edi,%eax
cmp    %edi,%eax
jl     1110 <test_fun+0x10>
ret

LLVM IR (-O0):
define i32 @test_fun(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 = icmp sle i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %5
store i32 %9, i32* %3
br label %26
10: ; preds = %2
br label %11
11: ; preds = %20, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = load i32, i32* %4
%17 = icmp sle i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = load i32, i32* %5
store i32 %19, i32* %3
br label %26
20: ; preds = %15
%21 = load i32, i32* %5
%22 = load i32, i32* %4
%23 = add nsw i32 %21, %22
store i32 %23, i32* %5
br label %11
24: ; preds = %11
%25 = load i32, i32* %5
store i32 %25, i32* %3
br label %26
26: ; preds = %24, %18, %8
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @test_fun(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = icmp slt i32 %5, %0
%7 = add nsw i32 %5, %0
br i1 %6, label %4, label %8
8: ; preds = %4, %2
%9 = phi i32 [ %1, %2 ], [ %5, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main(void) {
  char c = 'm';
  printf("c"
         " is [%c]\n",
         c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x6d,-0x5(%rbp)
lea    0xed6(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"c is [%c]\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8 signext 109)
ret i32 0
}
/* Variables and functions */
int rand();
int roll_die(int number) { return (rand() % number + 1); }


x86 assembly (clang, -O0):
<roll_die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roll_die>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
lea    0x1(%rdx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @roll_die(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
%6 = add nsw i32 %5, 1
ret i32 %6
}

LLVM IR (-O2):
define i32 @roll_die(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
%4 = add nsw i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ R_AddEntitySurfaces();
int /*<<< orphan*/ R_AddPolygonSurfaces();
int /*<<< orphan*/ R_AddWorldSurfaces();
int /*<<< orphan*/ R_SetupProjection();
void R_GenerateDrawSurfs(void) {
  R_AddWorldSurfaces();
  R_AddPolygonSurfaces();
  R_SetupProjection();
  R_AddEntitySurfaces();
}


x86 assembly (clang, -O0):
<R_GenerateDrawSurfs>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <R_AddWorldSurfaces@plt>
mov    $0x0,%al
call   1050 <R_AddPolygonSurfaces@plt>
mov    $0x0,%al
call   1060 <R_SetupProjection@plt>
mov    $0x0,%al
call   1040 <R_AddEntitySurfaces@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<R_GenerateDrawSurfs>:
push   %rax
xor    %eax,%eax
call   1030 <R_AddWorldSurfaces@plt>
xor    %eax,%eax
call   1050 <R_AddPolygonSurfaces@plt>
xor    %eax,%eax
call   1060 <R_SetupProjection@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <R_AddEntitySurfaces@plt>

LLVM IR (-O0):
define void @R_GenerateDrawSurfs() {
%1 = call i32 (...) @R_AddWorldSurfaces()
%2 = call i32 (...) @R_AddPolygonSurfaces()
%3 = call i32 (...) @R_SetupProjection()
%4 = call i32 (...) @R_AddEntitySurfaces()
ret void
}

LLVM IR (-O2):
define void @R_GenerateDrawSurfs() {
%1 = tail call i32 (...) @R_AddWorldSurfaces()
%2 = tail call i32 (...) @R_AddPolygonSurfaces()
%3 = tail call i32 (...) @R_SetupProjection()
%4 = tail call i32 (...) @R_AddEntitySurfaces()
ret void
}
/* Variables and functions */
int errno;
int yesno(char const *);
bool noyes(const char *value) {
  int serrno = errno;
  bool retval;
  errno = 0;
  retval = yesno(value);
  if (errno == 0) {
    retval = !retval;
    errno = serrno;
  }
  return retval;
}


x86 assembly (clang, -O0):
<noyes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2eb1(%rip),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <yesno@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e98(%rip),%rax
cmpl   $0x0,(%rax)
jne    116e <noyes+0x5e>
cmpl   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
mov    0x2e74(%rip),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noyes>:
push   %rbp
push   %rbx
push   %rax
mov    0x2ec6(%rip),%rbx
mov    (%rbx),%ebp
movl   $0x0,(%rbx)
call   1030 <yesno@plt>
cmpl   $0x0,(%rbx)
jne    1137 <noyes+0x27>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ebp,(%rbx)
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @noyes(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i32, i32* @errno
store i32 %5, i32* %3
store i32 0, i32* @errno
%6 = load i8*, i8** %2
%7 = call i32 @yesno(i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* @errno
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %1
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
store i32 %14, i32* %4
%15 = load i32, i32* %3
store i32 %15, i32* @errno
br label %16
16: ; preds = %10, %1
%17 = load i32, i32* %4
ret i32 %17
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @noyes(i8* %0) {
%2 = load i32, i32* @errno
store i32 0, i32* @errno
%3 = tail call i32 @yesno(i8* %0)
%4 = load i32, i32* @errno
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = icmp eq i32 %3, 0
%8 = zext i1 %7 to i32
store i32 %2, i32* @errno
br label %9
9: ; preds = %6, %1
%10 = phi i32 [ %8, %6 ], [ %3, %1 ]
ret i32 %10
}
char *stripdir(s)
char *s;
{
  char *cp = strrchr(s, '/');
  return (cp != 0) ? cp + 1 : s;
}


x86 assembly (clang, -O0):
<stripdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114a <stripdir+0x3a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1152 <stripdir+0x42>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripdir>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @stripdir(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i32 47)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
br label %13
11: ; preds = %1
%12 = load i8*, i8** %2
br label %13
13: ; preds = %11, %8
%14 = phi i8* [ %10, %8 ], [ %12, %11 ]
ret i8* %14
}

LLVM IR (-O2):
define i8* @stripdir(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i32 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
__attribute((cdecl)) int attributed(int a, int b, int c, int d, int e, int f,
                                    int g) {
  return a + b + c + d + e + f + g;
}


x86 assembly (clang, -O0):
<attributed>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<attributed>:
lea    (%rdi,%rsi,1),%eax
add    %edx,%eax
add    %ecx,%eax
add    %r8d,%eax
add    %r9d,%eax
add    0x8(%rsp),%eax
ret

LLVM IR (-O0):
define i32 @attributed(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%15 = load i32, i32* %8
%16 = load i32, i32* %9
%17 = add nsw i32 %15, %16
%18 = load i32, i32* %10
%19 = add nsw i32 %17, %18
%20 = load i32, i32* %11
%21 = add nsw i32 %19, %20
%22 = load i32, i32* %12
%23 = add nsw i32 %21, %22
%24 = load i32, i32* %13
%25 = add nsw i32 %23, %24
%26 = load i32, i32* %14
%27 = add nsw i32 %25, %26
ret i32 %27
}

LLVM IR (-O2):
define i32 @attributed(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = add nsw i32 %1, %0
%9 = add nsw i32 %8, %2
%10 = add nsw i32 %9, %3
%11 = add nsw i32 %10, %4
%12 = add nsw i32 %11, %5
%13 = add nsw i32 %12, %6
ret i32 %13
}
int sl_constrain(int a, int _max, int _min) {
  a = a > _max ? _max : a;
  a = a < _min ? _min : a;
  return a;
}


x86 assembly (clang, -O0):
<sl_constrain>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1124 <sl_constrain+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    112a <sl_constrain+0x2a>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1147 <sl_constrain+0x47>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    114d <sl_constrain+0x4d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sl_constrain>:
mov    %edi,%eax
cmp    %esi,%edi
cmovg  %esi,%eax
cmp    %edx,%eax
cmovl  %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @sl_constrain(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %1
%5 = select i1 %4, i32 %1, i32 %0
%6 = icmp slt i32 %5, %2
%7 = select i1 %6, i32 %2, i32 %5
ret i32 %7
}
/* Type definitions */
struct sigaction {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ setup_signals(struct sigaction *, int);
int /*<<< orphan*/ usleep(int);
void setup_client_signals(struct sigaction *signal_action) {
  setup_signals(signal_action, 0x0 | 0x2);
  usleep(1000);
}


x86 assembly (clang, -O0):
<setup_client_signals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1030 <setup_signals@plt>
mov    $0x3e8,%edi
call   1040 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_client_signals>:
push   %rax
mov    $0x2,%esi
call   1030 <setup_signals@plt>
mov    $0x3e8,%edi
pop    %rax
jmp    1040 <usleep@plt>

LLVM IR (-O0):
%struct.sigaction = type { i32 }
define void @setup_client_signals(%struct.sigaction* %0) {
%2 = alloca %struct.sigaction*
store %struct.sigaction* %0, %struct.sigaction** %2
%3 = load %struct.sigaction*, %struct.sigaction** %2
%4 = call i32 @setup_signals(%struct.sigaction* %3, i32 2)
%5 = call i32 @usleep(i32 1000)
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { i32 }
define void @setup_client_signals(%struct.sigaction* %0) {
%2 = tail call i32 @setup_signals(%struct.sigaction* %0, i32 2)
%3 = tail call i32 @usleep(i32 1000)
ret void
}
/* Type definitions */
struct hostent {
  int dummy;
};

/* Variables and functions */
struct hostent *DnsNameResolve(char const *);
struct hostent *gethostbyname(const char *name) {
  struct hostent *result;
  result = DnsNameResolve(name);
  return result;
}


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

x86 assembly (clang, -O2):
<gethostbyname>:
jmp    1030 <DnsNameResolve@plt>

LLVM IR (-O0):
%struct.hostent = type { i32 }
define %struct.hostent* @gethostbyname(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.hostent*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call %struct.hostent* @DnsNameResolve(i8* %4)
store %struct.hostent* %5, %struct.hostent** %3
%6 = load %struct.hostent*, %struct.hostent** %3
ret %struct.hostent* %6
}

LLVM IR (-O2):
%struct.hostent = type { i32 }
define %struct.hostent* @gethostbyname(i8* %0) {
%2 = tail call %struct.hostent* @DnsNameResolve(i8* %0)
ret %struct.hostent* %2
}
int __attribute__((always_)) pthread_setname_np(const char *name) {
  (void)name;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @pthread_setname_np(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ GLimp_EndFrame();
void SWimp_EndFrame(void) { GLimp_EndFrame(); }


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

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

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

LLVM IR (-O2):
define void @SWimp_EndFrame() {
%1 = tail call i32 (...) @GLimp_EndFrame()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assume_equality(void *);
void *unknown_func();
void *f() {
  void *res;
  res = unknown_func();
  assume_equality(res);
  return res;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <unknown_func@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assume_equality@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
xor    %eax,%eax
call   1030 <unknown_func@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <assume_equality@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @f() {
%1 = alloca i8*
%2 = call i8* (...) @unknown_func()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @assume_equality(i8* %3)
%5 = load i8*, i8** %1
ret i8* %5
}

LLVM IR (-O2):
define i8* @f() {
%1 = tail call i8* (...) @unknown_func()
%2 = tail call i32 @assume_equality(i8* %1)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void fild_preg32_qword(int reg32) {
  put8(0xDF);
  put8(0x28 + reg32);
}


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

x86 assembly (clang, -O2):
<fild_preg32_qword>:
push   %rbx
mov    %edi,%ebx
mov    $0xdf,%edi
call   1030 <put8@plt>
add    $0x28,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @fild_preg32_qword(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @put8(i32 223)
%4 = load i32, i32* %2
%5 = add nsw i32 40, %4
%6 = call i32 @put8(i32 %5)
ret void
}

LLVM IR (-O2):
define void @fild_preg32_qword(i32 %0) {
%2 = tail call i32 @put8(i32 223)
%3 = add nsw i32 %0, 40
%4 = tail call i32 @put8(i32 %3)
ret void
}
char *strcpy(char *destination, const char *source) {
  char *ret = destination;
  while (*destination++ = *source++)
    ;
  return ret;
}


x86 assembly (clang, -O0):
<strcpy>:
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,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
/* Variables and functions */
int gcd(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int x, y;
  scanf("%d %d", &x, &y);
  printf("%d\n", gcd(x, y));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <gcd@plt>
mov    %eax,%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1050 <gcd@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @gcd(i32 %6, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}
void sandbox_fini() {}


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

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

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

LLVM IR (-O2):
define void @sandbox_fini() {
ret void
}
void signed_char_rem_unsigned_char(signed char *LHS, unsigned char RHS) {
  (*LHS) %= RHS;
}


x86 assembly (clang, -O0):
<signed_char_rem_unsigned_char>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movsbl (%rax),%eax
cltd
idiv   %ecx
mov    -0x18(%rbp),%rax
mov    %dl,%cl
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<signed_char_rem_unsigned_char>:
movsbl (%rdi),%eax
cwtd
idiv   %si
mov    %dl,(%rdi)
ret

LLVM IR (-O0):
define void @signed_char_rem_unsigned_char(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = srem i32 %9, %6
%11 = trunc i32 %10 to i8
store i8 %11, i8* %7
ret void
}

LLVM IR (-O2):
define void @signed_char_rem_unsigned_char(i8* nocapture %0, i8 zeroext %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i16
%5 = zext i8 %1 to i16
%6 = srem i16 %4, %5
%7 = trunc i16 %6 to i8
store i8 %7, i8* %0
ret void
}
/* Variables and functions */
int rand();
int iran_(int *arg) {
  return (rand());
  return (0);
}


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

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

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

LLVM IR (-O2):
define i32 @iran_(i32* nocapture readnone %0) {
%2 = tail call i32 (...) @rand()
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ flusho();
int /*<<< orphan*/ tbreak();
casefl() {
  tbreak();
  flusho();
}


x86 assembly (clang, -O0):
<casefl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <tbreak@plt>
mov    $0x0,%al
call   1040 <flusho@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<casefl>:
push   %rax
xor    %eax,%eax
call   1030 <tbreak@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <flusho@plt>

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

LLVM IR (-O2):
define i32 @casefl() {
%1 = tail call i32 (...) @tbreak()
%2 = tail call i32 (...) @flusho()
ret i32 undef
}