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

/* Variables and functions */
int /*<<< orphan*/ err(int, char *, size_t);
size_t read(int, int /*<<< orphan*/ *, int);
uint64_t readctr(int fd) {
  uint64_t data;
  size_t s = read(fd, &data, sizeof(data));
  if (s != sizeof(uint64_t)) {
    err(1, "read counter %lu", s);
  }
  return data;
}


x86 assembly (clang, -O0):
<readctr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1030 <read@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x4,-0x10(%rbp)
je     1160 <readctr+0x40>
mov    -0x10(%rbp),%rdx
mov    $0x1,%edi
lea    0xea5(%rip),%rsi
call   1040 <err@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readctr>:
push   %rax
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <read@plt>
cmp    $0x4,%rax
je     114a <readctr+0x2a>
lea    0xec3(%rip),%rsi
mov    $0x1,%edi
mov    %rax,%rdx
call   1040 <err@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"read counter %lu\00"
define i32 @readctr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i64 @read(i32 %5, i32* %3, i32 4)
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = icmp ne i64 %7, 4
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i64, i64* %4
%11 = call i32 @err(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %10)
br label %12
12: ; preds = %9, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@.str = [17 x i8] c"read counter %lu\00"
define i32 @readctr(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i64 @read(i32 %0, i32* %2, i32 4)
%5 = icmp eq i64 %4, 4
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %4)
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ Inst_Printf(char *, char *, char *);
void Call_C_Invoke(char *fct_name, int fc, int nb_args, int nb_args_in_words) {
  Inst_Printf("call", "%s", fct_name);
}


x86 assembly (clang, -O0):
<Call_C_Invoke>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rdi
lea    0xece(%rip),%rsi
call   1030 <Inst_Printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"call\00"
@.str.1 = [3 x i8] c"%s\00"
define void @Call_C_Invoke(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"call\00"
@.str.1 = [3 x i8] c"%s\00"
define void @Call_C_Invoke(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ log_warn(char *, int, int);
int /*<<< orphan*/ test_fail();
void ensure_equali(int a, int b) {
  if (a != b) {
    log_warn("values differ: %d != %d", a, b);
    test_fail();
  }
}


x86 assembly (clang, -O0):
<ensure_equali>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     1153 <ensure_equali+0x33>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeb9(%rip),%rdi
call   1040 <log_warn@plt>
mov    $0x0,%al
call   1030 <test_fail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ensure_equali>:
mov    %esi,%edx
cmp    %esi,%edi
jne    1127 <ensure_equali+0x7>
ret
push   %rax
mov    %edi,%esi
lea    0xecf(%rip),%rdi
call   1040 <log_warn@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <test_fail@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"values differ: %d != %d\00"
define void @ensure_equali(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 = icmp ne i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @log_warn(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
%12 = call i32 (...) @test_fail()
br label %13
13: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"values differ: %d != %d\00"
define void @ensure_equali(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @log_warn(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%6 = tail call i32 (...) @test_fail()
br label %7
7: ; preds = %4, %2
ret void
}
void Strcpy(char *dest, char *src, unsigned int size) {
  int i = 0;
  while (i < size) {
    dest[i] = src[i];
    if (src[i] == '\0') {
      break;
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<Strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1160 <Strcpy+0x60>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    1152 <Strcpy+0x52>
jmp    1160 <Strcpy+0x60>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1116 <Strcpy+0x16>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Strcpy>:
test   %edx,%edx
je     112c <Strcpy+0x2c>
mov    %edx,%eax
mov    $0x1,%ecx
nopl   0x0(%rax,%rax,1)
movzbl -0x1(%rsi,%rcx,1),%edx
mov    %dl,-0x1(%rdi,%rcx,1)
cmpb   $0x0,-0x1(%rsi,%rcx,1)
je     112c <Strcpy+0x2c>
lea    0x1(%rcx),%rdx
cmp    %rax,%rcx
mov    %rdx,%rcx
jb     1110 <Strcpy+0x10>
ret

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

LLVM IR (-O2):
define void @Strcpy(i8* nocapture writeonly %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %17, label %5
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %7, %5
%8 = phi i64 [ %14, %7 ], [ 0, %5 ]
%9 = getelementptr inbounds i8, i8* %1, i64 %8
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 %10, i8* %11
%12 = load i8, i8* %9
%13 = icmp ne i8 %12, 0
%14 = add nuw nsw i64 %8, 1
%15 = icmp ult i64 %14, %6
%16 = select i1 %13, i1 %15, i1 false
br i1 %16, label %7, label %17
17: ; preds = %7, %3
ret void
}
/* Variables and functions */
__attribute__((always_)) size_t brotli_max_size_t(size_t a, size_t b) {
  return a > b ? a : b;
}


x86 assembly (clang, -O0):
<brotli_max_size_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1127 <brotli_max_size_t+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <brotli_max_size_t+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<brotli_max_size_t>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmova  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @brotli_max_size_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ugt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @brotli_max_size_t(i64 %0, i64 %1) {
%3 = icmp ugt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int close(int);
int readdir_close(int fd) { return close(fd); }


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

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

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

LLVM IR (-O2):
define i32 @readdir_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void print_usage_exit(int exit_code) {
  printf("Usage : \n1. Using a file to upgrade : upgraded firmware_file\n2. "
         "Using an URL to upgrade : upgraded -u URL\n3. Using \"firmware.bin\" "
         "in SD card to upgrade : upgraded -s\n4. Using \"firmware.bin\" in "
         "USB card to upgrade : upgraded -b\n5. Using \"firmware.bin\" in SD "
         "or USB card to upgrade, auto detect : upgraded -a\n");
  exit(exit_code);
}


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

x86 assembly (clang, -O2):
<print_usage_exit>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [308 x i8] c"Usage : \0A1. Using a file to upgrade : upgraded firmware_file\0A2. Using an URL to upgrade : upgraded -u URL\0A3. Using \22firmware.bin\22 in SD card to upgrade : upgraded -s\0A4. Using \22firmware.bin\22 in USB card to upgrade : upgraded -b\0A5. Using \22firmware.bin\22 in SD or USB card to upgrade, auto detect : upgraded -a\0A\00"
define void @print_usage_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([308 x i8], [308 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@str = [307 x i8] c"Usage : \0A1. Using a file to upgrade : upgraded firmware_file\0A2. Using an URL to upgrade : upgraded -u URL\0A3. Using \22firmware.bin\22 in SD card to upgrade : upgraded -s\0A4. Using \22firmware.bin\22 in USB card to upgrade : upgraded -b\0A5. Using \22firmware.bin\22 in SD or USB card to upgrade, auto detect : upgraded -a\00"
define void @print_usage_exit(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([307 x i8], [307 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ abs(int);
void uninitvar_abs(void) {
  int i;
  (void)abs(i);
}


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

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

LLVM IR (-O0):
define void @uninitvar_abs() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @abs(i32 %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_abs() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *xmalloc(size_t size) {
  void *ptr = malloc(size);
  if (!ptr) {
    fprintf(stderr, "out of memory\n");
    exit(1);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1173 <xmalloc+0x43>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <xmalloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"out of memory\0A\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"out of memory\0A\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ core12_swap(char *, int);
void U_EMRCREATEDIBPATTERNBRUSHPT_swap(char *record, int torev) {
  core12_swap(record, torev);
}


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

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

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

LLVM IR (-O2):
define void @U_EMRCREATEDIBPATTERNBRUSHPT_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core12_swap(i8* %0, i32 %1)
ret void
}
long giInterlockedIncrement(volatile long *p) {
  return __sync_add_and_fetch(p, 1L);
}


x86 assembly (clang, -O0):
<giInterlockedIncrement>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x1,%eax
lock xadd %rax,(%rcx)
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<giInterlockedIncrement>:
mov    $0x1,%eax
lock xadd %rax,(%rdi)
add    $0x1,%rax
ret

LLVM IR (-O0):
define i64 @giInterlockedIncrement(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = atomicrmw add i64* %3, i64 1 seq_cst
%5 = add i64 %4, 1
ret i64 %5
}

LLVM IR (-O2):
define i64 @giInterlockedIncrement(i64* nocapture %0) {
%2 = atomicrmw add i64* %0, i64 1 seq_cst
%3 = add i64 %2, 1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_CLR_PW4_PIN() { clear_io_bit(0x40, 4); }


x86 assembly (clang, -O0):
<TOSH_CLR_PW4_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40,%edi
mov    $0x4,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_CLR_PW4_PIN>:
mov    $0x40,%edi
mov    $0x4,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_CLR_PW4_PIN() {
%1 = call i32 @clear_io_bit(i32 64, i32 4)
ret void
}

LLVM IR (-O2):
define void @TOSH_CLR_PW4_PIN() {
%1 = tail call i32 @clear_io_bit(i32 64, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int fail_helper(void) {
  fprintf(stdout, "First line to stdout\n");
  fprintf(stderr, "First line to stderr\n");
  return 78;
}


x86 assembly (clang, -O0):
<fail_helper>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x4e,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fail_helper>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x4e,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [22 x i8] c"First line to stdout\0A\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"First line to stderr\0A\00"
define i32 @fail_helper() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret i32 78
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [22 x i8] c"First line to stdout\0A\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"First line to stderr\0A\00"
define i32 @fail_helper() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret i32 78
}
void RTTimerCreate(void) {}


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

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

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

LLVM IR (-O2):
define void @RTTimerCreate() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int rt_modbus_loopback(uint8_t *buf, int sz) { return 8; }


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

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

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

LLVM IR (-O2):
define i32 @rt_modbus_loopback(i32* nocapture readnone %0, i32 %1) {
ret i32 8
}
void NmiSR(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<NmiSR>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <NmiSR+0x9>
jmp    1109 <NmiSR+0x9>

x86 assembly (clang, -O2):
<NmiSR>:
jmp    1100 <NmiSR>

LLVM IR (-O0):
define void @NmiSR() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @NmiSR() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ test_parser_sourcefile(char *, char *);
int /*<<< orphan*/ test_parser_verify_parse(int /*<<< orphan*/, char *, char *,
                                            char *, int /*<<< orphan*/);
void test_lua_comments() {
  test_parser_verify_parse(test_parser_sourcefile("lua", " -- comment"), "lua",
                           "", "-- comment", 0);
}


x86 assembly (clang, -O0):
<test_lua_comments>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1030 <test_parser_sourcefile@plt>
mov    %eax,%edi
lea    0xec0(%rip),%rsi
lea    0xebc(%rip),%rdx
lea    0xeb7(%rip),%rcx
xor    %r8d,%r8d
call   1040 <test_parser_verify_parse@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_lua_comments>:
push   %rbx
lea    0xed8(%rip),%rbx
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test_parser_sourcefile@plt>
lea    0xec5(%rip),%rdx
lea    0xec0(%rip),%rcx
mov    %eax,%edi
mov    %rbx,%rsi
xor    %r8d,%r8d
pop    %rbx
jmp    1040 <test_parser_verify_parse@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"lua\00"
@.str.1 = [12 x i8] c" -- comment\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [11 x i8] c"-- comment\00"
define void @test_lua_comments() {
%1 = call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"lua\00"
@.str.1 = [12 x i8] c" -- comment\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [11 x i8] c"-- comment\00"
define void @test_lua_comments() {
%1 = tail call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
void emit(void *pp, size_t ss) {
  unsigned char *cc = (char *)0;
  for (cc = (unsigned char *)pp; ss > 0; --ss) {
    printf("\\x%02x", *(cc++));
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<emit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jbe    117a <emit+0x5a>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movzbl (%rax),%esi
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1140 <emit+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1156 <emit+0x36>
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xec4(%rip),%r15
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%esi
mov    %r15,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <emit+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"\\x%02x\00"
define void @emit(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
store i8* null, i8** %5
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %16, %2
%8 = load i64, i64* %4
%9 = icmp ugt i64 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %5
%13 = load i8, i8* %11
%14 = zext i8 %13 to i32
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %10
%17 = load i64, i64* %4
%18 = add i64 %17, -1
store i64 %18, i64* %4
br label %7
19: ; preds = %7
%20 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\\x%02x\00"
define void @emit(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %7, %4 ], [ %0, %2 ]
%6 = phi i64 [ %11, %4 ], [ %1, %2 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = load i8, i8* %5
%9 = zext i8 %8 to i32
%10 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add i64 %6, -1
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = tail call i32 @putchar(i8 signext 10)
ret void
}
float flt_add(float a, float b) { return a + b; }


x86 assembly (clang, -O0):
<flt_add>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<flt_add>:
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @flt_add(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fadd float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @flt_add(float %0, float %1) {
%3 = fadd float %0, %1
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ change_pname(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void fork_procs(void) {
  change_pname("A");
  printf("A: Sleeping...\n");
  sleep(10);
  printf("A: Exiting...\n");
  exit(16);
}


x86 assembly (clang, -O0):
<fork_procs>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1030 <change_pname@plt>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1060 <sleep@plt>
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x10,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<fork_procs>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <change_pname@plt>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
mov    $0xa,%edi
call   1060 <sleep@plt>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x10,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"A\00"
@.str.1 = [16 x i8] c"A: Sleeping...\0A\00"
@.str.2 = [15 x i8] c"A: Exiting...\0A\00"
define void @fork_procs() {
%1 = call i32 @change_pname(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @sleep(i32 10)
%4 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @exit(i32 16)
unreachable
}

LLVM IR (-O2):
@.str = [2 x i8] c"A\00"
@str = [15 x i8] c"A: Sleeping...\00"
@str.3 = [14 x i8] c"A: Exiting...\00"
define void @fork_procs() {
%1 = tail call i32 @change_pname(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 10)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.3, i64 0, i64 0))
%5 = tail call i32 @exit(i32 16)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int A, B;
  scanf("%d %d", &A, &B);
  printf("SOMA = %d\n", (A + B));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%esi
add    0x4(%rsp),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [11 x i8] c"SOMA = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = add nsw i32 %5, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [11 x i8] c"SOMA = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = add nsw i32 %7, %6
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}
double percent(double a, double b) { return b ? 100.0 * a / b : 0.0; }


x86 assembly (clang, -O0):
<percent>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    112b <percent+0x2b>
jp     112b <percent+0x2b>
jmp    1147 <percent+0x47>
movsd  0xecd(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1154 <percent+0x54>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1154 <percent+0x54>
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<percent>:
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    110c <percent+0xc>
jnp    111c <percent+0x1c>
mulsd  0xeec(%rip),%xmm0
divsd  %xmm1,%xmm0
movapd %xmm0,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @percent(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp une double %5, 0.000000e+00
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load double, double* %3
%9 = fmul double 1.000000e+02, %8
%10 = load double, double* %4
%11 = fdiv double %9, %10
br label %13
12: ; preds = %2
br label %13
13: ; preds = %12, %7
%14 = phi double [ %11, %7 ], [ 0.000000e+00, %12 ]
ret double %14
}

LLVM IR (-O2):
define double @percent(double %0, double %1) {
%3 = fcmp une double %1, 0.000000e+00
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = fmul double %0, 1.000000e+02
%6 = fdiv double %5, %1
br label %7
7: ; preds = %2, %4
%8 = phi double [ %6, %4 ], [ 0.000000e+00, %2 ]
ret double %8
}
void outw(unsigned short portnum, unsigned short data) {
  asm("outw %%ax,%%dx" ::"a"(data), "d"(portnum));
}


x86 assembly (clang, -O0):
<outw>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x4(%rbp),%ax
mov    -0x2(%rbp),%dx
out    %ax,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outw>:
mov    %esi,%eax
mov    %edi,%edx
out    %ax,(%dx)
ret

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

LLVM IR (-O2):
define void @outw(i16 zeroext %0, i16 zeroext %1) {
tail call void asm sideeffect "outw %ax,%dx", "{ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %1, i16 %0)
ret void
}
void RandomFunc(unsigned short input[1], unsigned short output[1]) {
  unsigned short state[1];
  unsigned short local1;
  {
    state[0UL] = (input[0UL] - 51238316UL) - (unsigned short)47038;
    local1 = 0UL;
    while (local1 < (unsigned short)0) {
      state[0UL] |= (state[0UL] & (unsigned short)63) << 4UL;
      local1++;
    }
    output[0UL] = ((state[0UL] << (unsigned short)7) |
                   (state[0UL] >> (unsigned short)9)) -
                  (unsigned short)28768;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
sub    $0x30dd5ac,%rax
sub    $0xb7be,%rax
mov    %ax,-0x12(%rbp)
movw   $0x0,-0x14(%rbp)
movzwl -0x14(%rbp),%eax
cmp    $0x0,%eax
jge    115b <RandomFunc+0x5b>
movzwl -0x12(%rbp),%ecx
and    $0x3f,%ecx
shl    $0x4,%ecx
movzwl -0x12(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0x12(%rbp)
mov    -0x14(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x14(%rbp)
jmp    1129 <RandomFunc+0x29>
movzwl -0x12(%rbp),%eax
shl    $0x7,%eax
movzwl -0x12(%rbp),%ecx
sar    $0x9,%ecx
or     %ecx,%eax
sub    $0x7060,%eax
mov    %ax,%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
movzwl (%rdi),%eax
add    $0x7296,%eax
rol    $0x7,%ax
add    $0xffff8fa0,%eax
mov    %ax,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i16* %0, i16* %1) {
%3 = alloca i16*
%4 = alloca i16*
%5 = alloca [1 x i16]
%6 = alloca i16
store i16* %0, i16** %3
store i16* %1, i16** %4
%7 = load i16*, i16** %3
%8 = getelementptr inbounds i16, i16* %7, i64 0
%9 = load i16, i16* %8
%10 = zext i16 %9 to i64
%11 = sub i64 %10, 51238316
%12 = sub i64 %11, 47038
%13 = trunc i64 %12 to i16
%14 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
store i16 %13, i16* %14
store i16 0, i16* %6
br label %15
15: ; preds = %19, %2
%16 = load i16, i16* %6
%17 = zext i16 %16 to i32
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %32
19: ; preds = %15
%20 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
%21 = load i16, i16* %20
%22 = zext i16 %21 to i32
%23 = and i32 %22, 63
%24 = shl i32 %23, 4
%25 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
%26 = load i16, i16* %25
%27 = zext i16 %26 to i32
%28 = or i32 %27, %24
%29 = trunc i32 %28 to i16
store i16 %29, i16* %25
%30 = load i16, i16* %6
%31 = add i16 %30, 1
store i16 %31, i16* %6
br label %15
32: ; preds = %15
%33 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
%34 = load i16, i16* %33
%35 = zext i16 %34 to i32
%36 = shl i32 %35, 7
%37 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
%38 = load i16, i16* %37
%39 = zext i16 %38 to i32
%40 = ashr i32 %39, 9
%41 = or i32 %36, %40
%42 = sub nsw i32 %41, 28768
%43 = trunc i32 %42 to i16
%44 = load i16*, i16** %4
%45 = getelementptr inbounds i16, i16* %44, i64 0
store i16 %43, i16* %45
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i16* nocapture %0, i16* nocapture writeonly %1) {
%3 = load i16, i16* %0
%4 = add i16 %3, 29334
%5 = tail call i16 @llvm.fshl.i16(i16 %4, i16 %4, i16 7)
%6 = add i16 %5, -28768
store i16 %6, i16* %1
ret void
}
int positive(float f) { return f >= 0 ? 1 : 0; }


x86 assembly (clang, -O0):
<positive>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
xor    %eax,%eax
mov    $0x1,%ecx
ucomiss %xmm1,%xmm0
cmovae %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<positive>:
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm1,%xmm0
setae  %al
ret

LLVM IR (-O0):
define i32 @positive(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp oge float %3, 0.000000e+00
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 0
ret i32 %6
}

LLVM IR (-O2):
define i32 @positive(float %0) {
%2 = fcmp oge float %0, 0.000000e+00
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
char *heapdup(char const *);
char *heapdupnull(const char *s) { return s ? heapdup(s) : NULL; }


x86 assembly (clang, -O0):
<heapdupnull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1139 <heapdupnull+0x29>
mov    -0x8(%rbp),%rdi
call   1030 <heapdup@plt>
mov    %rax,-0x10(%rbp)
jmp    1144 <heapdupnull+0x34>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1144 <heapdupnull+0x34>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heapdupnull>:
test   %rdi,%rdi
je     111a <heapdupnull+0xa>
jmp    1030 <heapdup@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @heapdupnull(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i8* @heapdup(i8* %6)
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
%10 = phi i8* [ %7, %5 ], [ null, %8 ]
ret i8* %10
}

LLVM IR (-O2):
define i8* @heapdupnull(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @heapdup(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_event_now(void *e, clockid_t clock, uint64_t *usec) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_event_now>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
mov    0x2ec8(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_event_now>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_event_now(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* @EINVAL
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_event_now(i8* nocapture readnone %0, i32 %1, i32* nocapture readnone %2) {
%4 = load i32, i32* @EINVAL
%5 = sub nsw i32 0, %4
ret i32 %5
}
/* Variables and functions */
int w5100_readSn_byte(unsigned int, int);
unsigned w5100_readSnIR(unsigned sock) {
  return w5100_readSn_byte(sock, 0x0002);
}


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

x86 assembly (clang, -O2):
mov    $0x2,%esi
jmp    1030 <w5100_readSn_byte@plt>

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

LLVM IR (-O2):
define i32 @w5100_readSnIR(i32 %0) {
%2 = tail call i32 @w5100_readSn_byte(i32 %0, i32 2)
ret i32 %2
}
int variant_length(int proto_id, int value) {
  int n = 0;
  if (proto_id >> 7 != 0) {
    n += 1;
  }
  do {
    value >>= 7;
    n++;
  } while (value != 0);
  return n;
}


x86 assembly (clang, -O0):
<variant_length>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x7,%eax
cmp    $0x0,%eax
je     1129 <variant_length+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112e <variant_length+0x2e>
mov    -0x8(%rbp),%eax
sar    $0x7,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    112e <variant_length+0x2e>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<variant_length>:
xor    %eax,%eax
cmp    $0x7f,%edi
seta   %al
mov    %esi,%ecx
nopw   0x0(%rax,%rax,1)
sar    $0x7,%ecx
add    $0x1,%eax
cmp    $0x7f,%esi
mov    %ecx,%esi
ja     1110 <variant_length+0x10>
ret

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

LLVM IR (-O2):
define i32 @variant_length(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, 127
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %5, %2
%6 = phi i32 [ %1, %2 ], [ %8, %5 ]
%7 = phi i32 [ %4, %2 ], [ %9, %5 ]
%8 = ashr i32 %6, 7
%9 = add nuw nsw i32 %7, 1
%10 = icmp ult i32 %6, 128
br i1 %10, label %11, label %5
11: ; preds = %5
ret i32 %9
}
int test_imm_BAuint16_reg(unsigned short val) {
  return ((val) & (0xBA << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_BAuint16_reg>:
test   $0xba,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_BAuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 186
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ss2qfc(float *, float *, float *);
void ss2qfc_(float *r, float *g, float *b) { ss2qfc(r, g, b); }


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

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

LLVM IR (-O0):
define void @ss2qfc_(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 i32 @ss2qfc(float* %7, float* %8, float* %9)
ret void
}

LLVM IR (-O2):
define void @ss2qfc_(float* %0, float* %1, float* %2) {
%4 = tail call i32 @ss2qfc(float* %0, float* %1, float* %2)
ret void
}
void enqueue(queue) {}


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

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

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

LLVM IR (-O2):
define void @enqueue(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ AES_KEY;

/* Variables and functions */
int /*<<< orphan*/ AES_encrypt(unsigned char const *, unsigned char *,
                               int /*<<< orphan*/ *);
int AES_set_encrypt_key(unsigned char const *, int, int /*<<< orphan*/ *);
int aes_encrypt(const unsigned char *in, unsigned char *out,
                const unsigned char *key) {
  AES_KEY rkey;
  int r = AES_set_encrypt_key(key, 128, &rkey);
  AES_encrypt(in, out, &rkey);
  return r;
}


x86 assembly (clang, -O0):
<aes_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x80,%esi
lea    -0x1c(%rbp),%rdx
call   1030 <AES_set_encrypt_key@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1040 <AES_encrypt@plt>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aes_encrypt>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x4(%rsp),%r15
mov    %rdx,%rdi
mov    $0x80,%esi
mov    %r15,%rdx
call   1030 <AES_set_encrypt_key@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <AES_encrypt@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @aes_encrypt(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
%10 = call i32 @AES_set_encrypt_key(i8* %9, i32 128, i32* %7)
store i32 %10, i32* %8
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = call i32 @AES_encrypt(i8* %11, i8* %12, i32* %7)
%14 = load i32, i32* %8
ret i32 %14
}

LLVM IR (-O2):
define i32 @aes_encrypt(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @AES_set_encrypt_key(i8* %2, i32 128, i32* %4)
%7 = call i32 @AES_encrypt(i8* %0, i8* %1, i32* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void visit(int x) { printf("Visiting item %i\n", x); }


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

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

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

LLVM IR (-O2):
@.str = [18 x i8] c"Visiting item %i\0A\00"
define void @visit(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int sscanf(char const *, char *, unsigned int *);
int whichfd(const char *pathname) {
  unsigned int fd;
  if (sscanf(pathname, "/dev/fd/%u", &fd) == 1)
    return fd;
  else
    return -1;
}


x86 assembly (clang, -O0):
<whichfd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <sscanf@plt>
cmp    $0x1,%eax
jne    1144 <whichfd+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <whichfd+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whichfd>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x1,%ecx
jne    1132 <whichfd+0x22>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"/dev/fd/%u\00"
define i32 @whichfd(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %4)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32, i32* %4
store i32 %9, i32* %2
br label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %11
11: ; preds = %10, %8
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
@.str = [11 x i8] c"/dev/fd/%u\00"
define i32 @whichfd(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = icmp eq i32 %4, 1
%6 = load i32, i32* %2
%7 = select i1 %5, i32 %6, i32 -1
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void system_free(void *ptr) { free(ptr); }


x86 assembly (clang, -O0):
<system_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):
<system_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @system_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}