xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ tolower(char);
char *pl_strtolower(char *s) {
  for (size_t i = 0; s[i] != '\0'; ++i) {
    s[i] = (char)tolower(s[i]);
  }
  return s;
}


x86 assembly (clang, -O0):
<pl_strtolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1168 <pl_strtolower+0x58>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <pl_strtolower+0x14>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pl_strtolower>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1146 <pl_strtolower+0x36>
lea    0x1(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <pl_strtolower+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @pl_strtolower(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %1
ret i8* %0
5: ; preds = %1, %5
%6 = phi i8 [ %13, %5 ], [ %2, %1 ]
%7 = phi i8* [ %12, %5 ], [ %0, %1 ]
%8 = phi i64 [ %11, %5 ], [ 0, %1 ]
%9 = tail call i64 @tolower(i8 signext %6)
%10 = trunc i64 %9 to i8
store i8 %10, i8* %7
%11 = add i64 %8, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %4, label %5
}
unsigned test4(unsigned x) {
  return ((x & 0xFF000000) >> 8) | ((x & 0x0000FF00) >> 8);
}


x86 assembly (clang, -O0):
<test4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff000000,%eax
shr    $0x8,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shr    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test4>:
mov    %edi,%eax
shr    $0x8,%eax
and    $0xff00ff,%eax
ret

LLVM IR (-O0):
define i32 @test4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -16777216
%5 = lshr i32 %4, 8
%6 = load i32, i32* %2
%7 = and i32 %6, 65280
%8 = lshr i32 %7, 8
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @test4(i32 %0) {
%2 = lshr i32 %0, 8
%3 = and i32 %2, 16711935
ret i32 %3
}
float vec2_squaredLength(float *a) {
  float x = a[0], y = a[1];
  return x * x + y * y;
}


x86 assembly (clang, -O0):
<vec2_squaredLength>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec2_squaredLength>:
movss  (%rdi),%xmm0
movss  0x4(%rdi),%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @vec2_squaredLength(float* %0) {
%2 = alloca float*
%3 = alloca float
%4 = alloca float
store float* %0, float** %2
%5 = load float*, float** %2
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
store float %7, float* %3
%8 = load float*, float** %2
%9 = getelementptr inbounds float, float* %8, i64 1
%10 = load float, float* %9
store float %10, float* %4
%11 = load float, float* %3
%12 = load float, float* %3
%13 = load float, float* %4
%14 = load float, float* %4
%15 = fmul float %13, %14
%16 = call float @llvm.fmuladd.f32(float %11, float %12, float %15)
ret float %16
}

LLVM IR (-O2):
define float @vec2_squaredLength(float* nocapture %0) {
%2 = load float, float* %0
%3 = getelementptr inbounds float, float* %0, i64 1
%4 = load float, float* %3
%5 = fmul float %4, %4
%6 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %5)
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ Print();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello, world!\n");
  Print();
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Hello, world!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @Print()
ret i32 0
}
int absolute(int a) {
  if (a >= 0) {
    a = -a;
  }
  return a;
}


x86 assembly (clang, -O0):
<absolute>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1119 <absolute+0x19>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @absolute(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 false)
%3 = sub i32 0, %2
ret i32 %3
}
/* Variables and functions */
int get_thread_id();
int /*<<< orphan*/ printf(char *, int);
void *f(void *msg __attribute__((unused))) {
  printf("tid: %d\n", get_thread_id());
  long long l = 0;
  while (1) {
    l++;
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <get_thread_id@plt>
mov    %eax,%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    %rax,-0x10(%rbp)
jmp    1149 <f+0x29>

x86 assembly (clang, -O2):
<f>:
push   %rax
xor    %eax,%eax
call   1040 <get_thread_id@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
jmp    1140 <f+0x20>

LLVM IR (-O0):
@.str = [9 x i8] c"tid: %d\0A\00"
define i8* @f(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = call i32 (...) @get_thread_id()
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %4)
store i64 0, i64* %3
br label %6
6: ; preds = %1, %6
%7 = load i64, i64* %3
%8 = add nsw i64 %7, 1
store i64 %8, i64* %3
br label %6
}

LLVM IR (-O2):
@.str = [9 x i8] c"tid: %d\0A\00"
define noalias i8* @f(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @get_thread_id()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %4
4: ; preds = %4, %1
br label %4
}
int handle_count(card_value) {
  int delta = 0;
  if ((card_value > 2) && (card_value < 7)) {
    delta++;
  } else if (card_value == 10) {
    delta--;
  }
  return delta;
}


x86 assembly (clang, -O0):
<handle_count>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x4(%rbp)
jle    1130 <handle_count+0x30>
cmpl   $0x7,-0x4(%rbp)
jge    1130 <handle_count+0x30>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <handle_count+0x48>
cmpl   $0xa,-0x4(%rbp)
jne    1143 <handle_count+0x43>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <handle_count+0x48>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_count>:
lea    -0x3(%rdi),%eax
xor    %ecx,%ecx
cmp    $0xa,%edi
sete   %cl
neg    %ecx
cmp    $0x4,%eax
mov    $0x1,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @handle_count(i32 %0) {
%2 = add i32 %0, -3
%3 = icmp ult i32 %2, 4
%4 = icmp eq i32 %0, 10
%5 = sext i1 %4 to i32
%6 = select i1 %3, i32 1, i32 %5
ret i32 %6
}
/* Type definitions */
struct termios {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ TCSANOW;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ tcsetattr(int /*<<< orphan*/, int /*<<< orphan*/,
                             struct termios *);
void reset_console(struct termios *oldt) {
  tcsetattr(STDIN_FILENO, TCSANOW, oldt);
  printf("\e[?25h");
}


x86 assembly (clang, -O0):
<reset_console>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rdx
call   1040 <tcsetattr@plt>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_console>:
push   %rax
mov    %rdi,%rdx
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
call   1040 <tcsetattr@plt>
lea    0xebe(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.termios = type { i32 }
@STDIN_FILENO = global i32 0
@TCSANOW = global i32 0
@.str = [7 x i8] c"\1B[?25h\00"
define void @reset_console(%struct.termios* %0) {
%2 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %2
%3 = load i32, i32* @STDIN_FILENO
%4 = load i32, i32* @TCSANOW
%5 = load %struct.termios*, %struct.termios** %2
%6 = call i32 @tcsetattr(i32 %3, i32 %4, %struct.termios* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@STDIN_FILENO = global i32 0
@TCSANOW = global i32 0
@.str = [7 x i8] c"\1B[?25h\00"
define void @reset_console(%struct.termios* %0) {
%2 = load i32, i32* @STDIN_FILENO
%3 = load i32, i32* @TCSANOW
%4 = tail call i32 @tcsetattr(i32 %2, i32 %3, %struct.termios* %0)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void Section4Minutes(int seconds) {
  printf("%d minutes and ", seconds % 3600 / 60);
}


x86 assembly (clang, -O0):
<Section4Minutes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Section4Minutes>:
movslq %edi,%rax
imul   $0xffffffff91a2b3c5,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0xb,%ecx
add    %edx,%ecx
imul   $0xe10,%ecx,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0xffff8889,%ecx,%ecx
shr    $0x10,%ecx
add    %eax,%ecx
movzwl %cx,%eax
movswl %ax,%ecx
shr    $0xf,%eax
sar    $0x5,%ecx
add    %eax,%ecx
movswl %cx,%esi
lea    0xea8(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"%d minutes and \00"
define void @Section4Minutes(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 3600
%5 = sdiv i32 %4, 60
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%d minutes and \00"
define void @Section4Minutes(i32 %0) {
%2 = srem i32 %0, 3600
%3 = trunc i32 %2 to i16
%4 = sdiv i16 %3, 60
%5 = sext i16 %4 to i32
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *fs_fread(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fs_open(char *, char *);
char *fs_read(char *path) {
  FILE *file = fs_open(path, "r");
  return fs_fread(file);
}


x86 assembly (clang, -O0):
<fs_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <fs_open@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fs_fread@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fs_read>:
push   %rax
lea    0xed8(%rip),%rsi
call   1030 <fs_open@plt>
mov    %rax,%rdi
pop    %rax
jmp    1040 <fs_fread@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i8* @fs_read(i8* %0) {
%2 = tail call i32* @fs_open(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i8* @fs_fread(i32* %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ fdputs(int, char *);
void send_header_textplain(int clientsock) {
  fdputs(clientsock, "Content-Type: text/plain\n");
}


x86 assembly (clang, -O0):
<send_header_textplain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xedb(%rip),%rsi
call   1030 <fdputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_header_textplain>:
lea    0xee9(%rip),%rsi
jmp    1030 <fdputs@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Content-Type: text/plain\0A\00"
define void @send_header_textplain(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @fdputs(i32 %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Content-Type: text/plain\0A\00"
define void @send_header_textplain(i32 %0) {
%2 = tail call i32 @fdputs(i32 %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sumx(int x, int y) {
  int sum = x + y;
  printf("sum is %d \n", sum);
}


x86 assembly (clang, -O0):
<sumx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumx>:
add    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c"sum is %d \0A\00"
define i32 @sumx(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 undef
}
/* Type definitions */
typedef char uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int strlen(char *);
uint32_t fingerprint_command(char *command) {
  uint32_t retval;
  uint8_t *fingerprint = (uint8_t *)&retval;
  int command_len = strlen(command);
  int spacing = command_len / 4;
  for (int x = 0, y = 0; x < command_len; x += spacing, y++) {
    fingerprint[y] = command[x];
  }
}


x86 assembly (clang, -O0):
<fingerprint_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1185 <fingerprint_command+0x75>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    114c <fingerprint_command+0x3c>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fingerprint_command>:
jmp    1030 <strlen@plt>

LLVM IR (-O0):
define i32 @fingerprint_command(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %3
%10 = bitcast i32* %4 to i8*
store i8* %10, i8** %5
%11 = load i8*, i8** %3
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = sdiv i32 %13, 4
store i32 %14, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
br label %15
15: ; preds = %29, %1
%16 = load i32, i32* %8
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %35
19: ; preds = %15
%20 = load i8*, i8** %3
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = load i8*, i8** %5
%26 = load i32, i32* %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 %24, i8* %28
br label %29
29: ; preds = %19
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = add nsw i32 %31, %30
store i32 %32, i32* %8
%33 = load i32, i32* %9
%34 = add nsw i32 %33, 1
store i32 %34, i32* %9
br label %15
35: ; preds = %15
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
define i32 @fingerprint_command(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
ret i32 undef
}
int getFileOrientation(int orientation, int useX, int useY) {
  if (orientation == 0) {
    return (useY % 2 == 0) ? 0 : 2;
  } else if (orientation == 1) {
    return (useX % 2 == 0) ? 1 : 3;
  } else {
    return 4;
  }
}


x86 assembly (clang, -O0):
<getFileOrientation>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1137 <getFileOrientation+0x37>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    116b <getFileOrientation+0x6b>
cmpl   $0x1,-0x8(%rbp)
jne    1164 <getFileOrientation+0x64>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x3,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    116b <getFileOrientation+0x6b>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileOrientation>:
cmp    $0x1,%edi
je     1116 <getFileOrientation+0x16>
mov    $0x4,%eax
test   %edi,%edi
jne    111f <getFileOrientation+0x1f>
add    %edx,%edx
and    $0x2,%edx
mov    %edx,%eax
ret
and    $0x1,%esi
lea    (%rsi,%rsi,1),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @getFileOrientation(i32 %0, i32 %1, i32 %2) {
switch i32 %0, label %11 [
i32 0, label %4
i32 1, label %7
]
4: ; preds = %3
%5 = shl i32 %2, 1
%6 = and i32 %5, 2
br label %11
7: ; preds = %3
%8 = and i32 %1, 1
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 1, i32 3
br label %11
11: ; preds = %3, %7, %4
%12 = phi i32 [ %6, %4 ], [ %10, %7 ], [ 4, %3 ]
ret i32 %12
}
int main() {
  int i;
  int sum;
  for (i = 1; i <= 10; i++)
    sum = sum + i;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     1133 <main+0x33>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct map {
  int dummy;
};

/* Variables and functions */
int map_ihas(struct map *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int map_has(struct map *m, char *key) { return map_ihas(m, key, strlen(key)); }


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

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

LLVM IR (-O0):
%struct.map = type { i32 }
define i32 @map_has(%struct.map* %0, i8* %1) {
%3 = alloca %struct.map*
%4 = alloca i8*
store %struct.map* %0, %struct.map** %3
store i8* %1, i8** %4
%5 = load %struct.map*, %struct.map** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @map_ihas(%struct.map* %5, i8* %6, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.map = type { i32 }
define i32 @map_has(%struct.map* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @map_ihas(%struct.map* %0, i8* %1, i32 %3)
ret i32 %4
}
int test_imm_11uint8_reg(unsigned char val) {
  return ((val) & (0x11 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_11uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0x11,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_11uint8_reg>:
test   $0x11,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_11uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 17
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct spin_lock {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, struct spin_lock *);
__attribute__((no)) void spin_lock(struct spin_lock *lock) {
  printf("Locking %p.\n", lock);
}


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

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

LLVM IR (-O0):
%struct.spin_lock = type { i32 }
@.str = [13 x i8] c"Locking %p.\0A\00"
define void @spin_lock(%struct.spin_lock* %0) {
%2 = alloca %struct.spin_lock*
store %struct.spin_lock* %0, %struct.spin_lock** %2
%3 = load %struct.spin_lock*, %struct.spin_lock** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %struct.spin_lock* %3)
ret void
}

LLVM IR (-O2):
%struct.spin_lock = type { i32 }
@.str = [13 x i8] c"Locking %p.\0A\00"
define void @spin_lock(%struct.spin_lock* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %struct.spin_lock* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ h2o_strdup(char *, char *, int);
int fib() {
  char s[16];
  h2o_strdup(s, "abc", 3);
  return 777;
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
lea    0xedd(%rip),%rsi
mov    $0x3,%edx
call   1030 <h2o_strdup@plt>
mov    $0x309,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
sub    $0x18,%rsp
lea    0xee5(%rip),%rsi
mov    %rsp,%rdi
mov    $0x3,%edx
call   1030 <h2o_strdup@plt>
mov    $0x309,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
define i32 @fib() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @h2o_strdup(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
ret i32 777
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
define i32 @fib() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @h2o_strdup(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
ret i32 777
}
/* Variables and functions */
int /*<<< orphan*/ lettura_file_testo();
int /*<<< orphan*/ stampa_targhet(int /*<<< orphan*/);
int /*<<< orphan*/ trova_targhet(int /*<<< orphan*/, int, int);
int main(void) {
  int j = 1;
  int targhet = 4;
  stampa_targhet(trova_targhet(lettura_file_testo(), j, targhet));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
mov    $0x0,%al
call   1040 <lettura_file_testo@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <trova_targhet@plt>
mov    %eax,%edi
call   1030 <stampa_targhet@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <lettura_file_testo@plt>
mov    %eax,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1050 <trova_targhet@plt>
mov    %eax,%edi
call   1030 <stampa_targhet@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @lettura_file_testo()
%2 = tail call i32 @trova_targhet(i32 %1, i32 1, i32 4)
%3 = tail call i32 @stampa_targhet(i32 %2)
ret i32 0
}
/* Variables and functions */
double log(int);
double logit(double x) {
  double Result = log(x) - log(1 - x);
  return Result;
}


x86 assembly (clang, -O0):
<logit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xecc(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logit>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xecf(%rip),%xmm0
subsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @logit(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fptosi double %4 to i32
%6 = call double @log(i32 %5)
%7 = load double, double* %2
%8 = fsub double 1.000000e+00, %7
%9 = fptosi double %8 to i32
%10 = call double @log(i32 %9)
%11 = fsub double %6, %10
store double %11, double* %3
%12 = load double, double* %3
ret double %12
}

LLVM IR (-O2):
define double @logit(double %0) {
%2 = fptosi double %0 to i32
%3 = tail call double @log(i32 %2)
%4 = fsub double 1.000000e+00, %0
%5 = fptosi double %4 to i32
%6 = tail call double @log(i32 %5)
%7 = fsub double %3, %6
ret double %7
}
/* Variables and functions */
unsigned long BSP_ReadIer();
int /*<<< orphan*/ BSP_WriteIer(unsigned long);
int /*<<< orphan*/ printf(char *, unsigned int);
void BSP_EnableDspInterrupt(unsigned int dspInt) {
  unsigned long tmp;
  if (dspInt > 15 || dspInt < 4) {
    printf("bad dsp_int%d\n", dspInt);
    return;
  }
  tmp = BSP_ReadIer();
  tmp |= (1 << dspInt);
  BSP_WriteIer(tmp);
}


x86 assembly (clang, -O0):
<BSP_EnableDspInterrupt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xf,-0x4(%rbp)
ja     114f <BSP_EnableDspInterrupt+0x1f>
cmpl   $0x4,-0x4(%rbp)
jae    1163 <BSP_EnableDspInterrupt+0x33>
mov    -0x4(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
jmp    118b <BSP_EnableDspInterrupt+0x5b>
mov    $0x0,%al
call   1030 <BSP_ReadIer@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <BSP_WriteIer@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_EnableDspInterrupt>:
push   %rbx
mov    %edi,%ebx
lea    -0x10(%rbx),%eax
cmp    $0xfffffff3,%eax
ja     114a <BSP_EnableDspInterrupt+0x1a>
lea    0xebe(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <printf@plt>
xor    %eax,%eax
call   1030 <BSP_ReadIer@plt>
mov    $0x1,%edi
mov    %ebx,%ecx
shl    %cl,%edi
or     %rax,%rdi
pop    %rbx
jmp    1050 <BSP_WriteIer@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"bad dsp_int%d\0A\00"
define void @BSP_EnableDspInterrupt(i32 %0) {
%2 = add i32 %0, -16
%3 = icmp ult i32 %2, -12
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %12
6: ; preds = %1
%7 = tail call i64 (...) @BSP_ReadIer()
%8 = shl nuw nsw i32 1, %0
%9 = zext i32 %8 to i64
%10 = or i64 %7, %9
%11 = tail call i32 @BSP_WriteIer(i64 %10)
br label %12
12: ; preds = %6, %4
ret void
}
void XtGetSubvalues() {}


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

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

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

LLVM IR (-O2):
define void @XtGetSubvalues() {
ret void
}
void dummySignalHandle() {}


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

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

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

LLVM IR (-O2):
define void @dummySignalHandle() {
ret void
}
void GP32_System_Reset() {
  unsigned long (*jump)();
  jump = 0x0000000;
  jump();
}


x86 assembly (clang, -O0):
<GP32_System_Reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @GP32_System_Reset() {
%1 = alloca i64 (...)*
store i64 (...)* null, i64 (...)** %1
%2 = load i64 (...)*, i64 (...)** %1
%3 = call i64 (...) %2()
ret void
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ __ESBMC_assume(int *);
int /*<<< orphan*/ free(int *);
int *malloc(int);
int main() {
  int *p = malloc(sizeof(int));
  __ESBMC_assume(p);
  *p = 2;
  free(p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <__ESBMC_assume@plt>
mov    -0x8(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <__ESBMC_assume@plt>
movl   $0x2,(%rbx)
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 4)
%2 = tail call i32 @__ESBMC_assume(i32* %1)
store i32 2, i32* %1
%3 = tail call i32 @free(i32* %1)
ret i32 0
}
int *foo(int *a, int *b) { return a; }


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

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

LLVM IR (-O0):
define i32* @foo(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
ret i32* %5
}

LLVM IR (-O2):
define i32* @foo(i32* readnone returned %0, i32* nocapture readnone %1) {
ret i32* %0
}
void tasks_shorter_foo1(void) {}


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

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

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

LLVM IR (-O2):
define void @tasks_shorter_foo1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ alisp_stop();
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
void catchIntr(int sig) {
  sig = 0;
  alisp_stop();
  signal(SIGINT, catchIntr);
}


x86 assembly (clang, -O0):
<catchIntr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <alisp_stop@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
mov    0x2e8f(%rip),%rsi
call   1040 <signal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<catchIntr>:
push   %rax
xor    %eax,%eax
call   1030 <alisp_stop@plt>
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    0x2ea0(%rip),%rsi
pop    %rax
jmp    1040 <signal@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
define void @catchIntr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %2
%3 = call i32 (...) @alisp_stop()
%4 = load i32, i32* @SIGINT
%5 = call i32 @signal(i32 %4, void (i32)* @catchIntr)
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
define void @catchIntr(i32 %0) {
%2 = tail call i32 (...) @alisp_stop()
%3 = load i32, i32* @SIGINT
%4 = tail call i32 @signal(i32 %3, void (i32)* @catchIntr)
ret void
}
/* Type definitions */
struct termios {
  int dummy;
};

/* Variables and functions */
scalar_t__ cfsetspeed(struct termios *, int);
int my_cfsetspeed(struct termios *ts, int speed) {
  if (cfsetspeed(ts, speed) == 0)
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<my_cfsetspeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <cfsetspeed@plt>
cmp    $0x0,%rax
jne    1141 <my_cfsetspeed+0x31>
movl   $0x0,-0x4(%rbp)
jmp    1148 <my_cfsetspeed+0x38>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_cfsetspeed>:
push   %rax
call   1030 <cfsetspeed@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
define i32 @my_cfsetspeed(%struct.termios* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.termios*
%5 = alloca i32
store %struct.termios* %0, %struct.termios** %4
store i32 %1, i32* %5
%6 = load %struct.termios*, %struct.termios** %4
%7 = load i32, i32* %5
%8 = call i64 @cfsetspeed(%struct.termios* %6, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
%struct.termios = type { i32 }
define i32 @my_cfsetspeed(%struct.termios* %0, i32 %1) {
%3 = tail call i64 @cfsetspeed(%struct.termios* %0, i32 %1)
%4 = icmp ne i64 %3, 0
%5 = sext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ reqbuf;

/* Variables and functions */
int ph_rpc(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, char const *);
int phSetContact(int vlid, const char *uri) {
  char reqbuf[1000];
  snprintf(reqbuf, sizeof(reqbuf), "CONTACT VLID=%d FROM=%s", vlid, uri);
  return ph_rpc(reqbuf);
}


x86 assembly (clang, -O0):
<phSetContact>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%r8
mov    $0x3e8,%esi
lea    0xeb4(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x400(%rbp),%rdi
call   1040 <ph_rpc@plt>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phSetContact>:
push   %rbx
sub    $0x3f0,%rsp
mov    %rsi,%r8
mov    %edi,%ecx
lea    0xecc(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <ph_rpc@plt>
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"CONTACT VLID=%d FROM=%s\00"
define i32 @phSetContact(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [1000 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = load i8*, i8** %4
%9 = call i32 @snprintf(i8* %6, i32 1000, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %8)
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%11 = call i32 @ph_rpc(i8* %10)
ret i32 %11
}

LLVM IR (-O2):
@.str = [24 x i8] c"CONTACT VLID=%d FROM=%s\00"
define i32 @phSetContact(i32 %0, i8* %1) {
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 1000, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1)
%6 = call i32 @ph_rpc(i8* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ foo(int /*<<< orphan*/, int *);
int main() {
  int i = 0;
  foo(0, &i);
  if (i != 1)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1040 <foo@plt>
cmpl   $0x1,-0x8(%rbp)
je     1152 <main+0x32>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
xor    %edi,%edi
call   1040 <foo@plt>
cmpl   $0x1,0x4(%rsp)
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @foo(i32 0, i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 1
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
ret i32 0
}
void initialiseConstants(double *variables) { variables[0] = 1.0; }


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

x86 assembly (clang, -O2):
<initialiseConstants>:
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @initialiseConstants(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
store double 1.000000e+00, double* %4
ret void
}

LLVM IR (-O2):
define void @initialiseConstants(double* nocapture writeonly %0) {
store double 1.000000e+00, double* %0
ret void
}
int rk_headset_get(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @rk_headset_get() {
ret i32 0
}

LLVM IR (-O2):
define i32 @rk_headset_get() {
ret i32 0
}
/* Type definitions */
typedef int uint32_t;
struct commonNaN {
  int dummy;
};

/* Variables and functions */
void softfloat_commonNaNToF128M(const struct commonNaN *aPtr, uint32_t *zWPtr) {
  zWPtr[(3)] = 0x7FFF8000;
  zWPtr[(2)] = 0;
  zWPtr[(1)] = 0;
  zWPtr[(0)] = 0;
}


x86 assembly (clang, -O0):
<softfloat_commonNaNToF128M>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x7fff8000,0xc(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,0x8(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<softfloat_commonNaNToF128M>:
movaps 0xef9(%rip),%xmm0
movups %xmm0,(%rsi)
ret

LLVM IR (-O0):
%struct.commonNaN = type { i32 }
define void @softfloat_commonNaNToF128M(%struct.commonNaN* %0, i32* %1) {
%3 = alloca %struct.commonNaN*
%4 = alloca i32*
store %struct.commonNaN* %0, %struct.commonNaN** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = getelementptr inbounds i32, i32* %5, i64 3
store i32 2147450880, i32* %6
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 2
store i32 0, i32* %8
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 1
store i32 0, i32* %10
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 0
store i32 0, i32* %12
ret void
}

LLVM IR (-O2):
%struct.commonNaN = type { i32 }
define void @softfloat_commonNaNToF128M(%struct.commonNaN* nocapture readnone %0, i32* nocapture writeonly %1) {
%3 = bitcast i32* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 0, i32 0, i32 2147450880>, <4 x i32>* %3
ret void
}
unsigned long hash_gd6(char *uri) {
  unsigned long hash = 0;
  int c;
  while ((c = *uri++)) {
    if (c == '?' || c == '\n')
      break;
    hash = hash + (hash << 2) - (hash << 22) - c;
  }
  return hash;
}


x86 assembly (clang, -O0):
<hash_gd6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1171 <hash_gd6+0x71>
cmpl   $0x3f,-0x14(%rbp)
je     1142 <hash_gd6+0x42>
cmpl   $0xa,-0x14(%rbp)
jne    1147 <hash_gd6+0x47>
jmp    1171 <hash_gd6+0x71>
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
shl    $0x16,%rcx
sub    %rcx,%rax
movslq -0x14(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <hash_gd6+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_gd6>:
xor    %eax,%eax
movabs $0x8000000000000401,%rcx
jmp    1122 <hash_gd6+0x22>
xchg   %ax,%ax
movsbq %dl,%rdx
add    $0x1,%rdi
imul   $0xffffffffffc00005,%rax,%rax
sub    %rdx,%rax
movzbl (%rdi),%edx
cmp    $0x3f,%rdx
ja     1110 <hash_gd6+0x10>
bt     %rdx,%rcx
jae    1110 <hash_gd6+0x10>
ret

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

LLVM IR (-O2):
define i64 @hash_gd6(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i64 [ 0, %1 ], [ %10, %6 ]
%4 = phi i8* [ %0, %1 ], [ %7, %6 ]
%5 = load i8, i8* %4
switch i8 %5, label %6 [
i8 0, label %11
i8 63, label %11
i8 10, label %11
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %4, i64 1
%8 = mul i64 %3, -4194299
%9 = sext i8 %5 to i64
%10 = sub i64 %8, %9
br label %2
11: ; preds = %2, %2, %2
ret i64 %3
}