xunge/DecIR huggingface dataset:
/* Variables and functions */
double atof(char *);
int /*<<< orphan*/ printf(char *, double);
scalar_t__ readline(char *, int);
int main() {
  double sum;
  char line[100];
  while (readline(line, 100) > 0) {
    printf("\t%g\n", sum += atof(line));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x64,%esi
call   1050 <readline@plt>
cmp    $0x0,%rax
jle    117e <main+0x4e>
lea    -0x80(%rbp),%rdi
call   1030 <atof@plt>
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
call   1050 <readline@plt>
test   %rax,%rax
jle    1196 <main+0x66>
lea    0x10(%rsp),%rbx
lea    0xea9(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <atof@plt>
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
mov    %r14,%rdi
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <readline@plt>
test   %rax,%rax
jg     1160 <main+0x30>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\09%g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca [100 x i8]
store i32 0, i32* %1
br label %4
4: ; preds = %8, %0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = call i64 @readline(i8* %5, i32 100)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = call double @atof(i8* %9)
%11 = load double, double* %2
%12 = fadd double %11, %10
store double %12, double* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %12)
br label %4
14: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"\09%g\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i64 @readline(i8* %2, i32 100)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %0, %5
%6 = phi double [ %8, %5 ], [ undef, %0 ]
%7 = call double @atof(i8* %2)
%8 = fadd double %6, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %8)
%10 = call i64 @readline(i8* %2, i32 100)
%11 = icmp sgt i64 %10, 0
br i1 %11, label %5, label %12
12: ; preds = %5, %0
ret i32 0
}
void cli() { __asm("cli" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @cli() {
tail call void asm sideeffect "cli", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void func5(void) { printf("Hello from func5.c\n"); }


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

x86 assembly (clang, -O2):
<func5>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Hello from func5.c\0A\00"
define void @func5() {
%1 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"Hello from func5.c\00"
define void @func5() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("It works!\n");
  return EXIT_SUCCESS;
}


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

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

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [10 x i8] c"It works!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
/* Variables and functions */
int f441(int *);
int f442(int *p) { return f441(p); }


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

x86 assembly (clang, -O2):
<f442>:
jmp    1030 <f441@plt>

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

LLVM IR (-O2):
define i32 @f442(i32* %0) {
%2 = tail call i32 @f441(i32* %0)
ret i32 %2
}
int test_imm_00uint16_reg(unsigned short val) {
  return ((val) & (0x00 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x0,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0xffffffd8,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_00uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 0
%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_00uint16_reg(i16 zeroext %0) {
ret i32 -40
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ set_brightness(int /*<<< orphan*/ *, int /*<<< orphan*/);
void set_led(uint8_t *data, uint8_t brightness, uint8_t r, uint8_t g,
             uint8_t b) {
  set_brightness(data, brightness);
  data[3] = r;
  data[2] = g;
  data[1] = b;
}


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

x86 assembly (clang, -O2):
<set_led>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%ebx
mov    %rdi,%rbp
call   1030 <set_brightness@plt>
mov    %ebx,0xc(%rbp)
mov    %r15d,0x8(%rbp)
mov    %r14d,0x4(%rbp)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @set_led(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = call i32 @set_brightness(i32* %11, i32 %12)
%14 = load i32, i32* %8
%15 = load i32*, i32** %6
%16 = getelementptr inbounds i32, i32* %15, i64 3
store i32 %14, i32* %16
%17 = load i32, i32* %9
%18 = load i32*, i32** %6
%19 = getelementptr inbounds i32, i32* %18, i64 2
store i32 %17, i32* %19
%20 = load i32, i32* %10
%21 = load i32*, i32** %6
%22 = getelementptr inbounds i32, i32* %21, i64 1
store i32 %20, i32* %22
ret void
}

LLVM IR (-O2):
define void @set_led(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @set_brightness(i32* %0, i32 %1)
%7 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %2, i32* %7
%8 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %3, i32* %8
%9 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %4, i32* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
void inthandler(int s) {
  printf("Called with signal %d\n", s);
  sleep(s);
  printf("done handlinnng signal %d\n", s);
}


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

x86 assembly (clang, -O2):
<inthandler>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <sleep@plt>
lea    0xed8(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Called with signal %d\0A\00"
@.str.1 = [27 x i8] c"done handlinnng signal %d\0A\00"
define void @inthandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @sleep(i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Called with signal %d\0A\00"
@.str.1 = [27 x i8] c"done handlinnng signal %d\0A\00"
define void @inthandler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @sleep(i32 %0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int seq_utils_clamp(scalar_t__, int, int);
scalar_t__ song_get_metronome_sound_len();
int /*<<< orphan*/ song_set_metronome_sound_len(int);
void seq_ctrl_adjust_metronome_sound_len(int change) {
  int val = seq_utils_clamp(song_get_metronome_sound_len() + change, 5, 160);
  song_set_metronome_sound_len(val);
}


x86 assembly (clang, -O0):
<seq_ctrl_adjust_metronome_sound_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <song_get_metronome_sound_len@plt>
mov    %rax,%rdi
movslq -0x4(%rbp),%rax
add    %rax,%rdi
mov    $0x5,%esi
mov    $0xa0,%edx
call   1050 <seq_utils_clamp@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <song_set_metronome_sound_len@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seq_ctrl_adjust_metronome_sound_len>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <song_get_metronome_sound_len@plt>
movslq %ebx,%rdi
add    %rax,%rdi
mov    $0x5,%esi
mov    $0xa0,%edx
call   1050 <seq_utils_clamp@plt>
mov    %eax,%edi
pop    %rbx
jmp    1030 <song_set_metronome_sound_len@plt>

LLVM IR (-O0):
define void @seq_ctrl_adjust_metronome_sound_len(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i64 (...) @song_get_metronome_sound_len()
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = add nsw i64 %4, %6
%8 = call i32 @seq_utils_clamp(i64 %7, i32 5, i32 160)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @song_set_metronome_sound_len(i32 %9)
ret void
}

LLVM IR (-O2):
define void @seq_ctrl_adjust_metronome_sound_len(i32 %0) {
%2 = tail call i64 (...) @song_get_metronome_sound_len()
%3 = sext i32 %0 to i64
%4 = add nsw i64 %2, %3
%5 = tail call i32 @seq_utils_clamp(i64 %4, i32 5, i32 160)
%6 = tail call i32 @song_set_metronome_sound_len(i32 %5)
ret void
}
unsigned long SIO1readData32(void) { return 0; }


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

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

LLVM IR (-O0):
define i64 @SIO1readData32() {
ret i64 0
}

LLVM IR (-O2):
define i64 @SIO1readData32() {
ret i64 0
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ long_to_timespec(int, struct timespec *);
int const timespec_to_long(struct timespec const *);
void multiply_timespec(const struct timespec *t, const uint32_t i,
                       struct timespec *result) {
  uint64_t result_nsec = i * timespec_to_long(t);
  long_to_timespec(result_nsec, result);
}


x86 assembly (clang, -O0):
<multiply_timespec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <timespec_to_long@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <long_to_timespec@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply_timespec>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%ebp
call   1030 <timespec_to_long@plt>
imul   %eax,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <long_to_timespec@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
define void @multiply_timespec(%struct.timespec* %0, i32 %1, %struct.timespec* %2) {
%4 = alloca %struct.timespec*
%5 = alloca i32
%6 = alloca %struct.timespec*
%7 = alloca i32
store %struct.timespec* %0, %struct.timespec** %4
store i32 %1, i32* %5
store %struct.timespec* %2, %struct.timespec** %6
%8 = load i32, i32* %5
%9 = load %struct.timespec*, %struct.timespec** %4
%10 = call i32 @timespec_to_long(%struct.timespec* %9)
%11 = mul nsw i32 %8, %10
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = load %struct.timespec*, %struct.timespec** %6
%14 = call i32 @long_to_timespec(i32 %12, %struct.timespec* %13)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define void @multiply_timespec(%struct.timespec* %0, i32 %1, %struct.timespec* %2) {
%4 = tail call i32 @timespec_to_long(%struct.timespec* %0)
%5 = mul nsw i32 %4, %1
%6 = tail call i32 @long_to_timespec(i32 %5, %struct.timespec* %2)
ret void
}
void fix_validate(void) {}


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

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

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

LLVM IR (-O2):
define void @fix_validate() {
ret void
}
/* Variables and functions */
int SortNFind(int *, int, int *, int);
int /*<<< orphan*/ printf(char *, int);
main() {
  int a[] = {1, 3, 15, 12, 2};
  int b[] = {23, 127, 235, 19, 9, 200};
  int s;
  s = SortNFind(a, 5, b, 6);
  printf("smallest=%d\n", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xed2(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xecf(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xecc(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rdx
mov    $0x5,%esi
mov    $0x6,%ecx
call   1040 <SortNFind@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0xef0(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rsp,%rdi
lea    0x20(%rsp),%rdx
mov    $0x5,%esi
mov    $0x6,%ecx
call   1040 <SortNFind@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [5 x i32] [i32 1, i32 3, i32 15, i32 12, i32 2]
@__const.main.b = [6 x i32] [i32 23, i32 127, i32 235, i32 19, i32 9, i32 200]
@.str = [13 x i8] c"smallest=%d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [6 x i32]
%3 = alloca i32
%4 = bitcast [5 x i32]* %1 to i8*
%5 = bitcast [6 x i32]* %2 to i8*
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%8 = call i32 @SortNFind(i32* %6, i32 5, i32* %7, i32 6)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [5 x i32] [i32 1, i32 3, i32 15, i32 12, i32 2]
@__const.main.b = [6 x i32] [i32 23, i32 127, i32 235, i32 19, i32 9, i32 200]
@.str = [13 x i8] c"smallest=%d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [6 x i32]
%3 = bitcast [5 x i32]* %1 to i8*
%4 = bitcast [6 x i32]* %2 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%7 = call i32 @SortNFind(i32* %5, i32 5, i32* %6, i32 6)
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
int vip_chip_id_read(void) {
  volatile unsigned int chipid = 0;
  unsigned int reg_addr = 0;
  reg_addr = (0xA0 << 24);
  reg_addr = reg_addr | (0x30 << 16);
  reg_addr = reg_addr | (0xA0 << 8);
  reg_addr = reg_addr | 0x180;
  chipid = (*(volatile unsigned int *)(reg_addr) >> 16) & 3;
  return chipid;
}


x86 assembly (clang, -O0):
<vip_chip_id_read>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xa0000000,-0x8(%rbp)
mov    -0x8(%rbp),%eax
or     $0x300000,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
or     $0xa000,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
or     $0x180,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    (%rax),%eax
shr    $0x10,%eax
and    $0x3,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vip_chip_id_read>:
movl   $0x0,-0x4(%rsp)
mov    $0xa030a180,%eax
mov    (%rax),%eax
shr    $0x10,%eax
and    $0x3,%eax
mov    %eax,-0x4(%rsp)
mov    -0x4(%rsp),%eax
ret

LLVM IR (-O0):
define i32 @vip_chip_id_read() {
%1 = alloca i32
%2 = alloca i32
store volatile i32 0, i32* %1
store i32 0, i32* %2
store i32 -1610612736, i32* %2
%3 = load i32, i32* %2
%4 = or i32 %3, 3145728
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = or i32 %5, 40960
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = or i32 %7, 384
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = lshr i32 %12, 16
%14 = and i32 %13, 3
store volatile i32 %14, i32* %1
%15 = load volatile i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
define i32 @vip_chip_id_read() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
%3 = load volatile i32, i32* inttoptr (i64 2687541632 to i32*)
%4 = lshr i32 %3, 16
%5 = and i32 %4, 3
store volatile i32 %5, i32* %1
%6 = load volatile i32, i32* %1
ret i32 %6
}
/* Variables and functions */
int s_bar();
int secure4(void) { return s_bar(); }


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

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

LLVM IR (-O0):
define i32 @secure4() {
%1 = call i32 (...) @s_bar()
ret i32 %1
}

LLVM IR (-O2):
define i32 @secure4() {
%1 = tail call i32 (...) @s_bar()
ret i32 %1
}
/* Type definitions */
struct timespec {
  int /*<<< orphan*/ member_1;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
struct timespec get_time(void) {
  struct timespec t = {0, 0};
  clock_gettime(CLOCK_MONOTONIC, &t);
  return t;
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
push   %rax
movq   $0x0,(%rsp)
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i64 @get_time() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = bitcast %struct.timespec* %1 to i64*
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i64 @get_time() {
%1 = alloca i64
%2 = bitcast i64* %1 to %struct.timespec*
store i64 0, i64* %1
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %2)
%5 = load i64, i64* %1
ret i64 %5
}
double double_crash(double a, double b) {
  double *c;
  *c = a + b;
  return *c;
}


x86 assembly (clang, -O0):
<double_crash>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define double @double_crash(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double*
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fadd double %6, %7
%9 = load double*, double** %5
store double %8, double* %9
%10 = load double*, double** %5
%11 = load double, double* %10
ret double %11
}

LLVM IR (-O2):
char *mystrchrnul(char *str, char ch) {
  while (*str) {
    if (*str == ch)
      return str;
    *str++;
  }
  return str;
}


x86 assembly (clang, -O0):
<mystrchrnul>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114c <mystrchrnul+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    113b <mystrchrnul+0x3b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1154 <mystrchrnul+0x54>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110e <mystrchrnul+0xe>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrchrnul>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     1121 <mystrchrnul+0x21>
cmp    %sil,%cl
jne    1110 <mystrchrnul+0x10>
ret

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

LLVM IR (-O2):
define i8* @mystrchrnul(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %9, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = icmp eq i8 %5, %1
%8 = or i1 %6, %7
%9 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %8, label %10, label %3
10: ; preds = %3
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void pqr_old(void) { printf("v2 pqr\n"); }


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

x86 assembly (clang, -O2):
<pqr_old>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"v2 pqr\0A\00"
define void @pqr_old() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"v2 pqr\00"
define void @pqr_old() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
int fun882() { return 882; }


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

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

LLVM IR (-O0):
define i32 @fun882() {
ret i32 882
}

LLVM IR (-O2):
define i32 @fun882() {
ret i32 882
}
/* Variables and functions */
int /*<<< orphan*/ output(char);
void clean() { output(' '); }


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

x86 assembly (clang, -O2):
<clean>:
mov    $0x20,%edi
jmp    1030 <output@plt>

LLVM IR (-O0):
define void @clean() {
%1 = call i32 @output(i8 signext 32)
ret void
}

LLVM IR (-O2):
define void @clean() {
%1 = tail call i32 @output(i8 signext 32)
ret void
}
void incr_a(char a) {
  int b;
  b = a;
}


x86 assembly (clang, -O0):
<incr_a>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @incr_a(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
store i32 %5, i32* %3
ret void
}

LLVM IR (-O2):
define void @incr_a(i8 signext %0) {
ret void
}
char *ltrim_string(char *str) {
  while (*str++ == ' ')
    ;
  if (*str == '\t')
    while (*str++ == '\t')
      if (*str != '\t')
        break;
  return str;
}


x86 assembly (clang, -O0):
<ltrim_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1128 <ltrim_string+0x28>
jmp    1108 <ltrim_string+0x8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
jne    1177 <ltrim_string+0x77>
jmp    113d <ltrim_string+0x3d>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x9,%eax
jne    1172 <ltrim_string+0x72>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
je     116d <ltrim_string+0x6d>
jmp    1172 <ltrim_string+0x72>
jmp    113d <ltrim_string+0x3d>
jmp    1177 <ltrim_string+0x77>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltrim_string>:
cmpb   $0x20,(%rdi)
lea    0x1(%rdi),%rdi
je     1100 <ltrim_string>
cmpb   $0x9,(%rdi)
jne    111e <ltrim_string+0x1e>
xchg   %ax,%ax
lea    0x1(%rdi),%rax
cmpb   $0x9,0x1(%rdi)
mov    %rax,%rdi
je     1110 <ltrim_string+0x10>
ret
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @ltrim_string(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 32
br i1 %6, label %2, label %7
7: ; preds = %2
%8 = load i8, i8* %4
%9 = icmp eq i8 %8, 9
br i1 %9, label %10, label %15
10: ; preds = %7, %10
%11 = phi i8* [ %12, %10 ], [ %4, %7 ]
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 9
br i1 %14, label %10, label %15
15: ; preds = %10, %7
%16 = phi i8* [ %4, %7 ], [ %12, %10 ]
ret i8* %16
}
/* Variables and functions */
int printf(char *);
void print_open_line_box(int *i) { *i = printf("        | "); }


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

x86 assembly (clang, -O2):
<print_open_line_box>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c" | \00"
define void @print_open_line_box(i32* nocapture writeonly %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ receiveMessages();
int /*<<< orphan*/ sleep(int);
int main(void) {
  receiveMessages();
  int i = 100;
  while (i > 0) {
    sleep(1);
    i--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <receiveMessages@plt>
movl   $0x64,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    115f <main+0x3f>
mov    $0x1,%edi
call   1030 <sleep@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <receiveMessages@plt>
mov    $0x65,%ebx
nopl   (%rax)
mov    $0x1,%edi
call   1030 <sleep@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1130 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @receiveMessages()
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 100, %0 ], [ %5, %2 ]
%4 = tail call i32 @sleep(i32 1)
%5 = add nsw i32 %3, -1
%6 = icmp ugt i32 %3, 1
br i1 %6, label %2, label %7
7: ; preds = %2
ret i32 0
}
int to_bcd(int val) {
  register int i = 0;
  while (val >= 10) {
    i += val / 10;
    i <<= 4;
    val %= 10;
  }
  i += val;
  return (i);
}


x86 assembly (clang, -O0):
<to_bcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x4(%rbp)
jl     1145 <to_bcd+0x45>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
jmp    110e <to_bcd+0xe>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_bcd>:
mov    %edi,%eax
xor    %ecx,%ecx
cmp    $0xa,%edi
jl     1123 <to_bcd+0x23>
mov    %eax,%edx
mov    $0xcccccccd,%ecx
imul   %rdx,%rcx
shr    $0x23,%rcx
lea    (%rcx,%rcx,1),%edx
lea    (%rdx,%rdx,4),%edx
shl    $0x4,%ecx
sub    %edx,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @to_bcd(i32 %0) {
%2 = icmp sgt i32 %0, 9
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = udiv i32 %0, 10
%5 = mul nsw i32 %4, -10
%6 = shl nuw i32 %4, 4
%7 = add nsw i32 %5, %0
br label %8
8: ; preds = %3, %1
%9 = phi i32 [ %0, %1 ], [ %7, %3 ]
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
%11 = add nsw i32 %10, %9
ret i32 %11
}
void gtk_container_set_resize_mode() {}


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

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

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

LLVM IR (-O2):
define void @gtk_container_set_resize_mode() {
ret void
}
unsigned int _check_times(unsigned x, unsigned y) {
  unsigned long long whole_ans =
      ((unsigned long long)x) * ((unsigned long long)y);
  unsigned word_ans = (unsigned)whole_ans;
  if (word_ans < whole_ans || word_ans > (1 << 28))
    (_throw_badalloc_fn(
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/"
        "genfiles/boot_cycstubs.c",
        284));
  return word_ans;
}


x86 assembly (clang, -O0):
<_check_times>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%rax
jb     114d <_check_times+0x3d>
cmpl   $0x10000000,-0x14(%rbp)
jbe    1160 <_check_times+0x50>
lea    0xeac(%rip),%rdi
mov    $0x11c,%esi
mov    $0x0,%al
call   1030 <_throw_badalloc_fn@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_times>:
push   %rbx
mov    %edi,%eax
mul    %esi
mov    %eax,%ebx
jo     1121 <_check_times+0x11>
cmp    $0x10000001,%ebx
jb     1134 <_check_times+0x24>
lea    0xed8(%rip),%rdi
mov    $0x11c,%esi
xor    %eax,%eax
call   1030 <_throw_badalloc_fn@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/boot_cycstubs.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = mul i64 %8, %10
store i64 %11, i64* %5
%12 = load i64, i64* %5
%13 = trunc i64 %12 to i32
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = zext i32 %14 to i64
%16 = load i64, i64* %5
%17 = icmp ult i64 %15, %16
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = load i32, i32* %6
%20 = icmp ugt i32 %19, 268435456
br i1 %20, label %21, label %23
21: ; preds = %18, %2
%22 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 284)
br label %23
23: ; preds = %21, %18
%24 = load i32, i32* %6
ret i32 %24
}

LLVM IR (-O2):
@.str = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/boot_cycstubs.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = tail call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %0, i32 %1)
%4 = extractvalue { i32, i1 } %3, 0
%5 = extractvalue { i32, i1 } %3, 1
%6 = icmp ugt i32 %4, 268435456
%7 = or i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 284)
br label %10
10: ; preds = %2, %8
ret i32 %4
}
/* Variables and functions */
int EOF;
int ncss_Getchar();
int findchar(char fc) {
  int c;
  while ((c = ncss_Getchar()) != EOF && c != fc) {
  }
  return c;
}


x86 assembly (clang, -O0):
<findchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1030 <ncss_Getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
mov    0x2eb5(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x9(%rbp)
je     114d <findchar+0x3d>
mov    -0x8(%rbp),%eax
movsbl -0x1(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    115d <findchar+0x4d>
jmp    1162 <findchar+0x52>
jmp    111e <findchar+0xe>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findchar>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ecb(%rip),%r14
nopl   (%rax)
xor    %eax,%eax
call   1030 <ncss_Getchar@plt>
cmp    %ebx,%eax
je     1130 <findchar+0x20>
cmp    (%r14),%eax
jne    1120 <findchar+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @findchar(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
br label %4
4: ; preds = %15, %1
%5 = call i32 (...) @ncss_Getchar()
store i32 %5, i32* %3
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = load i32, i32* %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %9, %11
br label %13
13: ; preds = %8, %4
%14 = phi i1 [ false, %4 ], [ %12, %8 ]
br i1 %14, label %15, label %16
15: ; preds = %13
br label %4
16: ; preds = %13
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @findchar(i8 signext %0) {
%2 = sext i8 %0 to i32
br label %3
3: ; preds = %3, %1
%4 = tail call i32 (...) @ncss_Getchar()
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
%7 = icmp ne i32 %4, %2
%8 = and i1 %7, %6
br i1 %8, label %3, label %9
9: ; preds = %3
ret i32 %4
}
/* Variables and functions */
int *malloc(int);
int *intdup(const int i) {
  int *ret;
  if ((ret = malloc(sizeof(int))) == NULL) {
    return NULL;
  }
  (*ret) = i;
  return ret;
}


x86 assembly (clang, -O0):
<intdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1140 <intdup+0x30>
movq   $0x0,-0x8(%rbp)
jmp    1151 <intdup+0x41>
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intdup>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
call   1030 <malloc@plt>
test   %rax,%rax
je     1124 <intdup+0x14>
mov    %ebx,(%rax)
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i32* @intdup(i32 %0) {
%2 = tail call i32* @malloc(i32 4)
%3 = icmp eq i32* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i32 %0, i32* %2
br label %5
5: ; preds = %1, %4
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
void *realloc(void *, long);
void *libaft_realloc(void *p, long size) {
  p = realloc(p, size);
  if (!p) {
    perror("libaft: realloc");
    return 0;
  }
  return p;
}


x86 assembly (clang, -O0):
<libaft_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1165 <libaft_realloc+0x45>
lea    0xead(%rip),%rdi
call   1040 <perror@plt>
movq   $0x0,-0x8(%rbp)
jmp    116d <libaft_realloc+0x4d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libaft_realloc>:
push   %rbx
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1133 <libaft_realloc+0x13>
mov    %rbx,%rax
pop    %rbx
ret
lea    0xec6(%rip),%rdi
call   1040 <perror@plt>
jmp    112e <libaft_realloc+0xe>

LLVM IR (-O0):
@.str = [16 x i8] c"libaft: realloc\00"
define i8* @libaft_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%6 = load i8*, i8** %4
%7 = load i64, i64* %5
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i8* null, i8** %3
br label %15
13: ; preds = %2
%14 = load i8*, i8** %4
store i8* %14, i8** %3
br label %15
15: ; preds = %13, %11
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [16 x i8] c"libaft: realloc\00"
define noalias i8* @libaft_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ InitTestUnit();
int /*<<< orphan*/ ReportTestResult();
int /*<<< orphan*/ RunTest();
int /*<<< orphan*/ SortTestSuite();
int main(int argc, char *argv[]) {
  InitTestUnit();
  SortTestSuite();
  RunTest();
  ReportTestResult();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <InitTestUnit@plt>
mov    $0x0,%al
call   1030 <SortTestSuite@plt>
mov    $0x0,%al
call   1060 <RunTest@plt>
mov    $0x0,%al
call   1040 <ReportTestResult@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <InitTestUnit@plt>
xor    %eax,%eax
call   1030 <SortTestSuite@plt>
xor    %eax,%eax
call   1060 <RunTest@plt>
xor    %eax,%eax
call   1040 <ReportTestResult@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @InitTestUnit()
%7 = call i32 (...) @SortTestSuite()
%8 = call i32 (...) @RunTest()
%9 = call i32 (...) @ReportTestResult()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @InitTestUnit()
%4 = tail call i32 (...) @SortTestSuite()
%5 = tail call i32 (...) @RunTest()
%6 = tail call i32 (...) @ReportTestResult()
ret i32 0
}
int popcount(unsigned int mask) { return __builtin_popcount(mask); }


x86 assembly (clang, -O0):
<popcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%ecx
mov    %ecx,%eax
and    $0x33333333,%eax
shr    $0x2,%ecx
and    $0x33333333,%ecx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<popcount>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
ret

LLVM IR (-O0):
define i32 @popcount(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.ctpop.i32(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @popcount(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("USAGE : G5 -f config_pathfilename [ -r forward_rule_maxcount ] [ -s "
         "forward_connection_maxcount ] [ -b transfer_bufsize ] [ -d ]\r\n");
  printf("           -v\r\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [131 x i8] c"USAGE : G5 -f config_pathfilename [ -r forward_rule_maxcount ] [ -s forward_connection_maxcount ] [ -b transfer_bufsize ] [ -d ]\0D\0A\00"
@.str.1 = [16 x i8] c" -v\0D\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [130 x i8] c"USAGE : G5 -f config_pathfilename [ -r forward_rule_maxcount ] [ -s forward_connection_maxcount ] [ -b transfer_bufsize ] [ -d ]\0D\00"
@str.2 = [15 x i8] c" -v\0D\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([130 x i8], [130 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.2, i64 0, i64 0))
ret void
}
void OBJ_nid2obj(void) {}


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

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

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

LLVM IR (-O2):
define void @OBJ_nid2obj() {
ret void
}
void NDB_PREFETCH_READ(void *addr) { __builtin_prefetch(addr, 0, 3); }


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

x86 assembly (clang, -O2):
<NDB_PREFETCH_READ>:
prefetcht0 (%rdi)
ret

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

LLVM IR (-O2):
define void @NDB_PREFETCH_READ(i8* nocapture %0) {
tail call void @llvm.prefetch.p0i8(i8* %0, i32 0, i32 3, i32 1)
ret void
}
int f_ne_rc2(float a1) { return !(((a1) != (100))); }


x86 assembly (clang, -O0):
<f_ne_rc2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeea(%rip),%xmm1
ucomiss %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_ne_rc2>:
cmpeqss 0xef7(%rip),%xmm0
movd   %xmm0,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @f_ne_rc2(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp une float %3, 1.000000e+02
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @f_ne_rc2(float %0) {
%2 = fcmp oeq float %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}