xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ close(int);
int read(int, void *, int);
int /*<<< orphan*/ sendBuf(int, void *, size_t);
void sendFile(int s, int fid) {
  int n;
  char Buf[200];
  while ((n = read(fid, (void *)Buf, 200)) > 0)
    sendBuf(s, (void *)Buf, (size_t)n);
  close(fid);
}


x86 assembly (clang, -O0):
<sendFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0xe0(%rbp),%rsi
mov    $0xc8,%edx
call   1050 <read@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jle    1179 <sendFile+0x49>
mov    -0x4(%rbp),%edi
lea    -0xe0(%rbp),%rsi
movslq -0xc(%rbp),%rdx
call   1040 <sendBuf@plt>
jmp    1141 <sendFile+0x11>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendFile>:
push   %rbp
push   %r14
push   %rbx
sub    $0xd0,%rsp
mov    %esi,%ebx
mov    %edi,%r14d
mov    %rsp,%rsi
mov    %ebx,%edi
mov    $0xc8,%edx
call   1050 <read@plt>
test   %eax,%eax
jle    1180 <sendFile+0x50>
mov    %rsp,%rbp
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%edx
mov    %r14d,%edi
mov    %rbp,%rsi
call   1040 <sendBuf@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0xc8,%edx
call   1050 <read@plt>
test   %eax,%eax
jg     1160 <sendFile+0x30>
mov    %ebx,%edi
call   1030 <close@plt>
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @sendFile(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [200 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %7
7: ; preds = %12, %2
%8 = load i32, i32* %4
%9 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%10 = call i32 @read(i32 %8, i8* %9, i32 200)
store i32 %10, i32* %5
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %7
%13 = load i32, i32* %3
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = call i32 @sendBuf(i32 %13, i8* %14, i64 %16)
br label %7
18: ; preds = %7
%19 = load i32, i32* %4
%20 = call i32 @close(i32 %19)
ret void
}

LLVM IR (-O2):
define void @sendFile(i32 %0, i32 %1) {
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = call i32 @read(i32 %1, i8* %4, i32 200)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %2, %7
%8 = phi i32 [ %11, %7 ], [ %5, %2 ]
%9 = zext i32 %8 to i64
%10 = call i32 @sendBuf(i32 %0, i8* %4, i64 %9)
%11 = call i32 @read(i32 %1, i8* %4, i32 200)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %7, label %13
13: ; preds = %7, %2
%14 = call i32 @close(i32 %1)
ret void
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_seat_can_multi_session(const char *seat) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_seat_can_multi_session>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    0x2ecf(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_seat_can_multi_session>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_seat_can_multi_session(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_seat_can_multi_session(i8* nocapture readnone %0) {
%2 = load i32, i32* @EINVAL
%3 = sub nsw i32 0, %2
ret i32 %3
}
does_not_exist(file_name) char file_name[];
{}


x86 assembly (clang, -O0):
<does_not_exist>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @does_not_exist(i8* nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
int file_exists(char *);
char *file_mkpath(char const *, char const *);
int /*<<< orphan*/ free(char *);
int file_exists_in_dir(const char *dirname, const char *fname) {
  int ret = -1;
  char *path = file_mkpath(dirname, fname);
  if (path) {
    ret = file_exists(path);
    free(path);
  }
  return ret;
}


x86 assembly (clang, -O0):
<file_exists_in_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <file_mkpath@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1178 <file_exists_in_dir+0x48>
mov    -0x20(%rbp),%rdi
call   1040 <file_exists@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists_in_dir>:
push   %rbp
push   %rbx
push   %rax
call   1050 <file_mkpath@plt>
test   %rax,%rax
je     1156 <file_exists_in_dir+0x26>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <file_exists@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
jmp    115b <file_exists_in_dir+0x2b>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @file_exists_in_dir(i8* %0, i8* %1) {
%3 = tail call i8* @file_mkpath(i8* %0, i8* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @file_exists(i8* %3)
%7 = tail call i32 @free(i8* %3)
br label %8
8: ; preds = %5, %2
%9 = phi i32 [ %6, %5 ], [ -1, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ cPrintf(char *);
void help07(void) {
  cPrintf("  #                 show PC\n");
  cPrintf("  #  <addr>         set PC to <addr>\n");
}


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

x86 assembly (clang, -O2):
<help07>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <cPrintf@plt>
lea    0xef9(%rip),%rdi
pop    %rax
jmp    1030 <cPrintf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c" # show PC\0A\00"
@.str.1 = [38 x i8] c" # <addr> set PC to <addr>\0A\00"
define void @help07() {
%1 = call i32 @cPrintf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @cPrintf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c" # show PC\0A\00"
@.str.1 = [38 x i8] c" # <addr> set PC to <addr>\0A\00"
define void @help07() {
%1 = tail call i32 @cPrintf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @cPrintf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct struct_automata {
  int dummy;
};

/* Variables and functions */
size_t _func_card_input(struct struct_automata *, int /*<<< orphan*/);
size_t func_card_input(struct struct_automata *p) {
  return _func_card_input(p, 0);
}


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

x86 assembly (clang, -O2):
<func_card_input>:
xor    %esi,%esi
jmp    1030 <_func_card_input@plt>

LLVM IR (-O0):
%struct.struct_automata = type { i32 }
define i64 @func_card_input(%struct.struct_automata* %0) {
%2 = alloca %struct.struct_automata*
store %struct.struct_automata* %0, %struct.struct_automata** %2
%3 = load %struct.struct_automata*, %struct.struct_automata** %2
%4 = call i64 @_func_card_input(%struct.struct_automata* %3, i32 0)
ret i64 %4
}

LLVM IR (-O2):
%struct.struct_automata = type { i32 }
define i64 @func_card_input(%struct.struct_automata* %0) {
%2 = tail call i64 @_func_card_input(%struct.struct_automata* %0, i32 0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ __analyzer_eval(int);
void test_43(void) {
  int i;
  float f;
  f = 42.0f;
  i = f;
  __analyzer_eval(i == 42);
}


x86 assembly (clang, -O0):
<test_43>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xee0(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
cvttss2si -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x2a,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <__analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_43>:
mov    $0x1,%edi
jmp    1030 <__analyzer_eval@plt>

LLVM IR (-O0):
define void @test_43() {
%1 = alloca i32
%2 = alloca float
store float 4.200000e+01, float* %2
%3 = load float, float* %2
%4 = fptosi float %3 to i32
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 42
%7 = zext i1 %6 to i32
%8 = call i32 @__analyzer_eval(i32 %7)
ret void
}

LLVM IR (-O2):
define void @test_43() {
%1 = tail call i32 @__analyzer_eval(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printVal(int val) { printf("%d", val); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @printVal(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
float map_range(float value, float source_min, float source_max,
                float target_min, float target_max) {
  return target_min + (target_max - target_min) * (value - source_min) /
                          (source_max - source_min);
}


x86 assembly (clang, -O0):
<map_range>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
subss  -0x10(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
subss  -0x8(%rbp),%xmm2
mulss  %xmm2,%xmm1
movss  -0xc(%rbp),%xmm2
subss  -0x8(%rbp),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_range>:
subss  %xmm3,%xmm4
subss  %xmm1,%xmm0
mulss  %xmm4,%xmm0
subss  %xmm1,%xmm2
divss  %xmm2,%xmm0
addss  %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @map_range(float %0, float %1, float %2, float %3, float %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%11 = load float, float* %9
%12 = load float, float* %10
%13 = load float, float* %9
%14 = fsub float %12, %13
%15 = load float, float* %6
%16 = load float, float* %7
%17 = fsub float %15, %16
%18 = fmul float %14, %17
%19 = load float, float* %8
%20 = load float, float* %7
%21 = fsub float %19, %20
%22 = fdiv float %18, %21
%23 = fadd float %11, %22
ret float %23
}

LLVM IR (-O2):
define float @map_range(float %0, float %1, float %2, float %3, float %4) {
%6 = fsub float %4, %3
%7 = fsub float %0, %1
%8 = fmul float %7, %6
%9 = fsub float %2, %1
%10 = fdiv float %8, %9
%11 = fadd float %10, %3
ret float %11
}
/* Variables and functions */
int /*<<< orphan*/ change_node(int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
void change_node_thread(void) {
  int cnt;
  while (1) {
    sleep(10);
    change_node(0);
  }
}


x86 assembly (clang, -O0):
<change_node_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
call   1040 <sleep@plt>
xor    %edi,%edi
call   1030 <change_node@plt>
jmp    1128 <change_node_thread+0x8>

x86 assembly (clang, -O2):
<change_node_thread>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1040 <sleep@plt>
xor    %edi,%edi
call   1030 <change_node@plt>
jmp    1130 <change_node_thread+0x10>

LLVM IR (-O0):
define void @change_node_thread() {
%1 = alloca i32
br label %2
2: ; preds = %0, %2
%3 = call i32 @sleep(i32 10)
%4 = call i32 @change_node(i32 0)
br label %2
}

LLVM IR (-O2):
define void @change_node_thread() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @sleep(i32 10)
%3 = tail call i32 @change_node(i32 0)
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ RST(int);
void RST18() { RST(0x18); }


x86 assembly (clang, -O0):
<RST18>:
push   %rbp
mov    %rsp,%rbp
mov    $0x18,%edi
call   1030 <RST@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<RST18>:
mov    $0x18,%edi
jmp    1030 <RST@plt>

LLVM IR (-O0):
define void @RST18() {
%1 = call i32 @RST(i32 24)
ret void
}

LLVM IR (-O2):
define void @RST18() {
%1 = tail call i32 @RST(i32 24)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
main() {
  int a, b, c, *p, *q, *r;
  scanf("%d %d", &a, &b);
  p = &a;
  q = &b;
  r = &c;
  *r = *p * *q;
  printf("%d\n", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
imul   (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%esi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = mul nsw i32 %7, %6
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
size_t strlen(char *);
void FP_pointer_arith5_Ok() {
  char buf[1024];
  fgets(buf, 1024, stdin);
  size_t len = strlen(buf);
  if (len < sizeof(buf) - 3) {
    (buf + len)[sizeof(buf) - len - 1] = '\0';
  }
}


x86 assembly (clang, -O0):
<FP_pointer_arith5_Ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
lea    -0x400(%rbp),%rdi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1040 <fgets@plt>
lea    -0x400(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x408(%rbp)
cmpq   $0x3fd,-0x408(%rbp)
jae    118b <FP_pointer_arith5_Ok+0x6b>
lea    -0x400(%rbp),%rax
add    -0x408(%rbp),%rax
mov    $0x400,%ecx
sub    -0x408(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FP_pointer_arith5_Ok>:
sub    $0x408,%rsp
mov    0x2eca(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x400,%esi
call   1030 <fgets@plt>
add    $0x408,%rsp
ret

LLVM IR (-O0):
@stdin = global i32 0
define void @FP_pointer_arith5_Ok() {
%1 = alloca [1024 x i8]
%2 = alloca i64
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %3, i32 1024, i32 %4)
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%7 = call i64 @strlen(i8* %6)
store i64 %7, i64* %2
%8 = load i64, i64* %2
%9 = icmp ult i64 %8, 1021
br i1 %9, label %10, label %18
10: ; preds = %0
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%12 = load i64, i64* %2
%13 = getelementptr inbounds i8, i8* %11, i64 %12
%14 = load i64, i64* %2
%15 = sub i64 1024, %14
%16 = sub i64 %15, 1
%17 = getelementptr inbounds i8, i8* %13, i64 %16
store i8 0, i8* %17
br label %18
18: ; preds = %10, %0
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
define void @FP_pointer_arith5_Ok() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 1024, i32 %3)
ret void
}
int ceil_log2(int a) {
  int result = 0;
  if ((a & (a - 1)) == 0) {
    result = -1;
  }
  while (a > 0) {
    result = result + 1;
    a = a >> 1;
  }
  return result;
}


x86 assembly (clang, -O0):
<ceil_log2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
jne    1129 <ceil_log2+0x29>
movl   $0xffffffff,-0x8(%rbp)
jmp    112e <ceil_log2+0x2e>
cmpl   $0x0,-0x4(%rbp)
jle    114f <ceil_log2+0x4f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112e <ceil_log2+0x2e>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil_log2>:
lea    -0x1(%rdi),%eax
and    %edi,%eax
cmp    $0x1,%eax
sbb    %eax,%eax
test   %edi,%edi
jle    111c <ceil_log2+0x1c>
mov    %edi,%ecx
add    $0x1,%eax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <ceil_log2+0x10>
ret

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

LLVM IR (-O2):
define i32 @ceil_log2(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
%3 = icmp ult i32 %2, 2
%4 = sext i1 %3 to i32
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %12
6: ; preds = %1, %6
%7 = phi i32 [ %9, %6 ], [ %4, %1 ]
%8 = phi i32 [ %10, %6 ], [ %0, %1 ]
%9 = add nsw i32 %7, 1
%10 = lshr i32 %8, 1
%11 = icmp ult i32 %8, 2
br i1 %11, label %12, label %6
12: ; preds = %6, %1
%13 = phi i32 [ %4, %1 ], [ %9, %6 ]
ret i32 %13
}
/* Variables and functions */
int argv_length(char **argv) {
  int i = 0;
  while (argv[i] != NULL)
    i++;
  return i;
}


x86 assembly (clang, -O0):
<argv_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1130 <argv_length+0x30>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <argv_length+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @argv_length(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
int main() {
  g$$1();
  h$$1();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <g$$1@plt>
mov    $0x0,%al
call   1030 <h$$1@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @"g$$1"()
%2 = call i32 (...) @"h$$1"()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @"g$$1"()
%2 = tail call i32 (...) @"h$$1"()
ret i32 0
}
/* Variables and functions */
int clip(int, int /*<<< orphan*/, int);
int FinalAlphaValue(int alpha) {
  alpha = 255 - alpha;
  return clip(alpha, 0, 255);
}


x86 assembly (clang, -O0):
<FinalAlphaValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xff,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
mov    $0xff,%edx
call   1030 <clip@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FinalAlphaValue>:
mov    $0xff,%eax
sub    %edi,%eax
mov    %eax,%edi
xor    %esi,%esi
mov    $0xff,%edx
jmp    1030 <clip@plt>

LLVM IR (-O0):
define i32 @FinalAlphaValue(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 255, %3
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @clip(i32 %5, i32 0, i32 255)
ret i32 %6
}

LLVM IR (-O2):
define i32 @FinalAlphaValue(i32 %0) {
%2 = sub nsw i32 255, %0
%3 = tail call i32 @clip(i32 %2, i32 0, i32 255)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ hal_assert();
int /*<<< orphan*/ hal_uart_putstr(char *);
void hal_default_reset_hdlr(void) {
  hal_uart_putstr("RESET ! \n");
  hal_assert();
}


x86 assembly (clang, -O0):
<hal_default_reset_hdlr>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <hal_uart_putstr@plt>
mov    $0x0,%al
call   1040 <hal_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hal_default_reset_hdlr>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <hal_uart_putstr@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <hal_assert@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"RESET ! \0A\00"
define void @hal_default_reset_hdlr() {
%1 = call i32 @hal_uart_putstr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @hal_assert()
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"RESET ! \0A\00"
define void @hal_default_reset_hdlr() {
%1 = tail call i32 @hal_uart_putstr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @hal_assert()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ newline();
int /*<<< orphan*/ output_with_tab(char *);
void gen_jump_case(void) {
  output_with_tab("jp cccase");
  newline();
}


x86 assembly (clang, -O0):
<gen_jump_case>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <output_with_tab@plt>
mov    $0x0,%al
call   1030 <newline@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_jump_case>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <output_with_tab@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <newline@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"jp cccase\00"
define void @gen_jump_case() {
%1 = call i32 @output_with_tab(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @newline()
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"jp cccase\00"
define void @gen_jump_case() {
%1 = tail call i32 @output_with_tab(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @newline()
ret void
}
OP(dd, aa) { op_aa(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_aa()
ret i32 undef
}
int islittleendian(void) {
  union {
    char c[2];
    short s;
  } u;
  u.s = 0x1;
  return u.c[0] == '\1';
}


x86 assembly (clang, -O0):
<islittleendian>:
push   %rbp
mov    %rsp,%rbp
movw   $0x1,-0x8(%rbp)
movsbl -0x8(%rbp),%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i16 }
define i32 @islittleendian() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to i16*
store i16 1, i16* %2
%3 = bitcast %union.anon* %1 to [2 x i8]*
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @islittleendian() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char);
void inicial(void *l1, void *l2) {
  char a = *((char *)l1);
  char b = *((char *)l2);
  printf("Hola soy %c, pero llamame %c\n", a, b);
}


x86 assembly (clang, -O0):
<inicial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x12(%rbp)
mov    -0x11(%rbp),%al
lea    0xec4(%rip),%rdi
movsbl %al,%esi
movsbl -0x12(%rbp),%edx
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inicial>:
movsbl (%rdi),%eax
movsbl (%rsi),%edx
lea    0xee3(%rip),%rdi
mov    %eax,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Hola soy %c, pero llamame %c\0A\00"
define void @inicial(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
store i8 %8, i8* %5
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
store i8 %10, i8* %6
%11 = load i8, i8* %5
%12 = load i8, i8* %6
%13 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 signext %11, i8 signext %12)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Hola soy %c, pero llamame %c\0A\00"
define void @inicial(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 signext %3, i8 signext %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ io_shift_cell_cursor(int, int);
void shift_cell_cursor(int dir, int repeat) {
  io_shift_cell_cursor(dir, repeat);
}


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

x86 assembly (clang, -O2):
<shift_cell_cursor>:
jmp    1030 <io_shift_cell_cursor@plt>

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

LLVM IR (-O2):
define void @shift_cell_cursor(i32 %0, i32 %1) {
%3 = tail call i32 @io_shift_cell_cursor(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
double cos(double);
int /*<<< orphan*/ getNumber(double *);
double coseno(double a) {
  getNumber(&a);
  return cos(a);
}


x86 assembly (clang, -O0):
<coseno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <getNumber@plt>
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coseno>:
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <getNumber@plt>
movsd  (%rsp),%xmm0
call   1040 <cos@plt>
pop    %rax
ret

LLVM IR (-O0):
define double @coseno(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i32 @getNumber(double* %2)
%4 = load double, double* %2
%5 = call double @cos(double %4)
ret double %5
}

LLVM IR (-O2):
define double @coseno(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i32 @getNumber(double* %2)
%4 = load double, double* %2
%5 = call double @cos(double %4)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *prog) {
  fprintf(stderr,
          "usage: %s [-"
          "a"
          "] file\n",
          prog);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"usage: %s [-a] file\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"usage: %s [-a] file\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int fread(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int heaven(char *buf, int bytes_to_read) {
  printf("Reading %d bytes...\n", bytes_to_read);
  return fread(buf, 1, bytes_to_read, stdin);
}


x86 assembly (clang, -O0):
<heaven>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    0x2e9c(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1030 <fread@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heaven>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fread@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Reading %d bytes...\0A\00"
@stdin = global i32 0
define i32 @heaven(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = load i32, i32* @stdin
%10 = call i32 @fread(i8* %7, i32 1, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
@.str = [21 x i8] c"Reading %d bytes...\0A\00"
@stdin = global i32 0
define i32 @heaven(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = load i32, i32* @stdin
%5 = tail call i32 @fread(i8* %0, i32 1, i32 %1, i32 %4)
ret i32 %5
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
scalar_t__ get_ticks();
int /*<<< orphan*/ update_timing(scalar_t__);
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  for (int i = 0; i < 128; i++) {
    uint64_t __timing_start__ = get_ticks();
    usleep(10000);
    uint64_t __timing_stop__ = get_ticks();
    update_timing(__timing_stop__ - __timing_start__);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x80,-0x14(%rbp)
jge    1195 <main+0x65>
mov    $0x0,%al
call   1040 <get_ticks@plt>
mov    %rax,-0x20(%rbp)
mov    $0x2710,%edi
call   1050 <usleep@plt>
mov    $0x0,%al
call   1040 <get_ticks@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
sub    -0x20(%rbp),%rdi
call   1030 <update_timing@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x80,%ebp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <get_ticks@plt>
mov    %rax,%rbx
mov    $0x2710,%edi
call   1050 <usleep@plt>
xor    %eax,%eax
call   1040 <get_ticks@plt>
sub    %rbx,%rax
mov    %rax,%rdi
call   1030 <update_timing@plt>
add    $0xffffffff,%ebp
jne    1140 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %9
9: ; preds = %20, %2
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 128
br i1 %11, label %12, label %23
12: ; preds = %9
%13 = call i64 (...) @get_ticks()
store i64 %13, i64* %7
%14 = call i32 @usleep(i32 10000)
%15 = call i64 (...) @get_ticks()
store i64 %15, i64* %8
%16 = load i64, i64* %8
%17 = load i64, i64* %7
%18 = sub nsw i64 %16, %17
%19 = call i32 @update_timing(i64 %18)
br label %20
20: ; preds = %12
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %9
23: ; preds = %9
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %4
3: ; preds = %4
ret i32 0
4: ; preds = %2, %4
%5 = phi i32 [ 0, %2 ], [ %11, %4 ]
%6 = tail call i64 (...) @get_ticks()
%7 = tail call i32 @usleep(i32 10000)
%8 = tail call i64 (...) @get_ticks()
%9 = sub nsw i64 %8, %6
%10 = tail call i32 @update_timing(i64 %9)
%11 = add nuw nsw i32 %5, 1
%12 = icmp eq i32 %11, 128
br i1 %12, label %3, label %4
}
/* Variables and functions */
int /*<<< orphan*/ die(char *, int);
int has_partitions(int);
int is_primary(int device) {
  int mask;
  mask = has_partitions(device);
  if (!mask)
    die("is_primary:  Not a valid device  0x%04X", device);
  mask = device & ~mask;
  return (mask && mask <= 4);
}


x86 assembly (clang, -O0):
<is_primary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <has_partitions@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    114f <is_primary+0x2f>
mov    -0x4(%rbp),%esi
lea    0xeb6(%rip),%rdi
call   1030 <die@plt>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1176 <is_primary+0x56>
cmpl   $0x4,-0x8(%rbp)
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_primary>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1040 <has_partitions@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    113e <is_primary+0x1e>
lea    0xec9(%rip),%rdi
mov    %ebx,%esi
call   1030 <die@plt>
not    %ebp
and    %ebx,%ebp
setne  %al
cmp    $0x5,%ebp
setl   %cl
and    %al,%cl
movzbl %cl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"is_primary: Not a valid device 0x%04X\00"
define i32 @is_primary(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @has_partitions(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 @die(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %8, %1
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = xor i32 %13, -1
%15 = and i32 %12, %14
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %11
%19 = load i32, i32* %3
%20 = icmp sle i32 %19, 4
br label %21
21: ; preds = %18, %11
%22 = phi i1 [ false, %11 ], [ %20, %18 ]
%23 = zext i1 %22 to i32
ret i32 %23
}

LLVM IR (-O2):
@.str = [40 x i8] c"is_primary: Not a valid device 0x%04X\00"
define i32 @is_primary(i32 %0) {
%2 = tail call i32 @has_partitions(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @die(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %4, %1
%7 = xor i32 %2, -1
%8 = and i32 %7, %0
%9 = icmp ne i32 %8, 0
%10 = icmp slt i32 %8, 5
%11 = and i1 %9, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
int test_imm_5Fint8_reg(signed char val) {
  return ((val) & (0x5F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_5Fint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 95
%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_5Fint8_reg(i8 signext %0) {
%2 = and i8 %0, 95
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  unsigned char a, b;
  int result = 0, i;
  for (i = 0; i < 8; i++)
    if ((b >> i) & 1)
      result += (a << i);
  assert(result == a * b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    116e <main+0x5e>
movzbl -0x6(%rbp),%eax
mov    -0x10(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     115b <main+0x4b>
movzbl -0x5(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    %cl,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1160 <main+0x50>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%eax
movzbl -0x5(%rbp),%ecx
movzbl -0x6(%rbp),%edx
imul   %edx,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %24, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 8
br i1 %8, label %9, label %27
9: ; preds = %6
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = load i32, i32* %5
%13 = ashr i32 %11, %12
%14 = and i32 %13, 1
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %9
%17 = load i8, i8* %2
%18 = zext i8 %17 to i32
%19 = load i32, i32* %5
%20 = shl i32 %18, %19
%21 = load i32, i32* %4
%22 = add nsw i32 %21, %20
store i32 %22, i32* %4
br label %23
23: ; preds = %16, %9
br label %24
24: ; preds = %23
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %6
27: ; preds = %6
%28 = load i32, i32* %4
%29 = load i8, i8* %2
%30 = zext i8 %29 to i32
%31 = load i8, i8* %3
%32 = zext i8 %31 to i32
%33 = mul nsw i32 %30, %32
%34 = icmp eq i32 %28, %33
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int atoi(char *);
int main() {
  int i = atoi("1");
  (void)i;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void sol_ptr_vector_update(struct sol_ptr_vector *to,
                           struct sol_ptr_vector *from) {}


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

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

LLVM IR (-O0):
%struct.sol_ptr_vector = type opaque
define void @sol_ptr_vector_update(%struct.sol_ptr_vector* %0, %struct.sol_ptr_vector* %1) {
%3 = alloca %struct.sol_ptr_vector*
%4 = alloca %struct.sol_ptr_vector*
store %struct.sol_ptr_vector* %0, %struct.sol_ptr_vector** %3
store %struct.sol_ptr_vector* %1, %struct.sol_ptr_vector** %4
ret void
}

LLVM IR (-O2):
%struct.sol_ptr_vector = type opaque
define void @sol_ptr_vector_update(%struct.sol_ptr_vector* nocapture %0, %struct.sol_ptr_vector* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, int);
int /*<<< orphan*/ stderr;
void *lsd_nomem_error(char *file, int line, char *mesg) {
  fprintf(stderr, "out of memory: %s: %s::%d", mesg, file, line);
  exit(1);
}


x86 assembly (clang, -O0):
<lsd_nomem_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r8d
lea    0xeb1(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<lsd_nomem_error>:
push   %rax
mov    %esi,%r8d
mov    %rdi,%rcx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"out of memory: %s: %s::%d\00"
define i8* @lsd_nomem_error(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %6
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9, i32 %10)
%12 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"out of memory: %s: %s::%d\00"
define noalias i8* @lsd_nomem_error(i8* %0, i32 %1, i8* %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %0, i32 %1)
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
bool isPrime(int x) {
  int i;
  for (i = 2; i <= x / 2; i++) {
    if (x % i == 0)
      return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     115b <isPrime+0x5b>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1148 <isPrime+0x48>
movl   $0x0,-0x4(%rbp)
jmp    1162 <isPrime+0x62>
jmp    114d <isPrime+0x4d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <isPrime+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
mov    $0x1,%r8d
cmp    $0x4,%edi
jl     1137 <isPrime+0x37>
mov    %edi,%esi
shr    %esi
neg    %esi
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     113b <isPrime+0x3b>
lea    (%rsi,%rcx,1),%eax
add    $0x1,%eax
add    $0x1,%ecx
cmp    $0x1,%eax
jne    1120 <isPrime+0x20>
mov    %r8d,%eax
ret
xor    %r8d,%r8d
mov    %r8d,%eax
ret

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

LLVM IR (-O2):
define i32 @isPrime(i32 %0) {
%2 = icmp slt i32 %0, 4
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = lshr i32 %0, 1
br label %8
5: ; preds = %8
%6 = add nuw nsw i32 %9, 1
%7 = icmp eq i32 %9, %4
br i1 %7, label %12, label %8
8: ; preds = %3, %5
%9 = phi i32 [ %6, %5 ], [ 2, %3 ]
%10 = srem i32 %0, %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %8, %5, %1
%13 = phi i32 [ 1, %1 ], [ 1, %5 ], [ 0, %8 ]
ret i32 %13
}