xunge/DecIR huggingface dataset:
/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int atoi(char *);
scalar_t__ file_read(int, char *, int);
int file_read_int_fd(int fd, int *tmp) {
  char buf[20];
  if (file_read(fd, buf, 20) < 0) {
    return EXIT_FAILURE;
  }
  *tmp = atoi(buf);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<file_read_int_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x14,%edx
call   1030 <file_read@plt>
cmp    $0x0,%rax
jge    115b <file_read_int_fd+0x3b>
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <file_read_int_fd+0x58>
lea    -0x30(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_read_int_fd>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    %rsp,%rsi
mov    $0x14,%edx
call   1030 <file_read@plt>
test   %rax,%rax
js     114d <file_read_int_fd+0x2d>
mov    %rsp,%rdi
call   1040 <atoi@plt>
mov    %eax,(%rbx)
mov    0x2e8d(%rip),%rax
jmp    1154 <file_read_int_fd+0x34>
mov    0x2e8c(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @file_read_int_fd(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca [20 x i8]
store i32 %0, i32* %4
store i32* %1, i32** %5
%7 = load i32, i32* %4
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%9 = call i64 @file_read(i32 %7, i8* %8, i32 20)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32, i32* @EXIT_FAILURE
store i32 %12, i32* %3
br label %18
13: ; preds = %2
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%15 = call i32 @atoi(i8* %14)
%16 = load i32*, i32** %5
store i32 %15, i32* %16
%17 = load i32, i32* @EXIT_SUCCESS
store i32 %17, i32* %3
br label %18
18: ; preds = %13, %11
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @file_read_int_fd(i32 %0, i32* nocapture writeonly %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = call i64 @file_read(i32 %0, i8* %4, i32 20)
%6 = icmp slt i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 @atoi(i8* %4)
store i32 %8, i32* %1
br label %9
9: ; preds = %2, %7
%10 = phi i32* [ @EXIT_SUCCESS, %7 ], [ @EXIT_FAILURE, %2 ]
%11 = load i32, i32* %10
ret i32 %11
}
void mconsole_register_dev(struct mc_device *new) {}


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

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

LLVM IR (-O0):
%struct.mc_device = type opaque
define void @mconsole_register_dev(%struct.mc_device* %0) {
%2 = alloca %struct.mc_device*
store %struct.mc_device* %0, %struct.mc_device** %2
ret void
}

LLVM IR (-O2):
%struct.mc_device = type opaque
define void @mconsole_register_dev(%struct.mc_device* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int foo();
int main(void) {
  int x = foo();
  if (x)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <foo@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     115a <main+0x2a>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <foo@plt>
test   %eax,%eax
jne    1143 <main+0x13>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @foo()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
int block_cli_if_desc_update_post_fault_lock_component_alloc() { return 1; }


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

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

LLVM IR (-O0):
define i32 @block_cli_if_desc_update_post_fault_lock_component_alloc() {
ret i32 1
}

LLVM IR (-O2):
define i32 @block_cli_if_desc_update_post_fault_lock_component_alloc() {
ret i32 1
}
char *strcpy(char *dst, const char *src) {
  char *d = dst;
  while (*d++ = *src++)
    ;
  return dst;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

LLVM IR (-O0):
define i8* @strcpy(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
store i8* %6, i8** %5
br label %7
7: ; preds = %14, %2
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %4
%10 = load i8, i8* %8
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %5
store i8 %10, i8* %11
%13 = icmp ne i8 %10, 0
br i1 %13, label %14, label %15
14: ; preds = %7
br label %7
15: ; preds = %7
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int FileExists(char *filename) {
  FILE *fp;
  if ((fp = fopen(filename, "r"))) {
    fclose(fp);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<FileExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     115f <FileExists+0x3f>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1166 <FileExists+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FileExists>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <FileExists+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @FileExists(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
long double longdouble_id(long double x) { return x; }


x86 assembly (clang, -O0):
<longdouble_id>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<longdouble_id>:
fldt   0x8(%rsp)
ret

LLVM IR (-O0):
define x86_fp80 @longdouble_id(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
ret x86_fp80 %3
}

LLVM IR (-O2):
define x86_fp80 @longdouble_id(x86_fp80 returned %0) {
ret x86_fp80 %0
}
int main(int argc, char **argv) {
  int emulate(int, char **);
  emulate(argc, argv);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <emulate@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @emulate(i32 %0, i8** %1)
ret i32 0
}
unsigned tfx_nohash(unsigned id) { return id % 101; }


x86 assembly (clang, -O0):
<tfx_nohash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x65,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tfx_nohash>:
mov    %edi,%eax
mov    %edi,%ecx
imul   $0x446f8657,%rcx,%rcx
shr    $0x20,%rcx
mov    %edi,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x6,%edx
imul   $0x65,%edx,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @tfx_nohash(i32 %0) {
%2 = urem i32 %0, 101
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_store_si128(int /*<<< orphan*/ *,
                                   int /*<<< orphan*/ const);
void xx_store_128(void *const a, const __m128i v) {
  _mm_store_si128((__m128i *)a, v);
}


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

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

LLVM IR (-O0):
define void @xx_store_128(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %4
%8 = call i32 @_mm_store_si128(i32* %6, i32 %7)
ret void
}

LLVM IR (-O2):
define void @xx_store_128(i8* %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = tail call i32 @_mm_store_si128(i32* %3, i32 %1)
ret void
}
void swap2int(int *val1, int *val2) {
  if (*val1 != *val2) {
    *val1 = (*val1) ^ (*val2);
    *val2 = (*val1) ^ (*val2);
    *val1 = (*val1) ^ (*val2);
  }
  return;
}


x86 assembly (clang, -O0):
<swap2int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
je     1154 <swap2int+0x54>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap2int>:
mov    (%rdi),%ecx
mov    (%rsi),%eax
cmp    %eax,%ecx
je     1112 <swap2int+0x12>
xor    %ecx,%eax
mov    %eax,(%rdi)
xor    (%rsi),%eax
mov    %eax,(%rsi)
xor    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @swap2int(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* %5
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %29
10: ; preds = %2
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
%15 = xor i32 %12, %14
%16 = load i32*, i32** %3
store i32 %15, i32* %16
%17 = load i32*, i32** %3
%18 = load i32, i32* %17
%19 = load i32*, i32** %4
%20 = load i32, i32* %19
%21 = xor i32 %18, %20
%22 = load i32*, i32** %4
store i32 %21, i32* %22
%23 = load i32*, i32** %3
%24 = load i32, i32* %23
%25 = load i32*, i32** %4
%26 = load i32, i32* %25
%27 = xor i32 %24, %26
%28 = load i32*, i32** %3
store i32 %27, i32* %28
br label %29
29: ; preds = %10, %2
ret void
}

LLVM IR (-O2):
define void @swap2int(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = icmp eq i32 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = xor i32 %4, %3
store i32 %7, i32* %0
%8 = load i32, i32* %1
%9 = xor i32 %8, %7
store i32 %9, i32* %1
%10 = load i32, i32* %0
%11 = xor i32 %10, %9
store i32 %11, i32* %0
br label %12
12: ; preds = %6, %2
ret void
}
int intcmp(const void *a, const void *b) {
  return *((const int *)a) - *((const int *)b);
}


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

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

LLVM IR (-O0):
define i32 @intcmp(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @intcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int func_one() {
  printf("this is function one\n");
  return 1;
}


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"this is function one\0A\00"
define i32 @func_one() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@str = [21 x i8] c"this is function one\00"
define i32 @func_one() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret i32 1
}
void _memset(void *msg_ptr, char init_val, unsigned int size) {
  unsigned int i;
  for (i = 0; i < size; ++i)
    *((char *)msg_ptr + i) = init_val;
}


x86 assembly (clang, -O0):
<_memset>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    113f <_memset+0x3f>
mov    -0x9(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1118 <_memset+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_memset>:
test   %edx,%edx
je     1124 <_memset+0x14>
push   %rax
mov    %edx,%edx
movzbl %sil,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @_memset(i8* nocapture writeonly %0, i8 signext %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %3
ret void
}
void UARTSmartCardDisable(unsigned long ulBase) {
  ;

  ;
  (*((volatile unsigned long *)(ulBase + 0x00000030))) &= ~0x00000008;
}


x86 assembly (clang, -O0):
<UARTSmartCardDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%rcx
and    $0xfffffffffffffff7,%rcx
mov    %rcx,0x30(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTSmartCardDisable>:
andq   $0xfffffffffffffff7,0x30(%rdi)
ret

LLVM IR (-O0):
define void @UARTSmartCardDisable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 48
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, -9
store volatile i64 %7, i64* %5
ret void
}

LLVM IR (-O2):
define void @UARTSmartCardDisable(i64 %0) {
%2 = add i64 %0, 48
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = and i64 %4, -9
store volatile i64 %5, i64* %3
ret void
}
int rte_atomic32_cmpset(volatile unsigned int *dst, unsigned int exp,
                        unsigned int src) {
  unsigned char res;
  asm volatile("lock ; "
               "cmpxchgl %[src], %[dst];"
               "sete %[res];"
               : [res] "=a"(res), [dst] "=m"(*dst)
               : [src] "r"(src), "a"(exp), "m"(*dst)
               : "memory");
  return res;
}


x86 assembly (clang, -O0):
<rte_atomic32_cmpset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rsi
lock cmpxchg %edx,(%rcx)
sete   %al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rte_atomic32_cmpset>:
mov    %esi,%eax
lock cmpxchg %edx,(%rdi)
sete   %al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @rte_atomic32_cmpset(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %6
%10 = load i32, i32* %5
%11 = load i32*, i32** %4
%12 = call i8 asm sideeffect "lock ; cmpxchgl $2, $1;sete $0;", "={ax},=*m,r,{ax},*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %8, i32 %9, i32 %10, i32* elementtype(i32) %11)
store i8 %12, i8* %7
%13 = load i8, i8* %7
%14 = zext i8 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @rte_atomic32_cmpset(i32* %0, i32 %1, i32 %2) {
%4 = tail call i8 asm sideeffect "lock ; cmpxchgl $2, $1;sete $0;", "={ax},=*m,r,{ax},*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %0, i32 %2, i32 %1, i32* elementtype(i32) %0)
%5 = zext i8 %4 to i32
ret i32 %5
}
/* Type definitions */
struct country_st {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ display_country_info(struct country_st *, char *);
void display_country_removed(struct country_st *country) {
  display_country_info(country, "removed");
}


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

x86 assembly (clang, -O2):
<display_country_removed>:
lea    0xee9(%rip),%rsi
jmp    1030 <display_country_info@plt>

LLVM IR (-O0):
%struct.country_st = type { i32 }
@.str = [8 x i8] c"removed\00"
define void @display_country_removed(%struct.country_st* %0) {
%2 = alloca %struct.country_st*
store %struct.country_st* %0, %struct.country_st** %2
%3 = load %struct.country_st*, %struct.country_st** %2
%4 = call i32 @display_country_info(%struct.country_st* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.country_st = type { i32 }
@.str = [8 x i8] c"removed\00"
define void @display_country_removed(%struct.country_st* %0) {
%2 = tail call i32 @display_country_info(%struct.country_st* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
int st_ptrcmp(const void *a, const void *b, void *data) {
  return (a == b) ? 0 : -1;
}


x86 assembly (clang, -O0):
<st_ptrcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rsi
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_ptrcmp>:
xor    %eax,%eax
cmp    %rsi,%rdi
setne  %al
neg    %eax
ret

LLVM IR (-O0):
define i32 @st_ptrcmp(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = icmp eq i8* %7, %8
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 0, i32 -1
ret i32 %11
}

LLVM IR (-O2):
define i32 @st_ptrcmp(i8* readnone %0, i8* readnone %1, i8* nocapture readnone %2) {
%4 = icmp ne i8* %0, %1
%5 = sext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int syscall(int, int, int, int /*<<< orphan*/);
int puts(char *str) { return syscall(4, 1, (int)str, strlen(str)); }


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xc(%rbp),%edx
mov    %eax,%ecx
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    $0x4,%edi
mov    $0x1,%esi
mov    %ebx,%edx
mov    %eax,%ecx
pop    %rbx
jmp    1040 <syscall@plt>

LLVM IR (-O0):
define i32 @puts(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = call i32 @syscall(i32 4, i32 1, i32 %4, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @puts(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @syscall(i32 4, i32 1, i32 %3, i32 %4)
ret i32 %5
}
/* Variables and functions */
int dblcmp(double, double);
int dblcmp_desc(double v1, double v2) { return dblcmp(v1, v2) * -1; }


x86 assembly (clang, -O0):
<dblcmp_desc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <dblcmp@plt>
imul   $0xffffffff,%eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dblcmp_desc>:
push   %rax
call   1030 <dblcmp@plt>
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dblcmp_desc(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call i32 @dblcmp(double %5, double %6)
%8 = mul nsw i32 %7, -1
ret i32 %8
}

LLVM IR (-O2):
define i32 @dblcmp_desc(double %0, double %1) {
%3 = tail call i32 @dblcmp(double %0, double %1)
%4 = sub nsw i32 0, %3
ret i32 %4
}
int test_imm_D0uint16_mem(unsigned short *val) {
  return ((*val) & (0xD0 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_D0uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 208
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ setupScreen();
void resizeSignalHandler(int signum) {
  endwin();
  setupScreen();
}


x86 assembly (clang, -O0):
<resizeSignalHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <endwin@plt>
mov    $0x0,%al
call   1030 <setupScreen@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @resizeSignalHandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @endwin()
%4 = call i32 (...) @setupScreen()
ret void
}

LLVM IR (-O2):
define void @resizeSignalHandler(i32 %0) {
%2 = tail call i32 (...) @endwin()
%3 = tail call i32 (...) @setupScreen()
ret void
}
/* Variables and functions */
scalar_t__ foo(int *);
unsigned int tr2(int array[], int n) {
  unsigned int sum = 0;
  int x;
  if (n > 0)
    for (x = 0; x < n; x++)
      sum += foo(&array[x]);
  return sum;
}


x86 assembly (clang, -O0):
<tr2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1176 <tr2+0x66>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1171 <tr2+0x61>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <foo@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%eax
add    %rcx,%rax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <tr2+0x27>
jmp    1176 <tr2+0x66>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tr2>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    1137 <tr2+0x27>
mov    %rdi,%rbx
mov    %esi,%ebp
xor    %r14d,%r14d
mov    %rbx,%rdi
call   1030 <foo@plt>
add    %eax,%r14d
add    $0x4,%rbx
add    $0xffffffffffffffff,%rbp
jne    1120 <tr2+0x10>
jmp    113a <tr2+0x2a>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @tr2(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %28
9: ; preds = %2
store i32 0, i32* %6
br label %10
10: ; preds = %24, %9
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i32*, i32** %3
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = call i64 @foo(i32* %18)
%20 = load i32, i32* %5
%21 = zext i32 %20 to i64
%22 = add nsw i64 %21, %19
%23 = trunc i64 %22 to i32
store i32 %23, i32* %5
br label %24
24: ; preds = %14
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %10
27: ; preds = %10
br label %28
28: ; preds = %27, %2
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
define i32 @tr2(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %13, %6 ]
%8 = phi i32 [ 0, %4 ], [ %12, %6 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %7
%10 = tail call i64 @foo(i32* %9)
%11 = trunc i64 %10 to i32
%12 = add i32 %8, %11
%13 = add nuw nsw i64 %7, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %15, label %6
15: ; preds = %6, %2
%16 = phi i32 [ 0, %2 ], [ %12, %6 ]
ret i32 %16
}
/* Variables and functions */
char *concat(char const *, char *, char *);
char *HTMLGenB(const char *innerHTML) {
  return concat(innerHTML, "<b>", "</b>");
}


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

x86 assembly (clang, -O2):
<HTMLGenB>:
lea    0xee9(%rip),%rsi
lea    0xee6(%rip),%rdx
jmp    1030 <concat@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"<b>\00"
@.str.1 = [5 x i8] c"</b>\00"
define i8* @HTMLGenB(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @concat(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i8* %4
}

LLVM IR (-O2):
@.str = [4 x i8] c"<b>\00"
@.str.1 = [5 x i8] c"</b>\00"
define i8* @HTMLGenB(i8* %0) {
%2 = tail call i8* @concat(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i8* %2
}
double doubleAbs(double a, double b) {
  if (a > b)
    return a - b;
  return b - a;
}


x86 assembly (clang, -O0):
<doubleAbs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1132 <doubleAbs+0x32>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1141 <doubleAbs+0x41>
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubleAbs>:
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movapd %xmm1,%xmm3
subsd  %xmm0,%xmm3
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm3,%xmm1
orpd   %xmm1,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @doubleAbs(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp ogt double %6, %7
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load double, double* %4
%11 = load double, double* %5
%12 = fsub double %10, %11
store double %12, double* %3
br label %17
13: ; preds = %2
%14 = load double, double* %5
%15 = load double, double* %4
%16 = fsub double %14, %15
store double %16, double* %3
br label %17
17: ; preds = %13, %9
%18 = load double, double* %3
ret double %18
}

LLVM IR (-O2):
define double @doubleAbs(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = fsub double %0, %1
%5 = fsub double %1, %0
%6 = select i1 %3, double %4, double %5
ret double %6
}
int rid_cmp(const void *value, const void *item) {
  if (value == item)
    return 0;
  else if (value > item)
    return 1;
  else
    return -1;
}


x86 assembly (clang, -O0):
<rid_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1126 <rid_cmp+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1147 <rid_cmp+0x47>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1140 <rid_cmp+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1147 <rid_cmp+0x47>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rid_cmp>:
xor    %ecx,%ecx
xor    %eax,%eax
cmp    %rsi,%rdi
seta   %al
lea    -0x1(%rax,%rax,1),%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @rid_cmp(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = icmp ugt i8* %0, %1
%5 = select i1 %4, i32 1, i32 -1
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_vector(double m[3], char *title) {
  printf("%s\n", title);
  printf("%7.3f %7.3f %7.3f\n\n", m[0], m[1], m[2]);
}


x86 assembly (clang, -O0):
<print_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
lea    0xeb1(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_vector>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <puts@plt>
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
movsd  0x10(%rbx),%xmm2
lea    0xebf(%rip),%rdi
mov    $0x3,%al
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [20 x i8] c"%7.3f %7.3f %7.3f\0A\0A\00"
define void @print_vector(double* %0, i8* %1) {
%3 = alloca double*
%4 = alloca i8*
store double* %0, double** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load double*, double** %3
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 2
%15 = load double, double* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %9, double %12, double %15)
ret void
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"%7.3f %7.3f %7.3f\0A\0A\00"
define void @print_vector(double* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) %1)
%4 = load double, double* %0
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %4, double %6, double %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memfatal(char *, scalar_t__);
char *strdup(char const *);
scalar_t__ strlen(char const *);
char *xstrdup(const char *s) {
  char *copy;
  copy = strdup(s);
  if (!copy)
    memfatal("strdup", 1 + strlen(s));
  return copy;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1170 <xstrdup+0x40>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
add    $0x1,%rsi
lea    0xe95(%rip),%rdi
call   1040 <memfatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    115c <xstrdup+0x2c>
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rsi
lea    0xea9(%rip),%rdi
call   1040 <memfatal@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"strdup\00"
define noalias i8* @xstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = add nsw i64 %5, 1
%7 = tail call i32 @memfatal(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %6)
br label %8
8: ; preds = %4, %1
ret i8* %2
}
unsigned int MinBitrate() { return 8000; }


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

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

LLVM IR (-O0):
define i32 @MinBitrate() {
ret i32 8000
}

LLVM IR (-O2):
define i32 @MinBitrate() {
ret i32 8000
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int x;
  srand(time(NULL));
  x = rand() % 6 + 1;
  printf("congratulation , you rolled a %d\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"congratulation , you rolled a %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 6
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"congratulation , you rolled a %d\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 6
%5 = add nsw i32 %4, 1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
void ar_mbox_send2(int my_cid, int dst_bid, int dst_cid, unsigned int msg0,
                   unsigned int msg1) {}


x86 assembly (clang, -O0):
<ar_mbox_send2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @ar_mbox_send2(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
ret void
}
/* Variables and functions */
int ReadControlRegisterConfigData();
int /*<<< orphan*/ WriteControlRegisterConfigData(int);
void mmu_disable() {
  WriteControlRegisterConfigData(ReadControlRegisterConfigData() & ~0x4);
  WriteControlRegisterConfigData(ReadControlRegisterConfigData() & ~0x1);
}


x86 assembly (clang, -O0):
<mmu_disable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <ReadControlRegisterConfigData@plt>
mov    %eax,%edi
and    $0xfffffffb,%edi
call   1040 <WriteControlRegisterConfigData@plt>
mov    $0x0,%al
call   1030 <ReadControlRegisterConfigData@plt>
mov    %eax,%edi
and    $0xfffffffe,%edi
call   1040 <WriteControlRegisterConfigData@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmu_disable>:
push   %rax
xor    %eax,%eax
call   1030 <ReadControlRegisterConfigData@plt>
and    $0xfffffffb,%eax
mov    %eax,%edi
call   1040 <WriteControlRegisterConfigData@plt>
xor    %eax,%eax
call   1030 <ReadControlRegisterConfigData@plt>
and    $0xfffffffe,%eax
mov    %eax,%edi
pop    %rax
jmp    1040 <WriteControlRegisterConfigData@plt>

LLVM IR (-O0):
define void @mmu_disable() {
%1 = call i32 (...) @ReadControlRegisterConfigData()
%2 = and i32 %1, -5
%3 = call i32 @WriteControlRegisterConfigData(i32 %2)
%4 = call i32 (...) @ReadControlRegisterConfigData()
%5 = and i32 %4, -2
%6 = call i32 @WriteControlRegisterConfigData(i32 %5)
ret void
}

LLVM IR (-O2):
define void @mmu_disable() {
%1 = tail call i32 (...) @ReadControlRegisterConfigData()
%2 = and i32 %1, -5
%3 = tail call i32 @WriteControlRegisterConfigData(i32 %2)
%4 = tail call i32 (...) @ReadControlRegisterConfigData()
%5 = and i32 %4, -2
%6 = tail call i32 @WriteControlRegisterConfigData(i32 %5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int write_key(FILE *fout, void *key) {
  int i = 0;
  i = *(int *)key;
  fprintf(fout, "%d", i);
  return (1);
}


x86 assembly (clang, -O0):
<write_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_key>:
push   %rax
mov    (%rsi),%edx
lea    0xee6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @write_key(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
store i32 %8, i32* %5
%9 = load i32*, i32** %3
%10 = load i32, i32* %5
%11 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 1
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @write_key(i32* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 1
}
unsigned short AUDEC_HEADER_GET_LEN(const void *p) { return 8; }


x86 assembly (clang, -O0):
<AUDEC_HEADER_GET_LEN>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x8,%ax
movzwl %ax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @AUDEC_HEADER_GET_LEN(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i16 8
}

LLVM IR (-O2):
define zeroext i16 @AUDEC_HEADER_GET_LEN(i8* nocapture readnone %0) {
ret i16 8
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int main(void) {
  system("../../tests/true");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [17 x i8] c"../../tests/true\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void sysStrputword(unsigned char *src, int len, int ind, int val) {
  if ((ind < 0) || (ind + 2 > len))
    return;
  src[ind + 1] = val;
  val >>= 8;
  src[ind] = val;
}


x86 assembly (clang, -O0):
<sysStrputword>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     112a <sysStrputword+0x2a>
mov    -0x10(%rbp),%eax
add    $0x2,%eax
cmp    -0xc(%rbp),%eax
jle    112f <sysStrputword+0x2f>
jmp    115d <sysStrputword+0x5d>
mov    -0x14(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysStrputword>:
test   %edx,%edx
js     1115 <sysStrputword+0x15>
lea    0x2(%rdx),%eax
cmp    %esi,%eax
jg     1115 <sysStrputword+0x15>
mov    %edx,%eax
rol    $0x8,%cx
mov    %cx,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @sysStrputword(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 i32, i32* %7
%10 = icmp slt i32 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %4
%12 = load i32, i32* %7
%13 = add nsw i32 %12, 2
%14 = load i32, i32* %6
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %17
16: ; preds = %11, %4
br label %33
17: ; preds = %11
%18 = load i32, i32* %8
%19 = trunc i32 %18 to i8
%20 = load i8*, i8** %5
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
store i8 %19, i8* %24
%25 = load i32, i32* %8
%26 = ashr i32 %25, 8
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = trunc i32 %27 to i8
%29 = load i8*, i8** %5
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 %28, i8* %32
br label %33
33: ; preds = %17, %16
ret void
}

LLVM IR (-O2):
define void @sysStrputword(i8* nocapture writeonly %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %2, 0
%6 = add nsw i32 %2, 2
%7 = icmp sgt i32 %6, %1
%8 = select i1 %5, i1 true, i1 %7
br i1 %8, label %18, label %9
9: ; preds = %4
%10 = trunc i32 %3 to i8
%11 = add nuw nsw i32 %2, 1
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 %10, i8* %13
%14 = lshr i32 %3, 8
%15 = trunc i32 %14 to i8
%16 = zext i32 %2 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 %15, i8* %17
br label %18
18: ; preds = %4, %9
ret void
}