xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ sg_str_toll(char *, size_t, char **);
int sg_str_toll_buf(char *s, size_t n, void *buf) {
  int64_t v;
  char *e;
  v = sg_str_toll(s, n, &e);
  if (s + n != e)
    return -1;
  *((int64_t *)buf) = v;
  return 0;
}


x86 assembly (clang, -O0):
<sg_str_toll_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <sg_str_toll@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
cmp    -0x30(%rbp),%rax
je     1156 <sg_str_toll_buf+0x46>
movl   $0xffffffff,-0x4(%rbp)
jmp    1166 <sg_str_toll_buf+0x56>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_str_toll_buf>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x8(%rsp),%rdx
call   1030 <sg_str_toll@plt>
add    %r15,%rbx
mov    $0xffffffff,%ecx
cmp    0x8(%rsp),%rbx
jne    1140 <sg_str_toll_buf+0x30>
mov    %eax,(%r14)
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @sg_str_toll_buf(i8* %0, i64 %1, i8* nocapture writeonly %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = call i32 @sg_str_toll(i8* %0, i64 %1, i8** %4)
%7 = getelementptr inbounds i8, i8* %0, i64 %1
%8 = load i8*, i8** %4
%9 = icmp eq i8* %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = bitcast i8* %2 to i32*
store i32 %6, i32* %11
br label %12
12: ; preds = %3, %10
%13 = phi i32 [ 0, %10 ], [ -1, %3 ]
ret i32 %13
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
char *_strdup(const char *s) {
  char *str = NULL;
  if (s) {
    size_t size = strlen(s) + 1;
    str = malloc(size);
    if (str) {
      memcpy(str, s, size);
    }
  }
  return str;
}


x86 assembly (clang, -O0):
<_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118f <_strdup+0x5f>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118a <_strdup+0x5a>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
jmp    118f <_strdup+0x5f>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_strdup>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1168 <_strdup+0x38>
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     1168 <_strdup+0x38>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
jmp    116a <_strdup+0x3a>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @_strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = tail call i8* @malloc(i64 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = tail call i32 @memcpy(i8* %7, i8* %0, i64 %6)
br label %11
11: ; preds = %3, %9, %1
%12 = phi i8* [ null, %1 ], [ %7, %9 ], [ null, %3 ]
ret i8* %12
}
int __objc_dynamic_undefined_symbol_count(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @__objc_dynamic_undefined_symbol_count() {
ret i32 0
}
/* Variables and functions */
scalar_t__ is_prime(int);
long long euler_problem_10() {
  unsigned long long sum = 2;
  int i;
  for (i = 3; i < 2000000; i += 2) {
    if (is_prime(i)) {
      sum += i;
    }
  }
  return sum;
}


x86 assembly (clang, -O0):
<euler_problem_10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x2,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
cmpl   $0x1e8480,-0xc(%rbp)
jge    1165 <euler_problem_10+0x55>
mov    -0xc(%rbp),%edi
call   1030 <is_prime@plt>
cmp    $0x0,%rax
je     1152 <euler_problem_10+0x42>
movslq -0xc(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1157 <euler_problem_10+0x47>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <euler_problem_10+0x17>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<euler_problem_10>:
push   %r14
push   %rbx
push   %rax
mov    $0x2,%r14d
mov    $0x3,%ebx
nop
mov    %ebx,%edi
call   1030 <is_prime@plt>
test   %rax,%rax
cmovne %rbx,%rax
add    %rax,%r14
lea    0x2(%rbx),%rax
cmp    $0x1e847e,%rbx
mov    %rax,%rbx
jb     1120 <euler_problem_10+0x10>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @euler_problem_10() {
br label %1
1: ; preds = %0, %1
%2 = phi i64 [ 3, %0 ], [ %9, %1 ]
%3 = phi i64 [ 2, %0 ], [ %8, %1 ]
%4 = trunc i64 %2 to i32
%5 = tail call i64 @is_prime(i32 %4)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i64 0, i64 %2
%8 = add i64 %7, %3
%9 = add nuw nsw i64 %2, 2
%10 = icmp ult i64 %2, 1999998
br i1 %10, label %1, label %11
11: ; preds = %1
ret i64 %8
}
void INT_SR0(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_SR0() {
ret void
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
unsigned long long ftime_gettime() {
  struct timeval tv;
  int ret = gettimeofday(&tv, NULL);
  if (ret) {
    return 0;
  }
  return (unsigned long long)tv.tv_sec * 1000000l +
         (unsigned long long)tv.tv_usec;
}


x86 assembly (clang, -O0):
<ftime_gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     113f <ftime_gettime+0x2f>
movq   $0x0,-0x8(%rbp)
jmp    114f <ftime_gettime+0x3f>
imul   $0xf4240,-0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftime_gettime>:
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,0x8(%rsp),%rcx
add    (%rsp),%rcx
test   %eax,%eax
cmovne %rbx,%rcx
mov    %rcx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i64 @ftime_gettime() {
%1 = alloca i64
%2 = alloca %struct.timeval
%3 = alloca i32
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
store i64 0, i64* %1
br label %15
8: ; preds = %0
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%10 = load i64, i64* %9
%11 = mul i64 %10, 1000000
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%13 = load i64, i64* %12
%14 = add i64 %11, %13
store i64 %14, i64* %1
br label %15
15: ; preds = %8, %7
%16 = load i64, i64* %1
ret i64 %16
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i64 @ftime_gettime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i32 %3, 0
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = mul i64 %6, 1000000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%9 = load i64, i64* %8
%10 = add i64 %7, %9
%11 = select i1 %4, i64 %10, i64 0
ret i64 %11
}
void baz_char(char *x) { *x = __imag foo_char(5); }


x86 assembly (clang, -O0):
<baz_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x5,%edi
mov    $0x0,%al
call   1030 <foo_char@plt>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<baz_char>:
push   %rbx
mov    %rdi,%rbx
mov    $0x5,%edi
xor    %eax,%eax
call   1030 <foo_char@plt>
movb   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @baz_char(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i32, ...) bitcast (i32 (...)* @foo_char to i32 (i32, ...)*)(i32 5)
%4 = load i8*, i8** %2
store i8 0, i8* %4
ret void
}

LLVM IR (-O2):
define void @baz_char(i8* nocapture writeonly %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @foo_char to i32 (i32, ...)*)(i32 5)
store i8 0, i8* %0
ret void
}
/* Variables and functions */
scalar_t__ _U_Qfcmp(long double, long double, int);
int _U_Qflt(long double a, long double b) { return (_U_Qfcmp(a, b, 9) != 0); }


x86 assembly (clang, -O0):
<_U_Qflt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
mov    $0x9,%edi
call   1030 <_U_Qfcmp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_U_Qflt>:
sub    $0x28,%rsp
fldt   0x30(%rsp)
fldt   0x40(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
mov    $0x9,%edi
call   1030 <_U_Qfcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @_U_Qflt(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80, x86_fp80* %4
%7 = call i64 @_U_Qfcmp(x86_fp80 %5, x86_fp80 %6, i32 9)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @_U_Qflt(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call i64 @_U_Qfcmp(x86_fp80 %0, x86_fp80 %1, i32 9)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
int character(char *str, char str2) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    if (str[i] != '\0' && str[i] == str2)
      return (i);
    i++;
  }
  return (i);
}


x86 assembly (clang, -O0):
<character>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1170 <character+0x70>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1162 <character+0x62>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1162 <character+0x62>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1176 <character+0x76>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <character+0x15>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<character>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rdi),%ecx
add    $0x1,%eax
test   %cl,%cl
je     1123 <character+0x23>
add    $0x1,%rdi
cmp    %sil,%cl
jne    1110 <character+0x10>
ret

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

LLVM IR (-O2):
define i32 @character(i8* nocapture %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %10, %3 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = icmp eq i8 %6, %1
%9 = or i1 %7, %8
%10 = add nuw i64 %4, 1
br i1 %9, label %11, label %3
11: ; preds = %3
%12 = trunc i64 %4 to i32
ret i32 %12
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
float ml_rand() { return ((float)rand() / (float)(RAND_MAX)); }


x86 assembly (clang, -O0):
<ml_rand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ml_rand>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define float @ml_rand() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to float
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to float
%5 = fdiv float %2, %4
ret float %5
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define float @ml_rand() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to float
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to float
%5 = fdiv float %2, %4
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ hal_cc25xx_enter_rxmode();
void hal_cc25xx_init_gpio(void) { hal_cc25xx_enter_rxmode(); }


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

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

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

LLVM IR (-O2):
define void @hal_cc25xx_init_gpio() {
%1 = tail call i32 (...) @hal_cc25xx_enter_rxmode()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pB(char *, char const *, char const *);
void read_mem_pB(const char *regname_data, const char *regname_address) {
  pB("PALMEM0(%s, T_SINT32, mem_ptr, %s);", regname_data, regname_address);
}


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

x86 assembly (clang, -O2):
<read_mem_pB>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <pB@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"PALMEM0(%s, T_SINT32, mem_ptr, %s);\00"
define void @read_mem_pB(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @pB(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"PALMEM0(%s, T_SINT32, mem_ptr, %s);\00"
define void @read_mem_pB(i8* %0, i8* %1) {
%3 = tail call i32 @pB(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
gtty(fildes, arg) char *arg;
{ return ioctl(fildes, ('t' << 8) | 8, arg); }


x86 assembly (clang, -O0):
<gtty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    $0x7408,%esi
mov    $0x0,%al
call   1030 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtty>:
mov    %rsi,%rdx
mov    $0x7408,%esi
xor    %eax,%eax
jmp    1030 <ioctl@plt>

LLVM IR (-O0):
define i32 @gtty(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = call i32 (i32, i32, i8*, ...) bitcast (i32 (...)* @ioctl to i32 (i32, i32, i8*, ...)*)(i32 %5, i32 29704, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @gtty(i32 %0, i8* %1) {
%3 = tail call i32 (i32, i32, i8*, ...) bitcast (i32 (...)* @ioctl to i32 (i32, i32, i8*, ...)*)(i32 %0, i32 29704, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ _test_free(char *const, char *, int);
scalar_t__ _test_malloc(int, char *, int);
void buffer_underflow() {
  char *const memory = (char *)_test_malloc(
      sizeof(int),
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/fsaintjacques/cmockery/refs/heads/master/"
      "examples/allocate_module.c",
      39);
  memory[-1] = '!';
  _test_free(memory,
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fsaintjacques/cmockery/refs/heads/"
             "master/examples/allocate_module.c",
             41);
}


x86 assembly (clang, -O0):
<buffer_underflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
lea    0xecc(%rip),%rsi
mov    $0x27,%edx
call   1040 <_test_malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x21,-0x1(%rax)
mov    -0x8(%rbp),%rdi
lea    0xeab(%rip),%rsi
mov    $0x29,%edx
call   1030 <_test_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_underflow>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    $0x4,%edi
mov    %rbx,%rsi
mov    $0x27,%edx
call   1040 <_test_malloc@plt>
movb   $0x21,-0x1(%rax)
mov    %rax,%rdi
mov    %rbx,%rsi
mov    $0x29,%edx
pop    %rbx
jmp    1030 <_test_free@plt>

LLVM IR (-O0):
@.str = [158 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fsaintjacques/cmockery/refs/heads/master/examples/allocate_module.c\00"
define void @buffer_underflow() {
%1 = alloca i8*
%2 = call i64 @_test_malloc(i32 4, i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str, i64 0, i64 0), i32 39)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = getelementptr inbounds i8, i8* %4, i64 -1
store i8 33, i8* %5
%6 = load i8*, i8** %1
%7 = call i32 @_test_free(i8* %6, i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str, i64 0, i64 0), i32 41)
ret void
}

LLVM IR (-O2):
@.str = [158 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fsaintjacques/cmockery/refs/heads/master/examples/allocate_module.c\00"
define void @buffer_underflow() {
%1 = tail call i64 @_test_malloc(i32 4, i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str, i64 0, i64 0), i32 39)
%2 = inttoptr i64 %1 to i8*
%3 = getelementptr inbounds i8, i8* %2, i64 -1
store i8 33, i8* %3
%4 = tail call i32 @_test_free(i8* %2, i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str, i64 0, i64 0), i32 41)
ret void
}
double jac_jacobi_P0(double x, double a, double b) { return 1.0; }


x86 assembly (clang, -O0):
<jac_jacobi_P0>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xee5(%rip),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @jac_jacobi_P0(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
ret double 1.000000e+00
}

LLVM IR (-O2):
define double @jac_jacobi_P0(double %0, double %1, double %2) {
ret double 1.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ F_SETFL;
int /*<<< orphan*/ O_NONBLOCK;
int fcntl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int unblock_fd(int fd) { return fcntl(fd, F_SETFL, O_NONBLOCK); }


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

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

LLVM IR (-O0):
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define i32 @unblock_fd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_SETFL
%5 = load i32, i32* @O_NONBLOCK
%6 = call i32 @fcntl(i32 %3, i32 %4, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define i32 @unblock_fd(i32 %0) {
%2 = load i32, i32* @F_SETFL
%3 = load i32, i32* @O_NONBLOCK
%4 = tail call i32 @fcntl(i32 %0, i32 %2, i32 %3)
ret i32 %4
}
double foo(void) {
  return (__extension__((union {
            unsigned __l __attribute__((__mode__(__SI__)));
            float __d;
          }){__l : 0x3f800000UL})
              .__d);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3f800000,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i32 }
define double @foo() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to i32*
store i32 1065353216, i32* %2
%3 = bitcast %union.anon* %1 to float*
%4 = load float, float* %3
%5 = fpext float %4 to double
ret double %5
}

LLVM IR (-O2):
define double @foo() {
ret double 1.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ bubble_sort(int *, int);
void sort(int *data, int length) { bubble_sort(data, length); }


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

x86 assembly (clang, -O2):
<sort>:
jmp    1030 <bubble_sort@plt>

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

LLVM IR (-O2):
define void @sort(i32* %0, i32 %1) {
%3 = tail call i32 @bubble_sort(i32* %0, i32 %1)
ret void
}
int calc_num_digits(int num) {
  int count = 0;
  while (num != 0) {
    num /= 10;
    count++;
  }
  return count;
}


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

x86 assembly (clang, -O2):
<calc_num_digits>:
xor    %eax,%eax
test   %edi,%edi
je     1132 <calc_num_digits+0x32>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x1,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <calc_num_digits+0x10>
ret

LLVM IR (-O0):
define i32 @calc_num_digits(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 ne i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 10
store i32 %9, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @calc_num_digits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = sdiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = add i32 %5, 9
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
void yy_3_IgnoredElements(char *yytext, int yyleng) {
  ;
  ;
}


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

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

LLVM IR (-O0):
define void @yy_3_IgnoredElements(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @yy_3_IgnoredElements(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
char io_in8(int);
int /*<<< orphan*/ io_out8(int, char);
char access_rct(char flag) {
  io_out8(0x70, flag);
  return io_in8(0x71);
}


x86 assembly (clang, -O0):
<access_rct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x70,%edi
movsbl -0x1(%rbp),%esi
call   1030 <io_out8@plt>
mov    $0x71,%edi
call   1040 <io_in8@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<access_rct>:
push   %rax
mov    %edi,%esi
mov    $0x70,%edi
call   1030 <io_out8@plt>
mov    $0x71,%edi
pop    %rax
jmp    1040 <io_in8@plt>

LLVM IR (-O0):
define signext i8 @access_rct(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @io_out8(i32 112, i8 signext %3)
%5 = call signext i8 @io_in8(i32 113)
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @access_rct(i8 signext %0) {
%2 = tail call i32 @io_out8(i32 112, i8 signext %0)
%3 = tail call signext i8 @io_in8(i32 113)
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, long long const);
bool cutils_cdar_DynamicArray_long_long_format(const long long *i, char **b,
                                               size_t *s) {
  snprintf(*b, *s, "%lldll", *i);
  return true;
}


x86 assembly (clang, -O0):
<cutils_cdar_DynamicArray_long_long_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
lea    0xec0(%rip),%rdx
call   1030 <snprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cutils_cdar_DynamicArray_long_long_format>:
push   %rax
mov    (%rsi),%rax
mov    (%rdx),%rsi
mov    (%rdi),%rcx
lea    0xedf(%rip),%rdx
mov    %rax,%rdi
call   1030 <snprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%lldll\00"
define i32 @cutils_cdar_DynamicArray_long_long_format(i64* nocapture %0, i8** nocapture %1, i64* nocapture %2) {
%4 = load i8*, i8** %1
%5 = load i64, i64* %2
%6 = load i64, i64* %0
%7 = tail call i32 @snprintf(i8* %4, i64 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %6)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void secretFunction(int a, int b) {
  printf("The answer is %d\n", a * b);
  exit(0);
}


x86 assembly (clang, -O0):
<secretFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
imul   -0x8(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<secretFunction>:
push   %rax
imul   %edi,%esi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"The answer is %d\0A\00"
define void @secretFunction(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = mul nsw i32 %5, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"The answer is %d\0A\00"
define void @secretFunction(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ mbstate_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%zu\n", sizeof(mbstate_t));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"%zu\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
ret i32 0
}
/* Variables and functions */
int __isspace_impl(int);
int isspace(int c) { return __isspace_impl(c); }


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

x86 assembly (clang, -O2):
<isspace>:
jmp    1030 <__isspace_impl@plt>

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

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
%2 = tail call i32 @__isspace_impl(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ ksft_print_cnts();
int /*<<< orphan*/ printf(char *);
int ksft_exit_fail(void) {
  printf("Bail out!\n");
  ksft_print_cnts();
  exit(1);
}


x86 assembly (clang, -O0):
<ksft_exit_fail>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <ksft_print_cnts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<ksft_exit_fail>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <ksft_print_cnts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Bail out!\0A\00"
define i32 @ksft_exit_fail() {
%1 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @ksft_print_cnts()
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [10 x i8] c"Bail out!\00"
define i32 @ksft_exit_fail() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @ksft_print_cnts()
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void err_syntax18_error(const char *s) { printf("%s\n", s); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @err_syntax18_error(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int mpu_write_mem(int, int, unsigned char *);
int dmp_set_shake_reject_timeout(unsigned short time) {
  unsigned char tmp[2];
  time /= (1000 / (200));
  tmp[0] = time >> 8;
  tmp[1] = time & 0xFF;
  return mpu_write_mem((256 + 88), 2, tmp);
}


x86 assembly (clang, -O0):
<dmp_set_shake_reject_timeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
mov    %al,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x3(%rbp)
lea    -0x4(%rbp),%rdx
mov    $0x158,%edi
mov    $0x2,%esi
call   1030 <mpu_write_mem@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmp_set_shake_reject_timeout>:
push   %rax
imul   $0xcccd,%edi,%eax
shr    $0x12,%eax
rol    $0x8,%ax
mov    %ax,0x6(%rsp)
lea    0x6(%rsp),%rdx
mov    $0x158,%edi
mov    $0x2,%esi
call   1030 <mpu_write_mem@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dmp_set_shake_reject_timeout(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca [2 x i8]
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = sdiv i32 %5, 5
%7 = trunc i32 %6 to i16
store i16 %7, i16* %2
%8 = load i16, i16* %2
%9 = zext i16 %8 to i32
%10 = ashr i32 %9, 8
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
store i8 %11, i8* %12
%13 = load i16, i16* %2
%14 = zext i16 %13 to i32
%15 = and i32 %14, 255
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 %16, i8* %17
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%19 = call i32 @mpu_write_mem(i32 344, i32 2, i8* %18)
ret i32 %19
}

LLVM IR (-O2):
define i32 @dmp_set_shake_reject_timeout(i16 zeroext %0) {
%2 = alloca [2 x i8]
%3 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%4 = udiv i16 %0, 5
%5 = lshr i16 %4, 8
%6 = trunc i16 %5 to i8
store i8 %6, i8* %3
%7 = trunc i16 %4 to i8
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 1
store i8 %7, i8* %8
%9 = call i32 @mpu_write_mem(i32 344, i32 2, i8* %3)
ret i32 %9
}
void BlinkNoTimerTaskC$Leds$led0On(void) { LedsP$Leds$led0On(); }


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

x86 assembly (clang, -O2):
<BlinkNoTimerTaskC$Leds$led0On>:
xor    %eax,%eax
jmp    1030 <LedsP$Leds$led0On@plt>

LLVM IR (-O0):
define void @"BlinkNoTimerTaskC$Leds$led0On"() {
%1 = call i32 (...) @"LedsP$Leds$led0On"()
ret void
}

LLVM IR (-O2):
define void @"BlinkNoTimerTaskC$Leds$led0On"() {
%1 = tail call i32 (...) @"LedsP$Leds$led0On"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TestSqrt(double);
main() {
  TestSqrt(0.0);
  TestSqrt(0.25);
  TestSqrt(1);
  TestSqrt(2);
  TestSqrt(3);
  TestSqrt(4);
  TestSqrt(49);
  TestSqrt(200);
  TestSqrt(1.0E10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
xorps  %xmm0,%xmm0
call   1030 <TestSqrt@plt>
movsd  0xf14(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xeff(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xeea(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xed5(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xec0(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xeab(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xe96(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xe81(%rip),%xmm0
call   1030 <TestSqrt@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xorps  %xmm0,%xmm0
call   1030 <TestSqrt@plt>
movsd  0xedf(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xeda(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xed5(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xed0(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xecb(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xec6(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xec1(%rip),%xmm0
call   1030 <TestSqrt@plt>
movsd  0xebc(%rip),%xmm0
call   1030 <TestSqrt@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @TestSqrt(double 0.000000e+00)
%2 = call i32 @TestSqrt(double 2.500000e-01)
%3 = call i32 @TestSqrt(double 1.000000e+00)
%4 = call i32 @TestSqrt(double 2.000000e+00)
%5 = call i32 @TestSqrt(double 3.000000e+00)
%6 = call i32 @TestSqrt(double 4.000000e+00)
%7 = call i32 @TestSqrt(double 4.900000e+01)
%8 = call i32 @TestSqrt(double 2.000000e+02)
%9 = call i32 @TestSqrt(double 1.000000e+10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @TestSqrt(double 0.000000e+00)
%2 = tail call i32 @TestSqrt(double 2.500000e-01)
%3 = tail call i32 @TestSqrt(double 1.000000e+00)
%4 = tail call i32 @TestSqrt(double 2.000000e+00)
%5 = tail call i32 @TestSqrt(double 3.000000e+00)
%6 = tail call i32 @TestSqrt(double 4.000000e+00)
%7 = tail call i32 @TestSqrt(double 4.900000e+01)
%8 = tail call i32 @TestSqrt(double 2.000000e+02)
%9 = tail call i32 @TestSqrt(double 1.000000e+10)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void put_le32(uint8_t *ptr, uint32_t v) {
  ptr[0] = v;
  ptr[1] = v >> 8;
  ptr[2] = v >> 16;
  ptr[3] = v >> 24;
}


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

x86 assembly (clang, -O2):
<put_le32>:
mov    %esi,(%rdi)
mov    %esi,%eax
sar    $0x8,%eax
mov    %eax,0x4(%rdi)
mov    %esi,%eax
sar    $0x10,%eax
mov    %eax,0x8(%rdi)
sar    $0x18,%esi
mov    %esi,0xc(%rdi)
ret

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

LLVM IR (-O2):
define void @put_le32(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
%3 = ashr i32 %1, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %3, i32* %4
%5 = ashr i32 %1, 16
%6 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %5, i32* %6
%7 = ashr i32 %1, 24
%8 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %7, i32* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *);
void signal_analyze_plat_data(const void *data __attribute__((unused)),
                              char *out, size_t out_len) {
  snprintf(out, out_len, "No additional platform data\n");
}


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

x86 assembly (clang, -O2):
<signal_analyze_plat_data>:
mov    %rsi,%rdi
lea    0xee6(%rip),%rax
mov    %rdx,%rsi
mov    %rax,%rdx
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"No additional platform data\0A\00"
define void @signal_analyze_plat_data(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = call i32 @snprintf(i8* %7, i64 %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"No additional platform data\0A\00"
define void @signal_analyze_plat_data(i8* nocapture readnone %0, i8* nocapture writeonly %1, i64 %2) {
%4 = tail call i32 @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fs_http_free();
int /*<<< orphan*/ fs_posix_free();
void fs_free(void) {
  fs_http_free();
  fs_posix_free();
}


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

x86 assembly (clang, -O2):
<fs_free>:
push   %rax
xor    %eax,%eax
call   1040 <fs_http_free@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <fs_posix_free@plt>

LLVM IR (-O0):
define void @fs_free() {
%1 = call i32 (...) @fs_http_free()
%2 = call i32 (...) @fs_posix_free()
ret void
}

LLVM IR (-O2):
define void @fs_free() {
%1 = tail call i32 (...) @fs_http_free()
%2 = tail call i32 (...) @fs_posix_free()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outw_local(unsigned short, int);
void(outw)(unsigned short value, int port) {
  {
    outw_local(value, port);
    return;
  }
}


x86 assembly (clang, -O0):
<outw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x2(%rbp),%ax
mov    -0x8(%rbp),%esi
movzwl %ax,%edi
call   1030 <outw_local@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outw>:
jmp    1030 <outw_local@plt>

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

LLVM IR (-O2):
define void @outw(i16 zeroext %0, i32 %1) {
%3 = tail call i32 @outw_local(i16 zeroext %0, i32 %1)
ret void
}
/* Variables and functions */
void *calloc(size_t, size_t);
void *clad_calloc(size_t size, size_t amount) { return calloc(size, amount); }


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

x86 assembly (clang, -O2):
<clad_calloc>:
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define noalias i8* @clad_calloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
char *malloc(int);
void adjustedGT(unsigned a) {
  char *b = ((void *)0);
  if (a - 1 > -1U - 1)
    b = malloc(1);
  return;
}


x86 assembly (clang, -O0):
<adjustedGT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cmp    $0xfffffffe,%eax
jbe    1140 <adjustedGT+0x30>
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @adjustedGT(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* null, i8** %3
%4 = load i32, i32* %2
%5 = sub i32 %4, 1
%6 = icmp ugt i32 %5, -2
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i8* @malloc(i32 1)
store i8* %8, i8** %3
br label %9
9: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
define void @adjustedGT(i32 %0) {
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *myalloc(size_t n) { return malloc(n); }


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

x86 assembly (clang, -O2):
<myalloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @myalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}