xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void EMACTimestampEnable(uint32_t ui32Base) {
  ASSERT(ui32Base == 0x400EC000);
  (*((volatile uint32_t *)(ui32Base + 0x00000700))) |= 0x00000001;
  if (!((*((volatile uint32_t *)(ui32Base + 0x00000700))) & 0x00000004)) {
    (*((volatile uint32_t *)(ui32Base + 0x00000700))) |= 0x00000004;
  }
}


x86 assembly (clang, -O0):
<EMACTimestampEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x400ec000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x700,%eax
cltq
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x700,%eax
cltq
mov    (%rax),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    1169 <EMACTimestampEnable+0x59>
mov    -0x4(%rbp),%eax
add    $0x700,%eax
cltq
mov    (%rax),%ecx
or     $0x4,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACTimestampEnable>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x400ec000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
orl    $0x1,0x700(%rax)
testl  $0x4,0x700(%rax)
jne    1141 <EMACTimestampEnable+0x31>
orl    $0x4,0x700(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @EMACTimestampEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1074708480
%5 = zext i1 %4 to i32
%6 = call i32 @ASSERT(i32 %5)
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1792
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = or i32 %11, 1
store volatile i32 %12, i32* %10
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1792
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
%18 = and i32 %17, 4
%19 = icmp ne i32 %18, 0
br i1 %19, label %27, label %20
20: ; preds = %1
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1792
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
%25 = load volatile i32, i32* %24
%26 = or i32 %25, 4
store volatile i32 %26, i32* %24
br label %27
27: ; preds = %20, %1
ret void
}

LLVM IR (-O2):
define void @EMACTimestampEnable(i32 %0) {
%2 = icmp eq i32 %0, 1074708480
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
%5 = add nsw i32 %0, 1792
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = or i32 %8, 1
store volatile i32 %9, i32* %7
%10 = load volatile i32, i32* %7
%11 = and i32 %10, 4
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %1
%14 = load volatile i32, i32* %7
%15 = or i32 %14, 4
store volatile i32 %15, i32* %7
br label %16
16: ; preds = %13, %1
ret void
}
void prehod(int *a, int *b) {
  int tmp = *a;
  *a = *b;
  *b = tmp;
}


x86 assembly (clang, -O0):
<prehod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<prehod>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @prehod(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @prehod(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
const char *cJSON_Version(void) {
  static char version[15];
  sprintf(version, "%i.%i.%i", 1, 5, 3);
  return version;
}


x86 assembly (clang, -O0):
<cJSON_Version>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f0e(%rip),%rdi
lea    0xede(%rip),%rsi
mov    $0x1,%edx
mov    $0x5,%ecx
mov    $0x3,%r8d
call   1030 <sprintf@plt>
lea    0x2eeb(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cJSON_Version>:
push   %rbx
lea    0x2f11(%rip),%rbx
lea    0xee1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
mov    $0x5,%ecx
mov    $0x3,%r8d
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@cJSON_Version.version = internal global [15 x i8] zeroinitializer
@.str = [9 x i8] c"%i.%i.%i\00"
define i8* @cJSON_Version() {
%1 = call i32 @sprintf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i32 5, i32 3)
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0)
}

LLVM IR (-O2):
@cJSON_Version.version = internal global [15 x i8] zeroinitializer
@.str = [9 x i8] c"%i.%i.%i\00"
define i8* @cJSON_Version() {
%1 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i32 5, i32 3)
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @cJSON_Version.version, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t read_char_mm(void **p) {
  uint8_t *addr = *(uint8_t **)p;
  uint8_t v = *addr;
  *p = addr + sizeof(uint8_t);
  return v;
}


x86 assembly (clang, -O0):
<read_char_mm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rcx
add    $0x10,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_char_mm>:
mov    (%rdi),%rcx
mov    (%rcx),%eax
add    $0x10,%rcx
mov    %rcx,(%rdi)
ret

LLVM IR (-O0):
define i32 @read_char_mm(i8** %0) {
%2 = alloca i8**
%3 = alloca i32*
%4 = alloca i32
store i8** %0, i8*** %2
%5 = load i8**, i8*** %2
%6 = bitcast i8** %5 to i32**
%7 = load i32*, i32** %6
store i32* %7, i32** %3
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
store i32 %9, i32* %4
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 4
%12 = bitcast i32* %11 to i8*
%13 = load i8**, i8*** %2
store i8* %12, i8** %13
%14 = load i32, i32* %4
ret i32 %14
}

LLVM IR (-O2):
define i32 @read_char_mm(i8** nocapture %0) {
%2 = bitcast i8** %0 to i32**
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = getelementptr inbounds i32, i32* %3, i64 4
store i32* %5, i32** %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage(void) {
  printf(
      "Usage: newton --f function --g guess [--p]\n"
      "\n"
      "Or:    newtown 'f' 'g'\n"
      "       where 'f' is the function and 'g' the guessed root.\n"
      "\n"
      "Both options are equally valid, it's a matter of personal preference.\n"
      "The optional --p flat prints the iteration steps.\n");
}


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

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

LLVM IR (-O0):
@.str = [248 x i8] c"Usage: newton --f function --g guess [--p]\0A\0AOr: newtown 'f' 'g'\0A where 'f' is the function and 'g' the guessed root.\0A\0ABoth options are equally valid, it's a matter of personal preference.\0AThe optional --p flat prints the iteration steps.\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([248 x i8], [248 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [247 x i8] c"Usage: newton --f function --g guess [--p]\0A\0AOr: newtown 'f' 'g'\0A where 'f' is the function and 'g' the guessed root.\0A\0ABoth options are equally valid, it's a matter of personal preference.\0AThe optional --p flat prints the iteration steps.\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([247 x i8], [247 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *strchr(char const *, char);
unsigned int count_char_in_str(char ch, const char *str) {
  unsigned int count = 0;
  while ((str = strchr(str, ch)) != NULL) {
    count++;
    str += 1;
  }
  return count;
}


x86 assembly (clang, -O0):
<count_char_in_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     115e <count_char_in_str+0x4e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1129 <count_char_in_str+0x19>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_char_in_str>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    %rsi,%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1146 <count_char_in_str+0x36>
movsbl %bpl,%ebp
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0x1,%rax
mov    %rax,%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1130 <count_char_in_str+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @count_char_in_str(i8 signext %0, i8* %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %1, i8 signext %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %10, %5 ], [ %3, %2 ]
%7 = phi i32 [ %8, %5 ], [ 0, %2 ]
%8 = add i32 %7, 1
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = tail call i8* @strchr(i8* dereferenceable(1) %9, i8 signext %0)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %5
12: ; preds = %5, %2
%13 = phi i32 [ 0, %2 ], [ %8, %5 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ __console_tx_hex8(int, unsigned char);
void print_alert_hex8(unsigned char value) { __console_tx_hex8(1, value); }


x86 assembly (clang, -O0):
<print_alert_hex8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edi
movzbl -0x1(%rbp),%esi
call   1030 <__console_tx_hex8@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @print_alert_hex8(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @__console_tx_hex8(i32 1, i8 zeroext %3)
ret void
}

LLVM IR (-O2):
define void @print_alert_hex8(i8 zeroext %0) {
%2 = tail call i32 @__console_tx_hex8(i32 1, i8 zeroext %0)
ret void
}
int fun622() { return 622; }


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

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

LLVM IR (-O0):
define i32 @fun622() {
ret i32 622
}

LLVM IR (-O2):
define i32 @fun622() {
ret i32 622
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
void kill_line(FILE *fp) {
  int c = fgetc(fp);
  while ((c != EOF) && (c != '\n'))
    c = fgetc(fp);
}


x86 assembly (clang, -O0):
<kill_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
mov    0x2eb4(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xd(%rbp)
je     1149 <kill_line+0x39>
cmpl   $0xa,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1159 <kill_line+0x49>
jmp    116a <kill_line+0x5a>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
jmp    1128 <kill_line+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill_line>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <fgetc@plt>
cmp    $0xa,%eax
je     1142 <kill_line+0x32>
mov    0x2ec0(%rip),%r14
nopl   0x0(%rax,%rax,1)
cmp    (%r14),%eax
je     1142 <kill_line+0x32>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%eax
jne    1130 <kill_line+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define void @kill_line(i32* nocapture %0) {
%2 = tail call i32 @fgetc(i32* %0)
%3 = load i32, i32* @EOF
%4 = icmp ne i32 %2, %3
%5 = icmp ne i32 %2, 10
%6 = and i1 %5, %4
br i1 %6, label %7, label %13
7: ; preds = %1, %7
%8 = tail call i32 @fgetc(i32* %0)
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
%11 = icmp ne i32 %8, 10
%12 = and i1 %11, %10
br i1 %12, label %7, label %13
13: ; preds = %7, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pio_outdword(unsigned char, unsigned long);
void pio_rep_outdword(unsigned char addrDataReg, unsigned char *bufAddr,
                      long dwordCnt) {
  while (dwordCnt > 0) {
    pio_outdword(addrDataReg, *(unsigned long *)bufAddr);
    bufAddr += 4;
    dwordCnt--;
  }
}


x86 assembly (clang, -O0):
<pio_rep_outdword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jle    1160 <pio_rep_outdword+0x50>
mov    -0x1(%rbp),%al
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rsi
movzbl %al,%edi
call   1030 <pio_outdword@plt>
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1126 <pio_rep_outdword+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pio_rep_outdword>:
push   %rbp
push   %r14
push   %rbx
test   %rdx,%rdx
jle    1148 <pio_rep_outdword+0x38>
mov    %rdx,%r14
mov    %rsi,%rbx
add    $0x1,%r14
movzbl %dil,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%rsi
mov    %ebp,%edi
call   1030 <pio_outdword@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r14
cmp    $0x1,%r14
ja     1130 <pio_rep_outdword+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @pio_rep_outdword(i8 zeroext %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
br label %7
7: ; preds = %10, %3
%8 = load i64, i64* %6
%9 = icmp sgt i64 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = load i8, i8* %4
%12 = load i8*, i8** %5
%13 = bitcast i8* %12 to i64*
%14 = load i64, i64* %13
%15 = call i32 @pio_outdword(i8 zeroext %11, i64 %14)
%16 = load i8*, i8** %5
%17 = getelementptr inbounds i8, i8* %16, i64 4
store i8* %17, i8** %5
%18 = load i64, i64* %6
%19 = add nsw i64 %18, -1
store i64 %19, i64* %6
br label %7
20: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @pio_rep_outdword(i8 zeroext %0, i8* nocapture %1, i64 %2) {
%4 = icmp sgt i64 %2, 0
br i1 %4, label %5, label %14
5: ; preds = %3, %5
%6 = phi i64 [ %12, %5 ], [ %2, %3 ]
%7 = phi i8* [ %11, %5 ], [ %1, %3 ]
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %8
%10 = tail call i32 @pio_outdword(i8 zeroext %0, i64 %9)
%11 = getelementptr inbounds i8, i8* %7, i64 4
%12 = add nsw i64 %6, -1
%13 = icmp ugt i64 %6, 1
br i1 %13, label %5, label %14
14: ; preds = %5, %3
ret void
}
/* Variables and functions */
float __nv_normcdff(float);
float normcdff(float __a) { return __nv_normcdff(__a); }


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

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

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

LLVM IR (-O2):
define float @normcdff(float %0) {
%2 = tail call float @__nv_normcdff(float %0)
ret float %2
}
int fibDP(int n) {
  if (n == 0 || n == 1) {
    return n;
  }
  int cand1 = fibDP(n - 1);
  int cand2 = fibDP(n - 2);
  return (cand1 + cand2);
}


x86 assembly (clang, -O0):
<fibDP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <fibDP+0x1f>
cmpl   $0x1,-0x8(%rbp)
jne    113a <fibDP+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <fibDP+0x4f>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fibDP@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fibDP@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibDP>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%edi
jb     1132 <fibDP+0x22>
xor    %ebp,%ebp
xchg   %ax,%ax
lea    -0x1(%rbx),%edi
call   1030 <fibDP@plt>
add    $0xfffffffe,%ebx
add    %eax,%ebp
cmp    $0x1,%ebx
ja     1120 <fibDP+0x10>
add    %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fibDP(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fibDP(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %8, 2
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %9, %3 ]
%13 = phi i32 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i32 %13, %12
ret i32 %14
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ stat(char *, struct stat *);
int main(void) {
  struct stat st;
  stat("tmp/foo", &st);
  return 0;
}


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

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

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [8 x i8] c"tmp/foo\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.stat
store i32 0, i32* %1
%3 = call i32 @stat(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [8 x i8] c"tmp/foo\00"
define i32 @main() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i32 @stat(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
ret i32 0
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int clamp16(int32_t val) {
  if (val > 32767)
    return 32767;
  if (val < -32768)
    return -32768;
  return val;
}


x86 assembly (clang, -O0):
<clamp16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x7fff,-0x8(%rbp)
jle    1120 <clamp16+0x20>
movl   $0x7fff,-0x4(%rbp)
jmp    113f <clamp16+0x3f>
cmpl   $0xffff8000,-0x8(%rbp)
jge    1139 <clamp16+0x39>
movl   $0xffff8000,-0x4(%rbp)
jmp    113f <clamp16+0x3f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp16>:
cmp    $0xffff8001,%edi
mov    $0xffff8000,%ecx
cmovge %edi,%ecx
cmp    $0x7fff,%ecx
mov    $0x7fff,%eax
cmovl  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @clamp16(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 32767
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 32767, i32* %2
br label %13
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, -32768
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 -32768, i32* %2
br label %13
11: ; preds = %7
%12 = load i32, i32* %3
store i32 %12, i32* %2
br label %13
13: ; preds = %11, %10, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @clamp16(i32 %0) {
%2 = icmp sgt i32 %0, -32768
%3 = select i1 %2, i32 %0, i32 -32768
%4 = icmp slt i32 %3, 32767
%5 = select i1 %4, i32 %3, i32 32767
ret i32 %5
}
double ls_costN_nm6_twice(double x) { return x + x; }


x86 assembly (clang, -O0):
<ls_costN_nm6_twice>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_costN_nm6_twice>:
addsd  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @ls_costN_nm6_twice(double %0) {
%2 = fadd double %0, %0
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isalpha(int);
void t_isalpha_0x46() {
  Assert_real((isalpha(70)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalpha.c",
              355, ("isalpha should be 1 for F"));
}


x86 assembly (clang, -O0):
<t_isalpha_0x46>:
push   %rbp
mov    %rsp,%rbp
mov    $0x46,%edi
call   1030 <isalpha@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x163,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalpha_0x46>:
push   %rax
mov    $0x46,%edi
call   1030 <isalpha@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x163,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for F\00"
define void @t_isalpha_0x46() {
%1 = call i32 @isalpha(i32 70)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 355, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for F\00"
define void @t_isalpha_0x46() {
%1 = tail call i32 @isalpha(i32 70)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 355, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int new_integer() {
  int newInt = 42;
  return newInt;
}


x86 assembly (clang, -O0):
<new_integer>:
push   %rbp
mov    %rsp,%rbp
movl   $0x2a,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @new_integer() {
%1 = alloca i32
store i32 42, i32* %1
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @new_integer() {
ret i32 42
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ assume(int);
int main() {
  int i;
  int n;
  i = 3;
  assume(n >= 10000);
  assume(n <= 20000);
  int origN;
  origN = n;
  while (n > 0) {
    i = i + 1;
    n = n - 1;
  }
  assert(i >= 11000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x2710,-0xc(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assume@plt>
cmpl   $0x4e20,-0xc(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assume@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1185 <main+0x65>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1164 <main+0x44>
cmpl   $0x2af8,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 10000
%7 = zext i1 %6 to i32
%8 = call i32 @assume(i32 %7)
%9 = load i32, i32* %3
%10 = icmp sle i32 %9, 20000
%11 = zext i1 %10 to i32
%12 = call i32 @assume(i32 %11)
%13 = load i32, i32* %3
store i32 %13, i32* %4
br label %14
14: ; preds = %17, %0
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 1
store i32 %21, i32* %3
br label %14
22: ; preds = %14
%23 = load i32, i32* %2
%24 = icmp sge i32 %23, 11000
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assume(i32 1)
%2 = tail call i32 @assume(i32 1)
%3 = tail call i32 @assert(i32 0)
ret i32 0
}
char memory_get_bit_from_word(unsigned short value, unsigned char pos) {
  return ((value >> pos) & 0x1);
}


x86 assembly (clang, -O0):
<memory_get_bit_from_word>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzwl -0x2(%rbp),%eax
movzbl -0x3(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memory_get_bit_from_word>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    $0x1,%al
ret

LLVM IR (-O0):
define signext i8 @memory_get_bit_from_word(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = ashr i32 %6, %8
%10 = and i32 %9, 1
%11 = trunc i32 %10 to i8
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @memory_get_bit_from_word(i16 zeroext %0, i8 zeroext %1) {
%3 = zext i16 %0 to i32
%4 = zext i8 %1 to i32
%5 = lshr i32 %3, %4
%6 = trunc i32 %5 to i8
%7 = and i8 %6, 1
ret i8 %7
}
adr0indreg1(r0, r1, x0, x1, p0, p1) unsigned short r0, r1;
unsigned short *p0, *p1;
{
  if ((*((unsigned short *)10000000)) <= (*p1))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adr0indreg1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    $0x989680,%eax
movzwl (%rax),%eax
mov    -0x20(%rbp),%rcx
movzwl (%rcx),%ecx
cmp    %ecx,%eax
jg     1142 <adr0indreg1+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1149 <adr0indreg1+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adr0indreg1>:
movzwl 0x989680,%ecx
xor    %eax,%eax
cmp    (%r9),%cx
setbe  %al
ret

LLVM IR (-O0):
define i32 @adr0indreg1(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i16, i16* inttoptr (i64 10000000 to i16*)
%17 = zext i16 %16 to i32
%18 = load i16*, i16** %13
%19 = load i16, i16* %18
%20 = zext i16 %19 to i32
%21 = icmp sle i32 %17, %20
br i1 %21, label %22, label %23
22: ; preds = %6
store i32 1, i32* %7
br label %24
23: ; preds = %6
store i32 0, i32* %7
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %7
ret i32 %25
}

LLVM IR (-O2):
define i32 @adr0indreg1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture %5) {
%7 = load i16, i16* inttoptr (i64 10000000 to i16*)
%8 = load i16, i16* %5
%9 = icmp ule i16 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ A_minus_B_K();
void closed_loop(void) { A_minus_B_K(); }


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

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

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

LLVM IR (-O2):
define void @closed_loop() {
%1 = tail call i32 (...) @A_minus_B_K()
ret void
}
int blk_oversized_queue_2(int *q) {
  if (q[2])
    return q[1] > 5;
  return (q[0] < 5);
}


x86 assembly (clang, -O0):
<blk_oversized_queue_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x8(%rax)
je     112e <blk_oversized_queue_2+0x2e>
mov    -0x10(%rbp),%rax
cmpl   $0x5,0x4(%rax)
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1140 <blk_oversized_queue_2+0x40>
mov    -0x10(%rbp),%rax
cmpl   $0x5,(%rax)
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<blk_oversized_queue_2>:
cmpl   $0x0,0x8(%rdi)
je     1111 <blk_oversized_queue_2+0x11>
cmpl   $0x6,0x4(%rdi)
setge  %al
movzbl %al,%eax
ret
cmpl   $0x5,(%rdi)
setl   %al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @blk_oversized_queue_2(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = icmp sgt i32 %7, 5
br label %12
9: ; preds = %1
%10 = load i32, i32* %0
%11 = icmp slt i32 %10, 5
br label %12
12: ; preds = %9, %5
%13 = phi i1 [ %8, %5 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
ret i32 %14
}
void swap_str_ptr(char **str_a, char **str_b) {
  char *temp = *str_a;
  *str_a = *str_b;
  *str_b = temp;
}


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

x86 assembly (clang, -O2):
<swap_str_ptr>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
mov    %rcx,(%rdi)
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
define void @swap_str_ptr(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i8*
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
store i8* %7, i8** %5
%8 = load i8**, i8*** %4
%9 = load i8*, i8** %8
%10 = load i8**, i8*** %3
store i8* %9, i8** %10
%11 = load i8*, i8** %5
%12 = load i8**, i8*** %4
store i8* %11, i8** %12
ret void
}

LLVM IR (-O2):
define void @swap_str_ptr(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
store i8* %4, i8** %0
store i8* %3, i8** %1
ret void
}
int ff_get_atom_count(struct ff *ff) {
  (void)ff;
  return (0);
}


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

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

LLVM IR (-O0):
%struct.ff = type opaque
define i32 @ff_get_atom_count(%struct.ff* %0) {
%2 = alloca %struct.ff*
store %struct.ff* %0, %struct.ff** %2
%3 = load %struct.ff*, %struct.ff** %2
ret i32 0
}

LLVM IR (-O2):
%struct.ff = type opaque
define i32 @ff_get_atom_count(%struct.ff* nocapture readnone %0) {
ret i32 0
}
void common_initialize(int power_on) {}


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

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

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

LLVM IR (-O2):
define void @common_initialize(i32 %0) {
ret void
}
/* Variables and functions */
int __munmap(void *, size_t);
int munmap(void *start, size_t length) { return __munmap(start, length); }


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

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

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

LLVM IR (-O2):
define i32 @munmap(i8* %0, i64 %1) {
%3 = tail call i32 @__munmap(i8* %0, i64 %1)
ret i32 %3
}
void scsi_handler(int irq) {}


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

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

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

LLVM IR (-O2):
define void @scsi_handler(i32 %0) {
ret void
}
/* Variables and functions */
bool nrf51_errata_29(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf51_errata_29() {
ret i32 0
}
/* Type definitions */
struct prng {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct prng *);
void prng_free(struct prng *prng) { free(prng); }


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

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

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

LLVM IR (-O2):
%struct.prng = type { i32 }
define void @prng_free(%struct.prng* nocapture %0) {
%2 = tail call i32 @free(%struct.prng* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int symlinkat(char const *, int /*<<< orphan*/, char const *);
int symlink(const char *targetPath, const char *linkPath) {
  return symlinkat(targetPath, AT_FDCWD, linkPath);
}


x86 assembly (clang, -O0):
<symlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1030 <symlinkat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<symlink>:
mov    %rsi,%rdx
mov    0x2ebe(%rip),%rax
mov    (%rax),%esi
jmp    1030 <symlinkat@plt>

LLVM IR (-O0):
@AT_FDCWD = global i32 0
define i32 @symlink(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 i32, i32* @AT_FDCWD
%7 = load i8*, i8** %4
%8 = call i32 @symlinkat(i8* %5, i32 %6, i8* %7)
ret i32 %8
}

LLVM IR (-O2):
@AT_FDCWD = global i32 0
define i32 @symlink(i8* %0, i8* %1) {
%3 = load i32, i32* @AT_FDCWD
%4 = tail call i32 @symlinkat(i8* %0, i32 %3, i8* %1)
ret i32 %4
}
/* Variables and functions */
int __NONDET__();
int foo(int *x) {
  *x = __NONDET__();
  return __NONDET__();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__NONDET__@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <__NONDET__@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <__NONDET__@plt>
mov    %eax,(%rbx)
xor    %eax,%eax
pop    %rbx
jmp    1030 <__NONDET__@plt>

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

LLVM IR (-O2):
define i32 @foo(i32* nocapture writeonly %0) {
%2 = tail call i32 (...) @__NONDET__()
store i32 %2, i32* %0
%3 = tail call i32 (...) @__NONDET__()
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("No tests to run.\n"); }


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"No tests to run.\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [17 x i8] c"No tests to run.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Init();
void ProfileReset() { Init(); }


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

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

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

LLVM IR (-O2):
define void @ProfileReset() {
%1 = tail call i32 (...) @Init()
ret void
}
/* Type definitions */
typedef int uint32_t;
struct buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ put16le(struct buffer *, int);
void put32le(struct buffer *input, uint32_t val) {
  put16le(input, val);
  put16le(input, val >> 16);
}


x86 assembly (clang, -O0):
<put32le>:
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 <put16le@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sar    $0x10,%esi
call   1030 <put16le@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put32le>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
call   1030 <put16le@plt>
sar    $0x10,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <put16le@plt>

LLVM IR (-O0):
%struct.buffer = type { i32 }
define void @put32le(%struct.buffer* %0, i32 %1) {
%3 = alloca %struct.buffer*
%4 = alloca i32
store %struct.buffer* %0, %struct.buffer** %3
store i32 %1, i32* %4
%5 = load %struct.buffer*, %struct.buffer** %3
%6 = load i32, i32* %4
%7 = call i32 @put16le(%struct.buffer* %5, i32 %6)
%8 = load %struct.buffer*, %struct.buffer** %3
%9 = load i32, i32* %4
%10 = ashr i32 %9, 16
%11 = call i32 @put16le(%struct.buffer* %8, i32 %10)
ret void
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
define void @put32le(%struct.buffer* %0, i32 %1) {
%3 = tail call i32 @put16le(%struct.buffer* %0, i32 %1)
%4 = ashr i32 %1, 16
%5 = tail call i32 @put16le(%struct.buffer* %0, i32 %4)
ret void
}
int bitand_funktion(int var1, int var2) { return (var1 & var2); }


x86 assembly (clang, -O0):
<bitand_funktion>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitand_funktion>:
mov    %edi,%eax
and    %esi,%eax
ret

LLVM IR (-O0):
define i32 @bitand_funktion(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 = and i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @bitand_funktion(i32 %0, i32 %1) {
%3 = and i32 %1, %0
ret i32 %3
}
int cgroup_pids_can_fork(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @cgroup_pids_can_fork() {
ret i32 0
}
lower_case_str(char *s) {
  char *p;
  for (p = s; *p; p++) {
    if (*p >= 'A' && *p <= 'Z')
      *p = *p - 'A' + 'a';
  }
}


x86 assembly (clang, -O0):
<lower_case_str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1168 <lower_case_str+0x68>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     1152 <lower_case_str+0x52>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     1152 <lower_case_str+0x52>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
jmp    1157 <lower_case_str+0x57>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1110 <lower_case_str+0x10>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower_case_str>:
mov    (%rdi),%al
test   %al,%al
je     112a <lower_case_str+0x2a>
add    $0x1,%rdi
jmp    111b <lower_case_str+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     112a <lower_case_str+0x2a>
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     1110 <lower_case_str+0x10>
add    $0x20,%al
mov    %al,-0x1(%rdi)
jmp    1110 <lower_case_str+0x10>
ret

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

LLVM IR (-O2):
define i32 @lower_case_str(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %13, %11 ], [ %2, %1 ]
%6 = phi i8* [ %12, %11 ], [ %0, %1 ]
%7 = add i8 %5, -65
%8 = icmp ult i8 %7, 26
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = add nuw nsw i8 %5, 32
store i8 %10, i8* %6
br label %11
11: ; preds = %4, %9
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %11, %1
ret i32 undef
}
int dqs_dly_select(struct ddr_set *ddr_setting, unsigned char *phase,
                   unsigned char *tra, unsigned *tr, unsigned char *dqs,
                   unsigned char *dqsn) {
  return 0;
}


x86 assembly (clang, -O0):
<dqs_dly_select>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ddr_set = type opaque
define i32 @dqs_dly_select(%struct.ddr_set* %0, i8* %1, i8* %2, i32* %3, i8* %4, i8* %5) {
%7 = alloca %struct.ddr_set*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca i8*
store %struct.ddr_set* %0, %struct.ddr_set** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32* %3, i32** %10
store i8* %4, i8** %11
store i8* %5, i8** %12
ret i32 0
}

LLVM IR (-O2):
%struct.ddr_set = type opaque
define i32 @dqs_dly_select(%struct.ddr_set* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i32* nocapture readnone %3, i8* nocapture readnone %4, i8* nocapture readnone %5) {
ret i32 0
}