xunge/DecIR huggingface dataset:
int atoi(char *str) {
  int res = 0;
  for (int i = 0; str[i] != '\0'; ++i)
    res = res * 10 + str[i] - '0';
  return res;
}


x86 assembly (clang, -O0):
<atoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1151 <atoi+0x51>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <atoi+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoi>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <atoi+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <atoi+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @atoi(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %24, %1
%6 = load i8*, i8** %2
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %27
13: ; preds = %5
%14 = load i32, i32* %3
%15 = mul nsw i32 %14, 10
%16 = load i8*, i8** %2
%17 = load i32, i32* %4
%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 = add nsw i32 %15, %21
%23 = sub nsw i32 %22, 48
store i32 %23, i32* %3
br label %24
24: ; preds = %13
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %5
27: ; preds = %5
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @atoi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %6, %1
%5 = phi i32 [ 0, %1 ], [ %13, %6 ]
ret i32 %5
6: ; preds = %1, %6
%7 = phi i64 [ %14, %6 ], [ 0, %1 ]
%8 = phi i8 [ %16, %6 ], [ %2, %1 ]
%9 = phi i32 [ %13, %6 ], [ 0, %1 ]
%10 = sext i8 %8 to i32
%11 = mul nsw i32 %9, 10
%12 = add i32 %11, -48
%13 = add i32 %12, %10
%14 = add nuw nsw i64 %7, 1
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %4, label %6
}
unsigned long long int gnu_dev_makedev(unsigned int major, unsigned int minor) {
  return ((minor & 0xff) | ((major & 0xfff) << 8) |
          (((unsigned long long int)(minor & ~0xff)) << 12) |
          (((unsigned long long int)(major & ~0xfff)) << 32));
}


x86 assembly (clang, -O0):
<gnu_dev_makedev>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    -0x4(%rbp),%ecx
and    $0xfff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,%eax
mov    -0x8(%rbp),%ecx
and    $0xffffff00,%ecx
mov    %ecx,%ecx
shl    $0xc,%rcx
or     %rcx,%rax
mov    -0x4(%rbp),%ecx
and    $0xfffff000,%ecx
mov    %ecx,%ecx
shl    $0x20,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gnu_dev_makedev>:
movzbl %sil,%ecx
mov    %edi,%eax
shl    $0x8,%eax
and    $0xfff00,%eax
or     %ecx,%eax
and    $0xffffff00,%esi
shl    $0xc,%rsi
or     %rsi,%rax
and    $0xfffff000,%edi
shl    $0x20,%rdi
or     %rdi,%rax
ret

LLVM IR (-O0):
define i64 @gnu_dev_makedev(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 = and i32 %5, 255
%7 = load i32, i32* %3
%8 = and i32 %7, 4095
%9 = shl i32 %8, 8
%10 = or i32 %6, %9
%11 = zext i32 %10 to i64
%12 = load i32, i32* %4
%13 = and i32 %12, -256
%14 = zext i32 %13 to i64
%15 = shl i64 %14, 12
%16 = or i64 %11, %15
%17 = load i32, i32* %3
%18 = and i32 %17, -4096
%19 = zext i32 %18 to i64
%20 = shl i64 %19, 32
%21 = or i64 %16, %20
ret i64 %21
}

LLVM IR (-O2):
define i64 @gnu_dev_makedev(i32 %0, i32 %1) {
%3 = and i32 %1, 255
%4 = shl i32 %0, 8
%5 = and i32 %4, 1048320
%6 = or i32 %3, %5
%7 = zext i32 %6 to i64
%8 = and i32 %1, -256
%9 = zext i32 %8 to i64
%10 = shl nuw nsw i64 %9, 12
%11 = or i64 %10, %7
%12 = and i32 %0, -4096
%13 = zext i32 %12 to i64
%14 = shl nuw i64 %13, 32
%15 = or i64 %11, %14
ret i64 %15
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
size_t strlen(char const *);
int marker_string_ends_with(const char *str, const char *sub_str) {
  size_t str_len = strlen(str);
  size_t sub_len = strlen(sub_str);
  if (strcmp(sub_str, &str[str_len - sub_len]) == 0) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<marker_string_ends_with>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rax
sub    -0x28(%rbp),%rax
add    %rax,%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1178 <marker_string_ends_with+0x58>
movl   $0x1,-0x4(%rbp)
jmp    117f <marker_string_ends_with+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<marker_string_ends_with>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
sub    %rax,%rbx
add    %r15,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @marker_string_ends_with(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = sub i64 %3, %4
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = tail call i64 @strcmp(i8* %1, i8* %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, unsigned long const);
bool cutils_cdar_DynamicArray_unsigned_long_format(const unsigned long *i,
                                                   char **b, size_t *s) {
  snprintf(*b, *s, "%luul", *i);
  return true;
}


x86 assembly (clang, -O0):
<cutils_cdar_DynamicArray_unsigned_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_unsigned_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 = [6 x i8] c"%luul\00"
define i32 @cutils_cdar_DynamicArray_unsigned_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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %12)
ret i32 1
}

LLVM IR (-O2):
@.str = [6 x i8] c"%luul\00"
define i32 @cutils_cdar_DynamicArray_unsigned_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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %6)
ret i32 1
}
int dnssec_errno_to_error(int ecode) { return -ecode; }


x86 assembly (clang, -O0):
<dnssec_errno_to_error>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @dnssec_errno_to_error(i32 %0) {
%2 = sub nsw i32 0, %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ uppercase(int /*<<< orphan*/);
char *mkupper(char *str) {
  char *sp;
  sp = str;
  while (*sp)
    uppercase(sp++);
  return (str);
}


x86 assembly (clang, -O0):
<mkupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114c <mkupper+0x3c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    %eax,%edi
call   1030 <uppercase@plt>
jmp    1124 <mkupper+0x14>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkupper>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
cmpb   $0x0,(%rdi)
je     1143 <mkupper+0x33>
lea    0x1(%r14),%rbx
mov    %r14d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
call   1030 <uppercase@plt>
add    $0x1,%ebp
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1130 <mkupper+0x20>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @mkupper(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %6, %4 ], [ %0, %1 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = ptrtoint i8* %5 to i64
%8 = trunc i64 %7 to i32
%9 = tail call i32 @uppercase(i32 %8)
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret i8* %0
}
/* Variables and functions */
int r_sys_setenv(char const *, char const *);
int spp_var_set(const char *var, const char *val) {
  return r_sys_setenv(var, val);
}


x86 assembly (clang, -O0):
<spp_var_set>:
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 <r_sys_setenv@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spp_var_set>:
jmp    1030 <r_sys_setenv@plt>

LLVM IR (-O0):
define i32 @spp_var_set(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 @r_sys_setenv(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @spp_var_set(i8* %0, i8* %1) {
%3 = tail call i32 @r_sys_setenv(i8* %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ itoa(int, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char num[100] = {};
  itoa(-123, num);
  printf("%s\n", num);
  printf("%d\n", atoi(num));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
lea    -0x70(%rbp),%rsi
mov    $0xffffff85,%edi
call   1060 <itoa@plt>
lea    -0x70(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
mov    %rsp,%rbx
mov    $0xffffff85,%edi
mov    %rbx,%rsi
call   1060 <itoa@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <atoi@plt>
lea    0xe6c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = bitcast [100 x i8]* %1 to i8*
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = call i32 @itoa(i32 -123, i8* %3)
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%8 = call i32 @atoi(i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @itoa(i32 -123, i8* %2)
%4 = call i32 @puts(i8* %2)
%5 = call i32 @atoi(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int sqrt(int);
int is_prime(int number) {
  int something;
  for (something = 2; something <= sqrt(number); something++) {
    if (!(number % something))
      return 0;
  }
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <sqrt@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     116c <is_prime+0x5c>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1159 <is_prime+0x49>
movl   $0x0,-0x4(%rbp)
jmp    116c <is_prime+0x5c>
jmp    115e <is_prime+0x4e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <is_prime+0x12>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <sqrt@plt>
cmp    $0x2,%eax
jl     1147 <is_prime+0x37>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
mov    %ebx,%eax
cltd
idiv   %ebp
test   %edx,%edx
je     1147 <is_prime+0x37>
mov    %ebx,%edi
call   1030 <sqrt@plt>
cmp    %eax,%ebp
jl     1130 <is_prime+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = tail call i32 @sqrt(i32 %0)
%3 = icmp slt i32 %2, 2
br i1 %3, label %12, label %8
4: ; preds = %8
%5 = add nuw nsw i32 %9, 1
%6 = tail call i32 @sqrt(i32 %0)
%7 = icmp slt i32 %9, %6
br i1 %7, label %8, label %12
8: ; preds = %1, %4
%9 = phi i32 [ %5, %4 ], [ 2, %1 ]
%10 = srem i32 %0, %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %8, %4, %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _Mem_Free(void *, int, int /*<<< orphan*/, char const *,
                             int);
void TV_Module_MemFree(void *data, const char *filename, int fileline) {
  _Mem_Free(data, 2, 0, filename, fileline);
}


x86 assembly (clang, -O0):
<TV_Module_MemFree>:
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),%rcx
mov    -0x14(%rbp),%r8d
mov    $0x2,%esi
xor    %edx,%edx
call   1030 <_Mem_Free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TV_Module_MemFree>:
mov    %edx,%r8d
mov    %rsi,%rcx
mov    $0x2,%esi
xor    %edx,%edx
jmp    1030 <_Mem_Free@plt>

LLVM IR (-O0):
define void @TV_Module_MemFree(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 i32 @_Mem_Free(i8* %7, i32 2, i32 0, i8* %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @TV_Module_MemFree(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @_Mem_Free(i8* %0, i32 2, i32 0, i8* %1, i32 %2)
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
long int time_delta(struct timeval *tv1, struct timeval *tv2) {
  long int us;
  us = (tv2->tv_sec - tv1->tv_sec) * 1000000 + tv2->tv_usec;
  us = us - tv1->tv_usec;
  return us;
}


x86 assembly (clang, -O0):
<time_delta>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
sub    (%rcx),%eax
imul   $0xf4240,%eax,%eax
mov    -0x10(%rbp),%rcx
add    0x4(%rcx),%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq 0x4(%rcx),%rcx
sub    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_delta>:
movslq (%rsi),%rax
movslq (%rdi),%rcx
sub    %rcx,%rax
imul   $0xf4240,%rax,%rcx
movslq 0x4(%rsi),%rax
add    %rcx,%rax
movslq 0x4(%rdi),%rcx
sub    %rcx,%rax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i64 @time_delta(%struct.timeval* %0, %struct.timeval* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timeval*
%5 = alloca i64
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timeval* %1, %struct.timeval** %4
%6 = load %struct.timeval*, %struct.timeval** %4
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = load %struct.timeval*, %struct.timeval** %3
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = sub nsw i32 %8, %11
%13 = mul nsw i32 %12, 1000000
%14 = load %struct.timeval*, %struct.timeval** %4
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 1
%16 = load i32, i32* %15
%17 = add nsw i32 %13, %16
%18 = sext i32 %17 to i64
store i64 %18, i64* %5
%19 = load i64, i64* %5
%20 = load %struct.timeval*, %struct.timeval** %3
%21 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i32 0, i32 1
%22 = load i32, i32* %21
%23 = sext i32 %22 to i64
%24 = sub nsw i64 %19, %23
store i64 %24, i64* %5
%25 = load i64, i64* %5
ret i64 %25
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i64 @time_delta(%struct.timeval* nocapture %0, %struct.timeval* nocapture %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
%8 = mul nsw i32 %7, 1000000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = add nsw i32 %8, %10
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%14 = load i32, i32* %13
%15 = sext i32 %14 to i64
%16 = sub nsw i64 %12, %15
ret i64 %16
}
/* Variables and functions */
int /*<<< orphan*/ g_writeln(char *, int);
void pipe_sig(int sig_num) { g_writeln("got SIGPIPE(%d)", sig_num); }


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

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"got SIGPIPE(%d)\00"
define void @pipe_sig(i32 %0) {
%2 = tail call i32 @g_writeln(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  if ((10 || (5 - 2)) && !((6 / 2) - (1 + 2))) {
    printf("\nVerdadeiro");
  } else {
    printf("\nFalso");
  }
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"\0AVerdadeiro\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
float newPerlin(float, float, float);
float newPerlinU(float x, float y, float z) {
  return (0.5f + 0.5f * newPerlin(x, y, z));
}


x86 assembly (clang, -O0):
<newPerlinU>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
call   1030 <newPerlin@plt>
movss  0xebd(%rip),%xmm1
mulss  %xmm1,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newPerlinU>:
push   %rax
call   1030 <newPerlin@plt>
movss  0xee2(%rip),%xmm1
mulss  %xmm1,%xmm0
addss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @newPerlinU(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* %5
%9 = load float, float* %6
%10 = call float @newPerlin(float %7, float %8, float %9)
%11 = call float @llvm.fmuladd.f32(float 5.000000e-01, float %10, float 5.000000e-01)
ret float %11
}

LLVM IR (-O2):
define float @newPerlinU(float %0, float %1, float %2) {
%4 = tail call float @newPerlin(float %0, float %1, float %2)
%5 = tail call float @llvm.fmuladd.f32(float %4, float 5.000000e-01, float 5.000000e-01)
ret float %5
}
void dhcpc_configured() {}


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

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

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

LLVM IR (-O2):
define void @dhcpc_configured() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _win_free(int);
void close_windows() {
  ;
  int i;
  for (i = 0; i < (4); i++) {
    _win_free(i);
  }
  { return; };
}


x86 assembly (clang, -O0):
<close_windows>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    113f <close_windows+0x2f>
mov    -0x4(%rbp),%edi
call   1030 <_win_free@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <close_windows+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_windows>:
push   %rax
xor    %edi,%edi
call   1030 <_win_free@plt>
mov    $0x1,%edi
call   1030 <_win_free@plt>
mov    $0x2,%edi
call   1030 <_win_free@plt>
mov    $0x3,%edi
pop    %rax
jmp    1030 <_win_free@plt>

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

LLVM IR (-O2):
define void @close_windows() {
%1 = tail call i32 @_win_free(i32 0)
%2 = tail call i32 @_win_free(i32 1)
%3 = tail call i32 @_win_free(i32 2)
%4 = tail call i32 @_win_free(i32 3)
ret void
}
/* Variables and functions */
float asinf(float);
float intr_wrap_007(float p1) { return asinf(p1); }


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

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

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

LLVM IR (-O2):
define float @intr_wrap_007(float %0) {
%2 = tail call float @asinf(float %0)
ret float %2
}
/* Variables and functions */
int mock_get_line_wait(char *, int, int /*<<< orphan*/);
int mock_get_line(char *s, int len) { return mock_get_line_wait(s, len, 0); }


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

x86 assembly (clang, -O2):
<mock_get_line>:
xor    %edx,%edx
jmp    1030 <mock_get_line_wait@plt>

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

LLVM IR (-O2):
define i32 @mock_get_line(i8* %0, i32 %1) {
%3 = tail call i32 @mock_get_line_wait(i8* %0, i32 %1, i32 0)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void USB_EndPoint4(uint32_t event) {}


x86 assembly (clang, -O0):
<USB_EndPoint4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @USB_EndPoint4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @USB_EndPoint4(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float jarda;
  printf("Jarda: ");
  scanf("%f", &jarda);
  printf("Metro: %.2f", jarda * 0.91);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea2(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xeaa(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xeae(%rip),%xmm0
lea    0xeba(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Jarda: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [12 x i8] c"Metro: %.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 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), float* %2)
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fmul double %6, 9.100000e-01
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"Jarda: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [12 x i8] c"Metro: %.2f\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 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), float* %1)
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = fmul double %6, 9.100000e-01
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}
/* Variables and functions */
int consttime_memcmp(void const *, void const *, size_t);
int buf_compare_ct(const void *s1, const void *s2, size_t n) {
  return consttime_memcmp(s1, s2, n);
}


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

x86 assembly (clang, -O2):
<buf_compare_ct>:
jmp    1030 <consttime_memcmp@plt>

LLVM IR (-O0):
define i32 @buf_compare_ct(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** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @consttime_memcmp(i8* %7, i8* %8, i64 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @buf_compare_ct(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @consttime_memcmp(i8* %0, i8* %1, i64 %2)
ret i32 %4
}
/* Variables and functions */
int backtrace(void **, int);
int /*<<< orphan*/ backtrace_symbols_detail(void **, int);
void debug_backtrace_dump(void) {
  void *buffer[100];
  int size = backtrace(buffer, 100);
  backtrace_symbols_detail(buffer, size);
}


x86 assembly (clang, -O0):
<debug_backtrace_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x330,%rsp
lea    -0x320(%rbp),%rdi
mov    $0x64,%esi
call   1030 <backtrace@plt>
mov    %eax,-0x324(%rbp)
lea    -0x320(%rbp),%rdi
mov    -0x324(%rbp),%esi
call   1040 <backtrace_symbols_detail@plt>
add    $0x330,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_backtrace_dump>:
push   %rbx
sub    $0x320,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1030 <backtrace@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <backtrace_symbols_detail@plt>
add    $0x320,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @debug_backtrace_dump() {
%1 = alloca [100 x i8*]
%2 = alloca i32
%3 = getelementptr inbounds [100 x i8*], [100 x i8*]* %1, i64 0, i64 0
%4 = call i32 @backtrace(i8** %3, i32 100)
store i32 %4, i32* %2
%5 = getelementptr inbounds [100 x i8*], [100 x i8*]* %1, i64 0, i64 0
%6 = load i32, i32* %2
%7 = call i32 @backtrace_symbols_detail(i8** %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @debug_backtrace_dump() {
%1 = alloca [100 x i8*]
%2 = bitcast [100 x i8*]* %1 to i8*
%3 = getelementptr inbounds [100 x i8*], [100 x i8*]* %1, i64 0, i64 0
%4 = call i32 @backtrace(i8** %3, i32 100)
%5 = call i32 @backtrace_symbols_detail(i8** %3, i32 %4)
ret void
}
void foo796(int p) {}


x86 assembly (clang, -O0):
<foo796>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @foo796(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @foo796(i32 %0) {
ret void
}
/* Variables and functions */
bool is_in_grid(int i, int j) {
  return ((i < 25) && (i > 0) && (j < 25) && (j > 0));
}


x86 assembly (clang, -O0):
<is_in_grid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x19,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jge    1141 <is_in_grid+0x41>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jle    1141 <is_in_grid+0x41>
xor    %eax,%eax
cmpl   $0x19,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jge    1141 <is_in_grid+0x41>
cmpl   $0x0,-0x8(%rbp)
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_in_grid>:
add    $0xffffffff,%edi
cmp    $0x18,%edi
setb   %al
add    $0xffffffff,%esi
cmp    $0x18,%esi
setb   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @is_in_grid(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 = icmp slt i32 %5, 25
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 25
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 0
br label %16
16: ; preds = %13, %10, %7, %2
%17 = phi i1 [ false, %10 ], [ false, %7 ], [ false, %2 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @is_in_grid(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = icmp ult i32 %3, 24
%5 = add i32 %1, -1
%6 = icmp ult i32 %5, 24
%7 = and i1 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
double foo(int x, double a) { return a; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define double @foo(i32 %0, double returned %1) {
ret double %1
}
double Sleef_tgamma_u10(double x) { return __builtin_tgamma(x); }


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

x86 assembly (clang, -O2):
<Sleef_tgamma_u10>:
jmp    1030 <tgamma@plt>

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

LLVM IR (-O2):
define double @Sleef_tgamma_u10(double %0) {
%2 = tail call double @tgamma(double %0)
ret double %2
}
float rad(int degree) { return degree * (3.1416 / 180); }


x86 assembly (clang, -O0):
<rad>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeec(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rad>:
cvtsi2sd %edi,%xmm0
mulsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @rad(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fmul double %4, 0x3F91DF495F7DCD44
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @rad(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fmul double %2, 0x3F91DF495F7DCD44
%4 = fptrunc double %3 to float
ret float %4
}
int test_43_4(int *mem) { return __atomic_sub_fetch(mem + 4, 1, 4); }


x86 assembly (clang, -O0):
<test_43_4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    %ecx,%eax
neg    %eax
lock xadd %eax,0x10(%rdx)
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_43_4>:
mov    $0xffffffff,%eax
lock xadd %eax,0x10(%rdi)
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @test_43_4(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 4
store i32 1, i32* %3
%7 = load i32, i32* %3
%8 = atomicrmw sub i32* %6, i32 %7 acq_rel
%9 = sub i32 %8, %7
store i32 %9, i32* %4
%10 = load i32, i32* %4
ret i32 %10
}

LLVM IR (-O2):
define i32 @test_43_4(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = atomicrmw sub i32* %2, i32 1 acq_rel
%4 = add i32 %3, -1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ _mm_stream_si32(int *, int);
void test_mm_stream_si32(int *A, int B) { _mm_stream_si32(A, B); }


x86 assembly (clang, -O0):
<test_mm_stream_si32>:
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 <_mm_stream_si32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mm_stream_si32>:
jmp    1030 <_mm_stream_si32@plt>

LLVM IR (-O0):
define void @test_mm_stream_si32(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 @_mm_stream_si32(i32* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @test_mm_stream_si32(i32* %0, i32 %1) {
%3 = tail call i32 @_mm_stream_si32(i32* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printlist(int list[], int n) {
  int i;
  for (i = 0; i < n; i++)
    printf("%d\t", list[i]);
}


x86 assembly (clang, -O0):
<printlist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <printlist+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printlist+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printlist>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <printlist+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <printlist+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\09\00"
define void @printlist(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
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @printlist(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ printf(char *);
void do_stuff(void) {
  FILE *logfile = fopen("log", "a");
  if (logfile == NULL) {
    printf("Could not open file\n");
  }
  fprintf(logfile, "do_stuff\n");
}


x86 assembly (clang, -O0):
<do_stuff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1166 <do_stuff+0x36>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_stuff>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xec5(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1158 <do_stuff+0x28>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
lea    0xea7(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
jmp    1050 <fwrite@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"log\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [21 x i8] c"Could not open file\0A\00"
@.str.3 = [10 x i8] c"do_stuff\0A\00"
define void @do_stuff() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = load i32*, i32** %1
%9 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"log\00"
@.str.1 = [2 x i8] c"a\00"
@.str.3 = [10 x i8] c"do_stuff\0A\00"
@str = [20 x i8] c"Could not open file\00"
define void @do_stuff() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i64 9, i64 1, i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void msglist(char **s) {
  while (*s)
    printf("%s\n", *s++);
}


x86 assembly (clang, -O0):
<msglist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     114f <msglist+0x3f>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%rax
mov    %eax,%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
jmp    111c <msglist+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msglist>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rsi
test   %rsi,%rsi
je     1144 <msglist+0x34>
mov    %rdi,%rbx
add    $0x8,%rbx
lea    0xed6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1130 <msglist+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @msglist(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %11, %4 ], [ %2, %1 ]
%6 = phi i8** [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = ptrtoint i8* %5 to i64
%9 = trunc i64 %8 to i32
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i8*, i8** %7
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
void negate_int_min(int m, int n) {
  if (m - n != ((~0U) & ~((~0U) >> 1)))
    return;
  clang_analyzer_eval(n - m == ((~0U) & ~((~0U) >> 1)));
}


x86 assembly (clang, -O0):
<negate_int_min>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x80000000,%eax
je     1134 <negate_int_min+0x24>
jmp    114c <negate_int_min+0x3c>
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
cmp    $0x80000000,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<negate_int_min>:
mov    %edi,%eax
sub    %esi,%eax
cmp    $0x80000000,%eax
jne    112e <negate_int_min+0x1e>
sub    %edi,%esi
xor    %edi,%edi
cmp    $0x80000000,%esi
sete   %dil
jmp    1030 <clang_analyzer_eval@plt>
ret

LLVM IR (-O0):
define void @negate_int_min(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 = sub nsw i32 %5, %6
%8 = icmp ne i32 %7, -2147483648
br i1 %8, label %9, label %10
9: ; preds = %2
br label %17
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = sub nsw i32 %11, %12
%14 = icmp eq i32 %13, -2147483648
%15 = zext i1 %14 to i32
%16 = call i32 @clang_analyzer_eval(i32 %15)
br label %17
17: ; preds = %10, %9
ret void
}

LLVM IR (-O2):
define void @negate_int_min(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
%4 = icmp eq i32 %3, -2147483648
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = sub nsw i32 %1, %0
%7 = icmp eq i32 %6, -2147483648
%8 = zext i1 %7 to i32
%9 = tail call i32 @clang_analyzer_eval(i32 %8)
br label %10
10: ; preds = %2, %5
ret void
}
/* Variables and functions */
size_t strlen(char const *);
const char *router_format_linemode(const char *in, char *out, size_t *outlen,
                                   char *srcaddr) {
  (void)out;
  *outlen = strlen(in);
  return in;
}


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

x86 assembly (clang, -O2):
<router_format_linemode>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,(%r14)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @router_format_linemode(i8* %0, i8* %1, i64* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64* %2, i64** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %6
%10 = load i8*, i8** %5
%11 = call i64 @strlen(i8* %10)
%12 = load i64*, i64** %7
store i64 %11, i64* %12
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
define i8* @router_format_linemode(i8* returned %0, i8* nocapture readnone %1, i64* nocapture writeonly %2, i8* nocapture readnone %3) {
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
store i64 %5, i64* %2
ret i8* %0
}