xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ ObjectPersistenceHandle();
int /*<<< orphan*/ UAVObjLogging(int /*<<< orphan*/);
void ObjectPersistenceLogging() { UAVObjLogging(ObjectPersistenceHandle()); }


x86 assembly (clang, -O0):
<ObjectPersistenceLogging>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <ObjectPersistenceHandle@plt>
mov    %eax,%edi
call   1030 <UAVObjLogging@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ObjectPersistenceLogging>:
push   %rax
xor    %eax,%eax
call   1040 <ObjectPersistenceHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <UAVObjLogging@plt>

LLVM IR (-O0):
define void @ObjectPersistenceLogging() {
%1 = call i32 (...) @ObjectPersistenceHandle()
%2 = call i32 @UAVObjLogging(i32 %1)
ret void
}

LLVM IR (-O2):
define void @ObjectPersistenceLogging() {
%1 = tail call i32 (...) @ObjectPersistenceHandle()
%2 = tail call i32 @UAVObjLogging(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LedsP__Leds__led2Toggle();
void BaseStationUartC__Leds__led2Toggle(void) { LedsP__Leds__led2Toggle(); }


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

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

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

LLVM IR (-O2):
define void @BaseStationUartC__Leds__led2Toggle() {
%1 = tail call i32 (...) @LedsP__Leds__led2Toggle()
ret void
}
/* Variables and functions */
char *U_EMR_CORE5_set(int);
char *U_EMRSETMETARGN_set(void) { return (U_EMR_CORE5_set(28)); }


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

x86 assembly (clang, -O2):
<U_EMRSETMETARGN_set>:
mov    $0x1c,%edi
jmp    1030 <U_EMR_CORE5_set@plt>

LLVM IR (-O0):
define i8* @U_EMRSETMETARGN_set() {
%1 = call i8* @U_EMR_CORE5_set(i32 28)
ret i8* %1
}

LLVM IR (-O2):
define i8* @U_EMRSETMETARGN_set() {
%1 = tail call i8* @U_EMR_CORE5_set(i32 28)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int readAgain() {
  char c;
  printf("Read again? (y/n):\n");
  scanf("%c", &c);
  if (c == 'y') {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<readAgain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x79,%eax
jne    115d <readAgain+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1164 <readAgain+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readAgain>:
push   %rax
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
cmpb   $0x79,0x7(%rsp)
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Read again? (y/n):\0A\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @readAgain() {
%1 = alloca i32
%2 = alloca i8
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 121
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 1, i32* %1
br label %10
9: ; preds = %0
store i32 0, i32* %1
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@str = [19 x i8] c"Read again? (y/n):\00"
define i32 @readAgain() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 121
%6 = zext i1 %5 to i32
ret i32 %6
}
int test_imm_EFint8_mem(signed char *val) {
  return ((*val) & (0xEF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_EFint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xef,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_EFint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -17
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
double feetToCentimetres(double feet) { return feet * 30.48; }


x86 assembly (clang, -O0):
<feetToCentimetres>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<feetToCentimetres>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @feetToCentimetres(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 3.048000e+01
ret double %4
}

LLVM IR (-O2):
define double @feetToCentimetres(double %0) {
%2 = fmul double %0, 3.048000e+01
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ memcmp(char *, char *, int);
void __attribute__((no)) check(char *test, char *match, int n) {
  if (memcmp(test, match, n))
    abort();
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
je     1154 <check+0x34>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rax
call   1040 <memcmp@plt>
test   %rax,%rax
jne    112d <check+0xd>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @check(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i64 @memcmp(i8* %7, i8* %8, i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @check(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @memcmp(i8* %0, i8* %1, i32 %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(size_t);
int alloc_anon(const char *cgroup, void *arg) {
  size_t size = (unsigned long)arg;
  char *buf, *ptr;
  buf = malloc(size);
  for (ptr = buf; ptr < buf + size; ptr += 4096)
    *ptr = 0;
  free(buf);
  return 0;
}


x86 assembly (clang, -O0):
<alloc_anon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
add    -0x18(%rbp),%rcx
cmp    %rcx,%rax
jae    117c <alloc_anon+0x5c>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1000,%rax
mov    %rax,-0x28(%rbp)
jmp    114d <alloc_anon+0x2d>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_anon>:
push   %rbx
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1040 <malloc@plt>
test   %rbx,%rbx
jle    114f <alloc_anon+0x2f>
mov    %rax,%rcx
add    %rbx,%rcx
mov    %rax,%rdx
nopw   0x0(%rax,%rax,1)
movb   $0x0,(%rdx)
add    $0x1000,%rdx
cmp    %rcx,%rdx
jb     1140 <alloc_anon+0x20>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @alloc_anon(i8* nocapture readnone %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = tail call i8* @malloc(i64 %3)
%5 = getelementptr inbounds i8, i8* %4, i64 %3
%6 = icmp sgt i8* %1, null
br i1 %6, label %7, label %11
7: ; preds = %2, %7
%8 = phi i8* [ %9, %7 ], [ %4, %2 ]
store i8 0, i8* %8
%9 = getelementptr inbounds i8, i8* %8, i64 4096
%10 = icmp ult i8* %9, %5
br i1 %10, label %7, label %11
11: ; preds = %7, %2
%12 = tail call i32 @free(i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_181() {
  Assert_real((isqrt(181) == 13),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              910, ("Integer square root of 181 should be 13"));
}


x86 assembly (clang, -O0):
<t_sqrt_181>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb5,%edi
call   1030 <isqrt@plt>
cmp    $0xd,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x38e,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_181>:
push   %rax
mov    $0xb5,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xd,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x38e,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 181 should be 13\00"
define void @t_sqrt_181() {
%1 = call i32 @isqrt(i32 181)
%2 = icmp eq i32 %1, 13
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 910, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 181 should be 13\00"
define void @t_sqrt_181() {
%1 = tail call i32 @isqrt(i32 181)
%2 = icmp eq i32 %1, 13
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 910, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int ft_strcmp(const char *s1, const char *s2) {
  while (*s1 == *s2++) {
    if (*s1++ == 0x00)
      return (0x00);
  }
  return (*(unsigned char *)s1 - *(unsigned char *)--s2);
}


x86 assembly (clang, -O0):
<ft_strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1159 <ft_strcmp+0x59>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1154 <ft_strcmp+0x54>
movl   $0x0,-0x4(%rbp)
jmp    1178 <ft_strcmp+0x78>
jmp    110c <ft_strcmp+0xc>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x18(%rbp)
movzbl -0x1(%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strcmp>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%edx
cmp    %dl,%al
jne    1127 <ft_strcmp+0x27>
add    $0x1,%rcx
test   %eax,%eax
jne    1110 <ft_strcmp+0x10>
xor    %eax,%eax
ret
sub    %edx,%eax
ret

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

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


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

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

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

LLVM IR (-O2):
define void @singlebuffer_() {
%1 = tail call i32 (...) @singlebuffer()
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int ascent;
};
typedef TYPE_1__ XFontStruct;

/* Variables and functions */
void set_XFontStruct_ascent(void *_p, int _v) {
  ((XFontStruct *)_p)->ascent = (int)_v;
}


x86 assembly (clang, -O0):
<set_XFontStruct_ascent>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XFontStruct_ascent>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XFontStruct_ascent(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 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XFontStruct_ascent(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
char *gettext(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf(gettext("Apollo 13 scenario: Main thruster failed!\n"));
}


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

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

LLVM IR (-O0):
@.str = [43 x i8] c"Apollo 13 scenario: Main thruster failed!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i8* @gettext(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"Apollo 13 scenario: Main thruster failed!\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @gettext(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) %3)
ret i32 0
}
/* Variables and functions */
int fc8150_bypass_write(void *, unsigned char, unsigned char, unsigned char *,
                        unsigned char);
int fci_bypass_write(void *hDevice, unsigned char chip, unsigned char addr,
                     unsigned char alen, unsigned char *data,
                     unsigned char len) {
  int res;
  res = fc8150_bypass_write(hDevice, chip, addr, data, len);
  return res;
}


x86 assembly (clang, -O0):
<fci_bypass_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r9b,%al
mov    %rdi,-0x8(%rbp)
mov    %sil,-0x9(%rbp)
mov    %dl,-0xa(%rbp)
mov    %cl,-0xb(%rbp)
mov    %r8,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%dl
mov    -0xa(%rbp),%al
mov    -0x18(%rbp),%rcx
movzbl %dl,%esi
movzbl %al,%edx
movzbl -0x19(%rbp),%r8d
call   1030 <fc8150_bypass_write@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fci_bypass_write>:
mov    %r8,%rcx
mov    %r9d,%r8d
jmp    1030 <fc8150_bypass_write@plt>

LLVM IR (-O0):
define i32 @fci_bypass_write(i8* %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3, i8* %4, i8 zeroext %5) {
%7 = alloca i8*
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8*
%12 = alloca i8
%13 = alloca i32
store i8* %0, i8** %7
store i8 %1, i8* %8
store i8 %2, i8* %9
store i8 %3, i8* %10
store i8* %4, i8** %11
store i8 %5, i8* %12
%14 = load i8*, i8** %7
%15 = load i8, i8* %8
%16 = load i8, i8* %9
%17 = load i8*, i8** %11
%18 = load i8, i8* %12
%19 = call i32 @fc8150_bypass_write(i8* %14, i8 zeroext %15, i8 zeroext %16, i8* %17, i8 zeroext %18)
store i32 %19, i32* %13
%20 = load i32, i32* %13
ret i32 %20
}

LLVM IR (-O2):
define i32 @fci_bypass_write(i8* %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3, i8* %4, i8 zeroext %5) {
%7 = tail call i32 @fc8150_bypass_write(i8* %0, i8 zeroext %1, i8 zeroext %2, i8* %4, i8 zeroext %5)
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ le32toh(int /*<<< orphan*/);
int32_t ld_i32_le(const void *x) { return le32toh(((int32_t *)x)[0]); }


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

x86 assembly (clang, -O2):
<ld_i32_le>:
mov    (%rdi),%edi
jmp    1030 <le32toh@plt>

LLVM IR (-O0):
define i32 @ld_i32_le(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
%7 = call i32 @le32toh(i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @ld_i32_le(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @le32toh(i32 %3)
ret i32 %4
}
/* Variables and functions */
size_t strnlen(const char *s, size_t maxlen) {
  const char *es = s;
  while (*es && maxlen) {
    es++;
    maxlen--;
  }
  return (es - s);
}


x86 assembly (clang, -O0):
<strnlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1134 <strnlen+0x34>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1144 <strnlen+0x44>
jmp    1161 <strnlen+0x61>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1114 <strnlen+0x14>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnlen>:
cmpb   $0x0,(%rdi)
mov    %rdi,%rax
je     1135 <strnlen+0x35>
mov    %rdi,%rax
test   %rsi,%rsi
je     1135 <strnlen+0x35>
add    $0xffffffffffffffff,%rsi
mov    %rdi,%rax
nopw   0x0(%rax,%rax,1)
add    $0xffffffffffffffff,%rsi
setb   %cl
cmpb   $0x0,0x1(%rax)
lea    0x1(%rax),%rax
je     1135 <strnlen+0x35>
test   %cl,%cl
jne    1120 <strnlen+0x20>
sub    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @strnlen(i8* %0, i64 %1) {
%3 = load i8, i8* %0
%4 = icmp ne i8 %3, 0
%5 = icmp ne i64 %1, 0
%6 = and i1 %4, %5
br i1 %6, label %7, label %16
7: ; preds = %2, %7
%8 = phi i8* [ %10, %7 ], [ %0, %2 ]
%9 = phi i64 [ %11, %7 ], [ %1, %2 ]
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = add i64 %9, -1
%12 = load i8, i8* %10
%13 = icmp ne i8 %12, 0
%14 = icmp ne i64 %11, 0
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %7, label %16
16: ; preds = %7, %2
%17 = phi i8* [ %0, %2 ], [ %10, %7 ]
%18 = ptrtoint i8* %17 to i64
%19 = ptrtoint i8* %0 to i64
%20 = sub i64 %18, %19
ret i64 %20
}
/* Variables and functions */
scalar_t__ COND_NE();
int /*<<< orphan*/ EA_AY_PI_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_sne_8_pi(void) {
  m68ki_write_8(EA_AY_PI_8(), COND_NE() ? 0xff : 0);
}


x86 assembly (clang, -O0):
<m68k_op_sne_8_pi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <EA_AY_PI_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <COND_NE@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_sne_8_pi>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <EA_AY_PI_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <COND_NE@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_sne_8_pi() {
%1 = call i32 (...) @EA_AY_PI_8()
%2 = call i64 (...) @COND_NE()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_sne_8_pi() {
%1 = tail call i32 (...) @EA_AY_PI_8()
%2 = tail call i64 (...) @COND_NE()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
/* Variables and functions */
char *CheckForInput();
int /*<<< orphan*/ Pause(int);
int /*<<< orphan*/ kbhit();
char *GetInput(void) {
  while (!kbhit())
    Pause(100);
  return (CheckForInput());
}


x86 assembly (clang, -O0):
<GetInput>:
push   %rbp
mov    %rsp,%rbp
jmp    1139 <GetInput+0x9>
mov    $0x0,%al
call   1040 <kbhit@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1155 <GetInput+0x25>
jmp    1164 <GetInput+0x34>
mov    $0x64,%edi
call   1050 <Pause@plt>
jmp    1139 <GetInput+0x9>
mov    $0x0,%al
call   1030 <CheckForInput@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetInput>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <kbhit@plt>
test   %eax,%eax
jne    1157 <GetInput+0x27>
mov    $0x64,%edi
call   1050 <Pause@plt>
jmp    1140 <GetInput+0x10>
xor    %eax,%eax
pop    %rcx
jmp    1030 <CheckForInput@plt>

LLVM IR (-O0):
define i8* @GetInput() {
br label %1
1: ; preds = %5, %0
%2 = call i32 (...) @kbhit()
%3 = icmp ne i32 %2, 0
%4 = xor i1 %3, true
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @Pause(i32 100)
br label %1
7: ; preds = %1
%8 = call i8* (...) @CheckForInput()
ret i8* %8
}

LLVM IR (-O2):
define i8* @GetInput() {
%1 = tail call i32 (...) @kbhit()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %7
3: ; preds = %0, %3
%4 = tail call i32 @Pause(i32 100)
%5 = tail call i32 (...) @kbhit()
%6 = icmp eq i32 %5, 0
br i1 %6, label %3, label %7
7: ; preds = %3, %0
%8 = tail call i8* (...) @CheckForInput()
ret i8* %8
}
void sighandler(int s) {
  Log(3, "function:%s --- paralist{s=%d}\n", __func__, s);
  _exit(128 + s);
}


x86 assembly (clang, -O0):
<sighandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x3,%edi
lea    0xec6(%rip),%rsi
lea    0xedf(%rip),%rdx
mov    $0x0,%al
call   1040 <Log@plt>
mov    -0x4(%rbp),%edi
add    $0x80,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<sighandler>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rsi
lea    0xeef(%rip),%rdx
mov    $0x3,%edi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <Log@plt>
sub    $0xffffff80,%ebx
mov    %ebx,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"function:%s --- paralist{s=%d}\0A\00"
@__func__.sighandler = [11 x i8] c"sighandler\00"
define void @sighandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, i8*, i8*, i32, ...) bitcast (i32 (...)* @Log to i32 (i32, i8*, i8*, i32, ...)*)(i32 3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.sighandler, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = add nsw i32 128, %5
unreachable
}

LLVM IR (-O2):
@.str = [32 x i8] c"function:%s --- paralist{s=%d}\0A\00"
@__func__.sighandler = [11 x i8] c"sighandler\00"
define void @sighandler(i32 %0) {
%2 = tail call i32 (i32, i8*, i8*, i32, ...) bitcast (i32 (...)* @Log to i32 (i32, i8*, i8*, i32, ...)*)(i32 3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.sighandler, i64 0, i64 0), i32 %0)
%3 = add nsw i32 %0, 128
tail call void @_exit(i32 %3)
unreachable
}
/* Variables and functions */
int lspcon_i2c_spi_write_register(int, int, int);
int lspcon_i2c_spi_set_mpu_active(int fd, int running) {
  int ret = 0;
  ret |= lspcon_i2c_spi_write_register(fd, 0xbc, 0xc0);
  ret |= lspcon_i2c_spi_write_register(fd, 0xbc, running ? 0 : 0x40);
  return ret;
}


x86 assembly (clang, -O0):
<lspcon_i2c_spi_set_mpu_active>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xbc,%esi
mov    $0xc0,%edx
call   1030 <lspcon_i2c_spi_write_register@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%ecx
mov    $0x40,%edx
xor    %eax,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
mov    $0xbc,%esi
call   1030 <lspcon_i2c_spi_write_register@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lspcon_i2c_spi_set_mpu_active>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0xbc,%esi
mov    $0xc0,%edx
call   1030 <lspcon_i2c_spi_write_register@plt>
mov    %eax,%r14d
xor    %edx,%edx
test   %ebx,%ebx
sete   %dl
shl    $0x6,%edx
mov    %ebp,%edi
mov    $0xbc,%esi
call   1030 <lspcon_i2c_spi_write_register@plt>
or     %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @lspcon_i2c_spi_set_mpu_active(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = call i32 @lspcon_i2c_spi_write_register(i32 %6, i32 188, i32 192)
%8 = load i32, i32* %5
%9 = or i32 %8, %7
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 0, i32 64
%15 = call i32 @lspcon_i2c_spi_write_register(i32 %10, i32 188, i32 %14)
%16 = load i32, i32* %5
%17 = or i32 %16, %15
store i32 %17, i32* %5
%18 = load i32, i32* %5
ret i32 %18
}

LLVM IR (-O2):
define i32 @lspcon_i2c_spi_set_mpu_active(i32 %0, i32 %1) {
%3 = tail call i32 @lspcon_i2c_spi_write_register(i32 %0, i32 188, i32 192)
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i32 64, i32 0
%6 = tail call i32 @lspcon_i2c_spi_write_register(i32 %0, i32 188, i32 %5)
%7 = or i32 %6, %3
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ key_registry_init();
int /*<<< orphan*/ nonces_init();
int /*<<< orphan*/ principals_initialize();
void init_crypto_lib() {
  nonces_init();
  key_registry_init();
  principals_initialize();
}


x86 assembly (clang, -O0):
<init_crypto_lib>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <nonces_init@plt>
mov    $0x0,%al
call   1050 <key_registry_init@plt>
mov    $0x0,%al
call   1040 <principals_initialize@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_crypto_lib>:
push   %rax
xor    %eax,%eax
call   1030 <nonces_init@plt>
xor    %eax,%eax
call   1050 <key_registry_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <principals_initialize@plt>

LLVM IR (-O0):
define void @init_crypto_lib() {
%1 = call i32 (...) @nonces_init()
%2 = call i32 (...) @key_registry_init()
%3 = call i32 (...) @principals_initialize()
ret void
}

LLVM IR (-O2):
define void @init_crypto_lib() {
%1 = tail call i32 (...) @nonces_init()
%2 = tail call i32 (...) @key_registry_init()
%3 = tail call i32 (...) @principals_initialize()
ret void
}
/* Variables and functions */
scalar_t__ shmat(long, int /*<<< orphan*/ *, int /*<<< orphan*/);
float *shmAttach(long shm_id) {
  float *addr = (float *)shmat(shm_id, NULL, 0);
  if (addr == (float *)-1) {
    return NULL;
  }
  return addr;
}


x86 assembly (clang, -O0):
<shmAttach>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <shmat@plt>
mov    %rax,-0x18(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x18(%rbp)
jne    114d <shmAttach+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1155 <shmAttach+0x45>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shmAttach>:
push   %rbx
xor    %ebx,%ebx
xor    %esi,%esi
xor    %edx,%edx
call   1030 <shmat@plt>
cmp    $0xffffffffffffffff,%rax
cmove  %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define float* @shmAttach(i64 %0) {
%2 = tail call i64 @shmat(i64 %0, i32* null, i32 0)
%3 = inttoptr i64 %2 to float*
%4 = icmp eq float* %3, inttoptr (i64 -1 to float*)
%5 = select i1 %4, float* null, float* %3
ret float* %5
}
double read_DCS16Number(char *p) {
  unsigned int rv;
  rv = 256 * (unsigned int)((unsigned char *)p)[0] +
       (unsigned int)((unsigned char *)p)[1];
  return (double)rv / 65535.0;
}


x86 assembly (clang, -O0):
<read_DCS16Number>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
shl    $0x10,%eax
bswap  %eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  0xed9(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_DCS16Number>:
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
cvtsi2sd %eax,%xmm0
divsd  0xeec(%rip),%xmm0
ret

LLVM IR (-O0):
define double @read_DCS16Number(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = mul i32 256, %7
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = add i32 %8, %12
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = uitofp i32 %14 to double
%16 = fdiv double %15, 6.553500e+04
ret double %16
}

LLVM IR (-O2):
define double @read_DCS16Number(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = or i32 %4, %7
%9 = uitofp i32 %8 to double
%10 = fdiv double %9, 6.553500e+04
ret double %10
}
unsigned int euc2jis(unsigned int euc) { return euc & ~0x8080; }


x86 assembly (clang, -O0):
<euc2jis>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff7f7f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<euc2jis>:
mov    %edi,%eax
and    $0xffff7f7f,%eax
ret

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

LLVM IR (-O2):
define i32 @euc2jis(i32 %0) {
%2 = and i32 %0, -32897
ret i32 %2
}
float mix(float x, float y, float a) { return x * (1 - a) + y * a; }


x86 assembly (clang, -O0):
<mix>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xee0(%rip),%xmm2
subss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mix>:
movss  0xef8(%rip),%xmm3
subss  %xmm2,%xmm3
mulss  %xmm2,%xmm1
mulss  %xmm3,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @mix(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %6
%9 = fsub float 1.000000e+00, %8
%10 = load float, float* %5
%11 = load float, float* %6
%12 = fmul float %10, %11
%13 = call float @llvm.fmuladd.f32(float %7, float %9, float %12)
ret float %13
}

LLVM IR (-O2):
define float @mix(float %0, float %1, float %2) {
%4 = fsub float 1.000000e+00, %2
%5 = fmul float %1, %2
%6 = tail call float @llvm.fmuladd.f32(float %0, float %4, float %5)
ret float %6
}
int clamp(double x) {
  int r = x;
  if (r < 0)
    return 0;
  else if (r > 255)
    return 255;
  else
    return r;
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1127 <clamp+0x27>
movl   $0x0,-0x4(%rbp)
jmp    1146 <clamp+0x46>
cmpl   $0xff,-0x14(%rbp)
jle    1140 <clamp+0x40>
movl   $0xff,-0x4(%rbp)
jmp    1146 <clamp+0x46>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
cvttsd2si %xmm0,%eax
cmp    $0xff,%eax
mov    $0xff,%ecx
cmovl  %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @clamp(double %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
%5 = load double, double* %3
%6 = fptosi double %5 to i32
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %16
10: ; preds = %1
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 255
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 255, i32* %2
br label %16
14: ; preds = %10
%15 = load i32, i32* %4
store i32 %15, i32* %2
br label %16
16: ; preds = %14, %13, %9
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @clamp(double %0) {
%2 = fptosi double %0 to i32
%3 = icmp slt i32 %2, 255
%4 = select i1 %3, i32 %2, i32 255
%5 = icmp sgt i32 %4, 0
%6 = select i1 %5, i32 %4, i32 0
ret i32 %6
}
/* Type definitions */
struct chunk {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/);
int /*<<< orphan*/ time_chunk(struct chunk *);
void time_free(struct chunk *chunk) { free(time_chunk(chunk)); }


x86 assembly (clang, -O0):
<time_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <time_chunk@plt>
mov    %eax,%edi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_free>:
push   %rax
call   1040 <time_chunk@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.chunk = type { i32 }
define void @time_free(%struct.chunk* %0) {
%2 = tail call i32 @time_chunk(%struct.chunk* %0)
%3 = tail call i32 @free(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printCharacters(char *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  char string[] = "print characters of a string";
  printf("The string is:\n");
  printCharacters(string);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xebd(%rip),%al
mov    %al,-0x14(%rbp)
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <printCharacters@plt>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xed2(%rip),%xmm0
movups %xmm0,0xd(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
call   1050 <printCharacters@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.string = [29 x i8] c"print characters of a string\00"
@.str = [16 x i8] c"The string is:\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [29 x i8]
store i32 0, i32* %1
%3 = bitcast [29 x i8]* %2 to i8*
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [29 x i8], [29 x i8]* %2, i64 0, i64 0
%6 = call i32 @printCharacters(i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.string = [29 x i8] c"print characters of a string\00"
@str = [15 x i8] c"The string is:\00"
define i32 @main() {
%1 = alloca [29 x i8]
%2 = getelementptr inbounds [29 x i8], [29 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = call i32 @printCharacters(i8* %2)
%5 = call i32 @putchar(i32 10)
ret i32 0
}
int init_native_context() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @init_native_context() {
ret i32 0
}
/* Type definitions */
typedef int uint_fast32_t;

/* Variables and functions */
unsigned string_hash(const char *s) {
  uint_fast32_t h = 0;
  while (*s) {
    h = 16 * h + *s++;
    h ^= h >> 24 & 0xf0;
  }
  return h & 0xfffffff;
}


x86 assembly (clang, -O0):
<string_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114f <string_hash+0x4f>
mov    -0xc(%rbp),%eax
shl    $0x4,%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
and    $0xf0,%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <string_hash+0xf>
mov    -0xc(%rbp),%eax
and    $0xfffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1133 <string_hash+0x33>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
shl    $0x4,%eax
movsbl %cl,%ecx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x18,%eax
and    $0xfffffff0,%eax
xor    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <string_hash+0x10>
and    $0xfffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @string_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %15, %4 ], [ %2, %1 ]
%6 = phi i32 [ %14, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = shl nsw i32 %6, 4
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = add nsw i32 %8, %10
%12 = lshr i32 %11, 24
%13 = and i32 %12, 240
%14 = xor i32 %13, %11
%15 = load i8, i8* %9
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %4
%18 = and i32 %14, 268435455
br label %19
19: ; preds = %17, %1
%20 = phi i32 [ 0, %1 ], [ %18, %17 ]
ret i32 %20
}
/* Variables and functions */
long double cosl(long double);
__attribute__((__weak__, __always___)) long double
softboundmpx_cosl(long double x) {
  return cosl(x);
}


x86 assembly (clang, -O0):
<softboundmpx_cosl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <cosl@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundmpx_cosl>:
jmp    1030 <cosl@plt>

LLVM IR (-O0):
define weak x86_fp80 @softboundmpx_cosl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call x86_fp80 @cosl(x86_fp80 %3)
ret x86_fp80 %4
}

LLVM IR (-O2):
define weak x86_fp80 @softboundmpx_cosl(x86_fp80 %0) {
%2 = tail call x86_fp80 @cosl(x86_fp80 %0)
ret x86_fp80 %2
}
/* Variables and functions */
int /*<<< orphan*/ log_event(char *, char *, char *, char *);
int /*<<< orphan*/ main_free();
int /*<<< orphan*/ main_init();
void test_new_event() {
  main_init();
  log_event("Addon", "Event", "0", "author=ctrip");
  main_free();
}


x86 assembly (clang, -O0):
<test_new_event>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <main_init@plt>
lea    0xebe(%rip),%rdi
lea    0xebd(%rip),%rsi
lea    0xebc(%rip),%rdx
lea    0xeb7(%rip),%rcx
call   1040 <log_event@plt>
mov    $0x0,%al
call   1050 <main_free@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_new_event>:
push   %rax
xor    %eax,%eax
call   1030 <main_init@plt>
lea    0xec1(%rip),%rdi
lea    0xec0(%rip),%rsi
lea    0xebf(%rip),%rdx
lea    0xeba(%rip),%rcx
call   1040 <log_event@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <main_free@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Addon\00"
@.str.1 = [6 x i8] c"Event\00"
@.str.2 = [2 x i8] c"0\00"
@.str.3 = [13 x i8] c"author=ctrip\00"
define void @test_new_event() {
%1 = call i32 (...) @main_init()
%2 = call i32 @log_event(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%3 = call i32 (...) @main_free()
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Addon\00"
@.str.1 = [6 x i8] c"Event\00"
@.str.2 = [2 x i8] c"0\00"
@.str.3 = [13 x i8] c"author=ctrip\00"
define void @test_new_event() {
%1 = tail call i32 (...) @main_init()
%2 = tail call i32 @log_event(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 (...) @main_free()
ret void
}
/* Variables and functions */
int ENODEV;
int sysfs_get_sched(const char *smt_mc) { return -ENODEV; }


x86 assembly (clang, -O0):
<sysfs_get_sched>:
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):
<sysfs_get_sched>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

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

LLVM IR (-O2):
@ENODEV = global i32 0
define i32 @sysfs_get_sched(i8* nocapture readnone %0) {
%2 = load i32, i32* @ENODEV
%3 = sub nsw i32 0, %2
ret i32 %3
}