xunge/DecIR huggingface dataset:
int atoi(char *s) {
  int n;
  n = 0;
  while (*s >= '0' && *s <= '9')
    n = 10 * n + (*s++ - '0');
  return n;
}


x86 assembly (clang, -O0):
<atoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0xd(%rbp)
jl     1134 <atoi+0x34>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1144 <atoi+0x44>
jmp    1167 <atoi+0x67>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <atoi+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoi>:
mov    (%rdi),%cl
lea    -0x30(%rcx),%edx
xor    %eax,%eax
cmp    $0x9,%dl
ja     113b <atoi+0x3b>
add    $0x1,%rdi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
lea    -0x30(%rcx),%edx
add    $0x1,%rdi
cmp    $0xa,%dl
jb     1120 <atoi+0x20>
ret

LLVM IR (-O0):
define i32 @atoi(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 sge i32 %7, 48
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp sle i32 %12, 57
br label %14
14: ; preds = %9, %4
%15 = phi i1 [ false, %4 ], [ %13, %9 ]
br i1 %15, label %16, label %25
16: ; preds = %14
%17 = load i32, i32* %3
%18 = mul nsw i32 10, %17
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %2
%21 = load i8, i8* %19
%22 = sext i8 %21 to i32
%23 = sub nsw i32 %22, 48
%24 = add nsw i32 %18, %23
store i32 %24, i32* %3
br label %4
25: ; preds = %14
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @atoi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -48
%4 = icmp ult i8 %3, 10
br i1 %4, label %5, label %17
5: ; preds = %1, %5
%6 = phi i8 [ %14, %5 ], [ %2, %1 ]
%7 = phi i32 [ %13, %5 ], [ 0, %1 ]
%8 = phi i8* [ %11, %5 ], [ %0, %1 ]
%9 = zext i8 %6 to i32
%10 = mul nsw i32 %7, 10
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = add i32 %10, -48
%13 = add i32 %12, %9
%14 = load i8, i8* %11
%15 = add i8 %14, -48
%16 = icmp ult i8 %15, 10
br i1 %16, label %5, label %17
17: ; preds = %5, %1
%18 = phi i32 [ 0, %1 ], [ %13, %5 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ glutPostRedisplay();
void animate(void) { glutPostRedisplay(); }


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

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

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

LLVM IR (-O2):
define void @animate() {
%1 = tail call i32 (...) @glutPostRedisplay()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bsPutUInt32(unsigned int);
void bsPutInt32(int c) { bsPutUInt32((unsigned int)c); }


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

x86 assembly (clang, -O2):
<bsPutInt32>:
jmp    1030 <bsPutUInt32@plt>

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

LLVM IR (-O2):
define void @bsPutInt32(i32 %0) {
%2 = tail call i32 @bsPutUInt32(i32 %0)
ret void
}
int n_dig(int n) {
  int aux, cont = 0;
  while (n > 0) {
    n = n / 10;
    cont++;
  }
  return cont;
}


x86 assembly (clang, -O0):
<n_dig>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1134 <n_dig+0x34>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <n_dig+0xe>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<n_dig>:
xor    %eax,%eax
test   %edi,%edi
jle    1124 <n_dig+0x24>
mov    $0xcccccccd,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x9,%edi
mov    %edx,%edi
ja     1110 <n_dig+0x10>
ret

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

LLVM IR (-O2):
define i32 @n_dig(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = udiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 10
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
void change(char *a, char *b) {
  if (*a > *b) {
    *a = *a ^ *b;
    *b = *a ^ *b;
    *a = *a ^ *b;
  }
}


x86 assembly (clang, -O0):
<change>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jle    116a <change+0x6a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<change>:
mov    (%rdi),%cl
mov    (%rsi),%al
cmp    %al,%cl
jle    1112 <change+0x12>
xor    %cl,%al
mov    %al,(%rdi)
xor    (%rsi),%al
mov    %al,(%rsi)
xor    %al,(%rdi)
ret

LLVM IR (-O0):
define void @change(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp sgt i32 %7, %10
br i1 %11, label %12, label %40
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = xor i32 %15, %18
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %3
store i8 %20, i8* %21
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = load i8*, i8** %4
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = xor i32 %24, %27
%29 = trunc i32 %28 to i8
%30 = load i8*, i8** %4
store i8 %29, i8* %30
%31 = load i8*, i8** %3
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = load i8*, i8** %4
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = xor i32 %33, %36
%38 = trunc i32 %37 to i8
%39 = load i8*, i8** %3
store i8 %38, i8* %39
br label %40
40: ; preds = %12, %2
ret void
}

LLVM IR (-O2):
define void @change(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp sgt i8 %3, %4
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = xor i8 %4, %3
store i8 %7, i8* %0
%8 = load i8, i8* %1
%9 = xor i8 %8, %7
store i8 %9, i8* %1
%10 = load i8, i8* %0
%11 = xor i8 %10, %9
store i8 %11, i8* %0
br label %12
12: ; preds = %6, %2
ret void
}
/* Type definitions */
struct printf_info {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fprintf(int /*<<< orphan*/ *, char *, char *);
int handle_printf_atsign(FILE *stream, const struct printf_info *info,
                         const void *const *args) {
  const void *ptr = *args;
  char *string_object;
  int len;
  string_object = *((char **)ptr);
  len = fprintf(stream, "%s", string_object);
  return len;
}


x86 assembly (clang, -O0):
<handle_printf_atsign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xeb7(%rip),%rsi
call   1030 <fprintf@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_printf_atsign>:
mov    (%rdx),%rax
mov    (%rax),%rdx
lea    0xee3(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
%struct.printf_info = type { i32 }
@.str = [3 x i8] c"%s\00"
define i32 @handle_printf_atsign(i32* %0, %struct.printf_info* %1, i8** %2) {
%4 = alloca i32*
%5 = alloca %struct.printf_info*
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i32* %0, i32** %4
store %struct.printf_info* %1, %struct.printf_info** %5
store i8** %2, i8*** %6
%10 = load i8**, i8*** %6
%11 = load i8*, i8** %10
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = bitcast i8* %12 to i8**
%14 = load i8*, i8** %13
store i8* %14, i8** %8
%15 = load i32*, i32** %4
%16 = load i8*, i8** %8
%17 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 %17, i32* %9
%18 = load i32, i32* %9
ret i32 %18
}

LLVM IR (-O2):
%struct.printf_info = type { i32 }
@.str = [3 x i8] c"%s\00"
define i32 @handle_printf_atsign(i32* nocapture %0, %struct.printf_info* nocapture readnone %1, i8** nocapture %2) {
%4 = bitcast i8** %2 to i8***
%5 = load i8**, i8*** %4
%6 = load i8*, i8** %5
%7 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 %7
}
/* Type definitions */
typedef union ui_state {
  int dummy;
} ui_state;

/* Variables and functions */
int /*<<< orphan*/ on_motion_notify(union ui_state *, int, int, int);
void on_drag(union ui_state *state, int button, int x, int y) {
  on_motion_notify(state, button, x, y);
}


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

x86 assembly (clang, -O2):
<on_drag>:
jmp    1030 <on_motion_notify@plt>

LLVM IR (-O0):
%union.ui_state = type { i32 }
define void @on_drag(%union.ui_state* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %union.ui_state*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %union.ui_state* %0, %union.ui_state** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %union.ui_state*, %union.ui_state** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @on_motion_notify(%union.ui_state* %9, i32 %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
%union.ui_state = type { i32 }
define void @on_drag(%union.ui_state* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @on_motion_notify(%union.ui_state* %0, i32 %1, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void drop2(char *dropstatus, char *dropdesc) {
  if (dropstatus == NULL) {
    perror(dropdesc);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<drop2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114e <drop2+0x2e>
mov    -0x10(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drop2>:
test   %rdi,%rdi
je     1126 <drop2+0x6>
ret
push   %rax
mov    %rsi,%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @drop2(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @perror(i8* %8)
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @drop2(i8* readnone %0, i8* nocapture %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @perror(i8* %1)
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, float);
void print_line_float(uint32_t i, uint32_t j, float v, int magma) {
  if (magma)
    printf("A[%u,%u]:=%f;\n", i, j, v);
  else
    printf("%u %u %f\n", i, j, v);
}


x86 assembly (clang, -O0):
<print_line_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     114c <print_line_float+0x3c>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
movss  -0xc(%rbp),%xmm0
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
jmp    1163 <print_line_float+0x53>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
movss  -0xc(%rbp),%xmm0
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_line_float>:
mov    %esi,%eax
mov    %edi,%esi
test   %edx,%edx
lea    0xef2(%rip),%rcx
lea    0xedc(%rip),%rdi
cmove  %rcx,%rdi
mov    %eax,%edx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"A[%u,%u]:=%f;\0A\00"
@.str.1 = [10 x i8] c"%u %u %f\0A\00"
define void @print_line_float(i32 %0, i32 %1, float %2, i32 %3) {
%5 = icmp eq i32 %3, 0
%6 = select i1 %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
%7 = tail call i32 @printf(i8* %6, i32 %0, i32 %1, float %2)
ret void
}
char c2x(char ch) {
  if ((ch <= 9))
    return '0' + ch;
  return 'a' + ch - 10;
}


x86 assembly (clang, -O0):
<c2x>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x9,%eax
jg     1126 <c2x+0x26>
movsbl -0x2(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    1133 <c2x+0x33>
movsbl -0x2(%rbp),%eax
add    $0x61,%eax
sub    $0xa,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<c2x>:
cmp    $0xa,%dil
mov    $0x30,%ecx
mov    $0x57,%eax
cmovl  %ecx,%eax
add    %dil,%al
ret

LLVM IR (-O0):
define signext i8 @c2x(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sle i32 %5, 9
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = add nsw i32 48, %9
%11 = trunc i32 %10 to i8
store i8 %11, i8* %2
br label %18
12: ; preds = %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = add nsw i32 97, %14
%16 = sub nsw i32 %15, 10
%17 = trunc i32 %16 to i8
store i8 %17, i8* %2
br label %18
18: ; preds = %12, %7
%19 = load i8, i8* %2
ret i8 %19
}

LLVM IR (-O2):
define signext i8 @c2x(i8 signext %0) {
%2 = icmp slt i8 %0, 10
%3 = select i1 %2, i8 48, i8 87
%4 = add i8 %3, %0
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ stderr;
void CCutil_freerus(void *p) {
  if (!p) {
    fprintf(stderr, "Warning: null pointer freed\n");
    return;
  }
  free(p);
}


x86 assembly (clang, -O0):
<CCutil_freerus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1151 <CCutil_freerus+0x31>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
call   1040 <fprintf@plt>
jmp    115a <CCutil_freerus+0x3a>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CCutil_freerus>:
test   %rdi,%rdi
je     112a <CCutil_freerus+0xa>
jmp    1030 <free@plt>
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"Warning: null pointer freed\0A\00"
define void @CCutil_freerus(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @free(i8* %9)
br label %11
11: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"Warning: null pointer freed\0A\00"
define void @CCutil_freerus(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = tail call i32 @free(i8* %0)
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Matrix_Matrix_Mult(double const *, int const, int const,
                                      double const *, int const, int const,
                                      double *);
void GetQP(const double *Q, const double *P, double *QP, const int n) {
  Matrix_Matrix_Mult(Q, n, n, P, n, n, QP);
}


x86 assembly (clang, -O0):
<GetQP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    -0x18(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <Matrix_Matrix_Mult@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetQP>:
push   %rax
mov    %ecx,%r8d
mov    %rsi,%rcx
mov    %rdx,(%rsp)
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%r9d
call   1030 <Matrix_Matrix_Mult@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @GetQP(double* %0, double* %1, double* %2, i32 %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store i32 %3, i32* %8
%9 = load double*, double** %5
%10 = load i32, i32* %8
%11 = load i32, i32* %8
%12 = load double*, double** %6
%13 = load i32, i32* %8
%14 = load i32, i32* %8
%15 = load double*, double** %7
%16 = call i32 @Matrix_Matrix_Mult(double* %9, i32 %10, i32 %11, double* %12, i32 %13, i32 %14, double* %15)
ret void
}

LLVM IR (-O2):
define void @GetQP(double* %0, double* %1, double* %2, i32 %3) {
%5 = tail call i32 @Matrix_Matrix_Mult(double* %0, i32 %3, i32 %3, double* %1, i32 %3, i32 %3, double* %2)
ret void
}
double __attribute__((no)) double_min2(double a, double b) {
  return ((a) <= (b) ? (a) : (b));
}


x86 assembly (clang, -O0):
<double_min2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1131 <double_min2+0x31>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113b <double_min2+0x3b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_min2>:
movapd %xmm0,%xmm2
cmplesd %xmm1,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @double_min2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp ole double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @double_min2(double %0, double %1) {
%3 = fcmp ole double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Type definitions */
struct confinement {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct confinement *);
void CF_free(struct confinement *cf) {
  if (cf != NULL)
    free(cf);
}


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

x86 assembly (clang, -O2):
<CF_free>:
test   %rdi,%rdi
je     111a <CF_free+0xa>
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
%struct.confinement = type { i32 }
define void @CF_free(%struct.confinement* %0) {
%2 = icmp eq %struct.confinement* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.confinement* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int verify(unsigned char const *, unsigned char const *, int);
int crypto_verify_32_tinynacl(const unsigned char *x, const unsigned char *y) {
  return verify(x, y, 32);
}


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

x86 assembly (clang, -O2):
<crypto_verify_32_tinynacl>:
mov    $0x20,%edx
jmp    1030 <verify@plt>

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

LLVM IR (-O2):
define i32 @crypto_verify_32_tinynacl(i8* %0, i8* %1) {
%3 = tail call i32 @verify(i8* %0, i8* %1, i32 32)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ F_SETLKW;
int /*<<< orphan*/ F_WRLCK;
int /*<<< orphan*/ set_flock(int, int /*<<< orphan*/, int /*<<< orphan*/);
void lock_shm_doublebuffer(int index) { (set_flock(index, F_WRLCK, F_SETLKW)); }


x86 assembly (clang, -O0):
<lock_shm_doublebuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
mov    0x2eba(%rip),%rax
mov    (%rax),%edx
call   1030 <set_flock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lock_shm_doublebuffer>:
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    0x2ec8(%rip),%rax
mov    (%rax),%edx
jmp    1030 <set_flock@plt>

LLVM IR (-O0):
@F_WRLCK = global i32 0
@F_SETLKW = global i32 0
define void @lock_shm_doublebuffer(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_WRLCK
%5 = load i32, i32* @F_SETLKW
%6 = call i32 @set_flock(i32 %3, i32 %4, i32 %5)
ret void
}

LLVM IR (-O2):
@F_WRLCK = global i32 0
@F_SETLKW = global i32 0
define void @lock_shm_doublebuffer(i32 %0) {
%2 = load i32, i32* @F_WRLCK
%3 = load i32, i32* @F_SETLKW
%4 = tail call i32 @set_flock(i32 %0, i32 %2, i32 %3)
ret void
}
void PSpecialInit(void) {}


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

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

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

LLVM IR (-O2):
define void @PSpecialInit() {
ret void
}
struct tm *localtime(const unsigned long *timep) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.tm = type opaque
define %struct.tm* @localtime(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
ret %struct.tm* null
}

LLVM IR (-O2):
%struct.tm = type opaque
define noalias %struct.tm* @localtime(i64* nocapture readnone %0) {
ret %struct.tm* null
}
/* Type definitions */
struct basl_fio {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ basl_close(struct basl_fio *);
void basl_end(struct basl_fio *in, struct basl_fio *out) {
  basl_close(in);
  basl_close(out);
}


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

x86 assembly (clang, -O2):
<basl_end>:
push   %rbx
mov    %rsi,%rbx
call   1030 <basl_close@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <basl_close@plt>

LLVM IR (-O0):
%struct.basl_fio = type { i32 }
define void @basl_end(%struct.basl_fio* %0, %struct.basl_fio* %1) {
%3 = alloca %struct.basl_fio*
%4 = alloca %struct.basl_fio*
store %struct.basl_fio* %0, %struct.basl_fio** %3
store %struct.basl_fio* %1, %struct.basl_fio** %4
%5 = load %struct.basl_fio*, %struct.basl_fio** %3
%6 = call i32 @basl_close(%struct.basl_fio* %5)
%7 = load %struct.basl_fio*, %struct.basl_fio** %4
%8 = call i32 @basl_close(%struct.basl_fio* %7)
ret void
}

LLVM IR (-O2):
%struct.basl_fio = type { i32 }
define void @basl_end(%struct.basl_fio* %0, %struct.basl_fio* %1) {
%3 = tail call i32 @basl_close(%struct.basl_fio* %0)
%4 = tail call i32 @basl_close(%struct.basl_fio* %1)
ret void
}
adr0regx1_set(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (*((float *)10000000)) = (p1[x1]); }


x86 assembly (clang, -O0):
<adr0regx1_set>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    $0x989680,%eax
movss  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adr0regx1_set>:
movslq %esi,%rax
movss  (%rcx,%rax,4),%xmm0
movss  %xmm0,0x989680
ret

LLVM IR (-O0):
define i32 @adr0regx1_set(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float*, float** %13
%17 = load i32, i32* %11
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds float, float* %16, i64 %18
%20 = load float, float* %19
store float %20, float* inttoptr (i64 10000000 to float*)
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
define i32 @adr0regx1_set(double %0, double %1, i32 %2, i32 %3, float* nocapture readnone %4, float* nocapture %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds float, float* %5, i64 %7
%9 = load float, float* %8
store float %9, float* inttoptr (i64 10000000 to float*)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char *);
void func(char *s) {
  static char i = '\b';
  printf("%c %s", i, s);
  i = ',';
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2f06(%rip),%al
mov    -0x8(%rbp),%rdx
lea    0xed3(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movb   $0x2c,0x2eec(%rip)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
push   %rax
mov    %rdi,%rdx
cmpb   $0x0,0x2f0e(%rip)
mov    $0x2c,%eax
mov    $0x8,%esi
cmovne %eax,%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
movb   $0x1,0x2eee(%rip)
pop    %rax
ret

LLVM IR (-O0):
@func.i = internal global i8 8
@.str = [6 x i8] c"%c %s\00"
define void @func(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8, i8* @func.i
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %3, i8* %4)
store i8 44, i8* @func.i
ret void
}

LLVM IR (-O2):
@func.i = internal unnamed_addr global i1 false
@.str = [6 x i8] c"%c %s\00"
define void @func(i8* %0) {
%2 = load i1, i1* @func.i
%3 = select i1 %2, i8 44, i8 8
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %3, i8* %0)
store i1 true, i1* @func.i
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int SOL_SOCKET;
int getsockopt(int, int, int, void *, int /*<<< orphan*/ *);
int test(void) {
  int sockfd = 4;
  int level = SOL_SOCKET;
  int optname = 67;
  int value;
  void *optval = &value;
  socklen_t optlen;
  return getsockopt(sockfd, level, optname, optval, &optlen);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x4,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
movl   $0x43,-0xc(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
call   1030 <getsockopt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
mov    $0x4,%edi
mov    $0x43,%edx
call   1030 <getsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 4, i32* %1
%7 = load i32, i32* @SOL_SOCKET
store i32 %7, i32* %2
store i32 67, i32* %3
%8 = bitcast i32* %4 to i8*
store i8* %8, i8** %5
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = load i8*, i8** %5
%13 = call i32 @getsockopt(i32 %9, i32 %10, i32 %11, i8* %12, i32* %6)
ret i32 %13
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @SOL_SOCKET
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = call i32 @getsockopt(i32 4, i32 %3, i32 67, i8* %4, i32* %2)
ret i32 %6
}
int how_long_is_number_in_16(int number) {
  int l = 0;
  while (number > 0) {
    number = number / 16;
    l++;
  }
  return l;
}


x86 assembly (clang, -O0):
<how_long_is_number_in_16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1134 <how_long_is_number_in_16+0x34>
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <how_long_is_number_in_16+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<how_long_is_number_in_16>:
xor    %eax,%eax
test   %edi,%edi
jle    111d <how_long_is_number_in_16+0x1d>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    $0x4,%ecx
add    $0x1,%eax
cmp    $0xf,%edi
mov    %ecx,%edi
ja     1110 <how_long_is_number_in_16+0x10>
ret

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

LLVM IR (-O2):
define i32 @how_long_is_number_in_16(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 4
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 16
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
int ffwrap() { return (1); }


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

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

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

LLVM IR (-O2):
define i32 @ffwrap() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void DeleteEnclRectData(void *rectattr) { free(rectattr); }


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

LLVM IR (-O0):
define void @DeleteEnclRectData(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 @DeleteEnclRectData(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ value;

/* Variables and functions */
int /*<<< orphan*/ rdfile(char *, char *, int);
char readc(char *file) {
  char value;
  if (!rdfile(file, &value, sizeof(value)))
    value = '\0';
  return value;
}


x86 assembly (clang, -O0):
<readc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <rdfile@plt>
cmp    $0x0,%eax
jne    113b <readc+0x2b>
movb   $0x0,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readc>:
push   %rax
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <rdfile@plt>
test   %eax,%eax
movzbl 0x7(%rsp),%ecx
cmovne %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define signext i8 @readc(i8* %0) {
%2 = alloca i8
%3 = call i32 @rdfile(i8* %0, i8* %2, i32 1)
%4 = icmp eq i32 %3, 0
%5 = load i8, i8* %2
%6 = select i1 %4, i8 0, i8 %5
ret i8 %6
}
void sol_http_client_shutdown(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
time_t sld_time_epoch_seconds() { return time(NULL); }


x86 assembly (clang, -O0):
<sld_time_epoch_seconds>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sld_time_epoch_seconds>:
xor    %edi,%edi
jmp    1030 <time@plt>

LLVM IR (-O0):
define i32 @sld_time_epoch_seconds() {
%1 = call i32 @time(i32* null)
ret i32 %1
}

LLVM IR (-O2):
define i32 @sld_time_epoch_seconds() {
%1 = tail call i32 @time(i32* null)
ret i32 %1
}
int test_imm_98int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x98 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_98int64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x10,%rdx
and    $0x98,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_98int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 9961472
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
indreg0indreg1(r0, r1, x0, x1, p0, p1) double r0, r1;
double *p0, *p1;
{
  if ((*p0) <= (*p1))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<indreg0indreg1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1142 <indreg0indreg1+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1149 <indreg0indreg1+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indreg0indreg1>:
movsd  (%rcx),%xmm0
xor    %eax,%eax
ucomisd (%rdx),%xmm0
setae  %al
ret

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

LLVM IR (-O2):
define i32 @indreg0indreg1(double %0, double %1, i32 %2, i32 %3, double* nocapture %4, double* nocapture %5) {
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fcmp ole double %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int i2c_bulkread(void *, unsigned char, unsigned char, unsigned char *,
                 unsigned int);
int i2c_dataread(void *hDevice, unsigned char chip, unsigned char addr,
                 unsigned char *data, unsigned int length) {
  return i2c_bulkread(hDevice, chip, addr, data, length);
}


x86 assembly (clang, -O0):
<i2c_dataread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %sil,%dl
mov    %rdi,-0x8(%rbp)
mov    %dl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%dl
mov    -0xa(%rbp),%al
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
movzbl %dl,%esi
movzbl %al,%edx
call   1030 <i2c_bulkread@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_dataread>:
jmp    1030 <i2c_bulkread@plt>

LLVM IR (-O0):
define i32 @i2c_dataread(i8* %0, i8 zeroext %1, i8 zeroext %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i8 %1, i8* %7
store i8 %2, i8* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i8*, i8** %6
%12 = load i8, i8* %7
%13 = load i8, i8* %8
%14 = load i8*, i8** %9
%15 = load i32, i32* %10
%16 = call i32 @i2c_bulkread(i8* %11, i8 zeroext %12, i8 zeroext %13, i8* %14, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @i2c_dataread(i8* %0, i8 zeroext %1, i8 zeroext %2, i8* %3, i32 %4) {
%6 = tail call i32 @i2c_bulkread(i8* %0, i8 zeroext %1, i8 zeroext %2, i8* %3, i32 %4)
ret i32 %6
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", getchar() != EOF);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2eab(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
and    $0x1,%al
movzbl %al,%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb9(%rip),%rcx
xor    %esi,%esi
cmp    (%rcx),%rax
setne  %sil
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@EOF = global i64 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @getchar()
%3 = load i64, i64* @EOF
%4 = icmp ne i64 %2, %3
%5 = zext i1 %4 to i32
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@EOF = global i64 0
define i32 @main() {
%1 = tail call i64 (...) @getchar()
%2 = load i64, i64* @EOF
%3 = icmp ne i64 %1, %2
%4 = zext i1 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void stor_32(void *p, uint32_t v) {
  uint8_t *p8 = p;
  p8[0] = v & 0xff;
  p8[1] = (v >> 8) & 0xff;
  p8[2] = (v >> 16) & 0xff;
  p8[3] = v >> 24;
}


x86 assembly (clang, -O0):
<stor_32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<stor_32>:
mov    %esi,%eax
movzbl %al,%ecx
mov    %ecx,(%rdi)
movzbl %ah,%ecx
mov    %ecx,0x4(%rdi)
mov    %esi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x8(%rdi)
sar    $0x18,%eax
mov    %eax,0xc(%rdi)
ret

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

LLVM IR (-O2):
define void @stor_32(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = and i32 %1, 255
store i32 %4, i32* %3
%5 = lshr i32 %1, 8
%6 = and i32 %5, 255
%7 = getelementptr inbounds i8, i8* %0, i64 4
%8 = bitcast i8* %7 to i32*
store i32 %6, i32* %8
%9 = lshr i32 %1, 16
%10 = and i32 %9, 255
%11 = getelementptr inbounds i8, i8* %0, i64 8
%12 = bitcast i8* %11 to i32*
store i32 %10, i32* %12
%13 = ashr i32 %1, 24
%14 = getelementptr inbounds i8, i8* %0, i64 12
%15 = bitcast i8* %14 to i32*
store i32 %13, i32* %15
ret void
}
void RX_INT_Interrupt(void) {}


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

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

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

LLVM IR (-O2):
define void @RX_INT_Interrupt() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int *ptr;
  int **pptr;
  int ***ppptr;
  int var = 5;
  ptr = &var;
  printf("%d\n", *ptr);
  *ptr = 42;
  printf("%d\n", *ptr);
  printf("%d\n", var);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x24(%rbp)
lea    -0x24(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x2a,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 42)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 42)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mdea_error(char **, char *);
int mdea_string_node_get_number(void *p, double *number, char **error) {
  mdea_error(error, "Expected number, got string");
  return -1;
}


x86 assembly (clang, -O0):
<mdea_string_node_get_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed1(%rip),%rsi
call   1030 <mdea_error@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mdea_string_node_get_number>:
push   %rax
mov    %rdx,%rdi
lea    0xee5(%rip),%rsi
call   1030 <mdea_error@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Expected number, got string\00"
define i32 @mdea_string_node_get_number(i8* %0, double* %1, i8** %2) {
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i8**
store i8* %0, i8** %4
store double* %1, double** %5
store i8** %2, i8*** %6
%7 = load i8**, i8*** %6
%8 = call i32 @mdea_error(i8** %7, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [28 x i8] c"Expected number, got string\00"
define i32 @mdea_string_node_get_number(i8* nocapture readnone %0, double* nocapture readnone %1, i8** %2) {
%4 = tail call i32 @mdea_error(i8** %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}