xunge/DecIR huggingface dataset:
void test(int n, int k, int *q, int *r) {
  *q = n / k;
  *r = n - k * (*q);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%rdx
imul   (%rdx),%eax
sub    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
mov    %rdx,%r8
mov    %edi,%eax
cltd
idiv   %esi
mov    %eax,(%r8)
mov    %edx,(%rcx)
ret

LLVM IR (-O0):
define void @test(i32 %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = sdiv i32 %9, %10
%12 = load i32*, i32** %7
store i32 %11, i32* %12
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = load i32*, i32** %7
%16 = load i32, i32* %15
%17 = mul nsw i32 %14, %16
%18 = sub nsw i32 %13, %17
%19 = load i32*, i32** %8
store i32 %18, i32* %19
ret void
}

LLVM IR (-O2):
define void @test(i32 %0, i32 %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = sdiv i32 %0, %1
store i32 %5, i32* %2
%6 = mul nsw i32 %5, %1
%7 = srem i32 %0, %1
store i32 %7, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ test_memory__allocate(int);
int /*<<< orphan*/ test_memory__substring();
int main() {
  test_memory__allocate(2);
  puts("==START SUBSTRING==");
  test_memory__substring();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
call   1050 <test_memory__allocate@plt>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <test_memory__substring@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1050 <test_memory__allocate@plt>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <test_memory__substring@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"==START SUBSTRING==\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test_memory__allocate(i32 2)
%3 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @test_memory__substring()
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"==START SUBSTRING==\00"
define i32 @main() {
%1 = tail call i32 @test_memory__allocate(i32 2)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @test_memory__substring()
ret i32 0
}
/* Variables and functions */
int LOG2_UP(uintptr_t);
uintptr_t ROUNDUPPWR2(uintptr_t value) { return 1 << LOG2_UP(value); }


x86 assembly (clang, -O0):
<ROUNDUPPWR2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <LOG2_UP@plt>
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ROUNDUPPWR2>:
push   %rax
call   1030 <LOG2_UP@plt>
mov    $0x1,%edx
mov    %eax,%ecx
shl    %cl,%edx
movslq %edx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @ROUNDUPPWR2(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @LOG2_UP(i64 %3)
%5 = shl i32 1, %4
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
define i64 @ROUNDUPPWR2(i64 %0) {
%2 = tail call i32 @LOG2_UP(i64 %0)
%3 = shl nuw i32 1, %2
%4 = sext i32 %3 to i64
ret i64 %4
}
void g() {
#define X 1
#define Y 1
}


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

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

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

LLVM IR (-O2):
define void @g() {
ret void
}
void esp_rom_install_channel_putc(int channel, void (*putc)(char c)) {
  extern void ets_install_putc1(void (*p)(char c));
  extern void ets_install_putc2(void (*p)(char c));
  switch (channel) {
  case 1:
    ets_install_putc1(putc);
    break;
  case 2:
    ets_install_putc2(putc);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<esp_rom_install_channel_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     1154 <esp_rom_install_channel_putc+0x34>
jmp    1143 <esp_rom_install_channel_putc+0x23>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1162 <esp_rom_install_channel_putc+0x42>
jmp    1170 <esp_rom_install_channel_putc+0x50>
mov    -0x10(%rbp),%rdi
call   1030 <ets_install_putc1@plt>
jmp    1175 <esp_rom_install_channel_putc+0x55>
mov    -0x10(%rbp),%rdi
call   1040 <ets_install_putc2@plt>
jmp    1175 <esp_rom_install_channel_putc+0x55>
jmp    1175 <esp_rom_install_channel_putc+0x55>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<esp_rom_install_channel_putc>:
cmp    $0x2,%edi
je     1132 <esp_rom_install_channel_putc+0x12>
cmp    $0x1,%edi
jne    113a <esp_rom_install_channel_putc+0x1a>
mov    %rsi,%rdi
jmp    1030 <ets_install_putc1@plt>
mov    %rsi,%rdi
jmp    1040 <ets_install_putc2@plt>
ret

LLVM IR (-O0):
define void @esp_rom_install_channel_putc(i32 %0, void (i8)* %1) {
%3 = alloca i32
%4 = alloca void (i8)*
store i32 %0, i32* %3
store void (i8)* %1, void (i8)** %4
%5 = load i32, i32* %3
switch i32 %5, label %10 [
i32 1, label %6
i32 2, label %8
]
6: ; preds = %2
%7 = load void (i8)*, void (i8)** %4
br label %11
8: ; preds = %2
%9 = load void (i8)*, void (i8)** %4
br label %11
10: ; preds = %2
br label %11
11: ; preds = %10, %8, %6
ret void
}

LLVM IR (-O2):
define void @esp_rom_install_channel_putc(i32 %0, void (i8)* %1) {
switch i32 %0, label %5 [
i32 1, label %3
i32 2, label %4
]
3: ; preds = %2
tail call void @ets_install_putc1(void (i8)* %1)
br label %5
4: ; preds = %2
tail call void @ets_install_putc2(void (i8)* %1)
br label %5
5: ; preds = %2, %4, %3
ret void
}
/* Variables and functions */
int foo2(int *, int *, int *, int *);
int foo3(int *a, int *b, int *c) {
  int d = 5;
  return foo2(a, b, c, &d);
}


x86 assembly (clang, -O0):
<foo3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x5,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1030 <foo2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo3>:
push   %rax
movl   $0x5,0x4(%rsp)
lea    0x4(%rsp),%rcx
call   1030 <foo2@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @foo3(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 5, i32* %7
%8 = load i32*, i32** %4
%9 = load i32*, i32** %5
%10 = load i32*, i32** %6
%11 = call i32 @foo2(i32* %8, i32* %9, i32* %10, i32* %7)
ret i32 %11
}

LLVM IR (-O2):
define i32 @foo3(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store i32 5, i32* %4
%6 = call i32 @foo2(i32* %0, i32* %1, i32* %2, i32* %4)
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ wiznetRegWriteByte(int /*<<< orphan*/, int,
                                      int /*<<< orphan*/);
void wiznetSetSocketInterruptMask(uint8_t socket, uint8_t mask) {
  wiznetRegWriteByte(socket, (0x0000 + 0x002C), mask);
}


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

x86 assembly (clang, -O2):
<wiznetSetSocketInterruptMask>:
mov    %esi,%edx
mov    $0x2c,%esi
jmp    1030 <wiznetRegWriteByte@plt>

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

LLVM IR (-O2):
define void @wiznetSetSocketInterruptMask(i32 %0, i32 %1) {
%3 = tail call i32 @wiznetRegWriteByte(i32 %0, i32 44, i32 %1)
ret void
}
int bic(int x, int m) { return x & ~m; }


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

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

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

LLVM IR (-O2):
define i32 @bic(i32 %0, i32 %1) {
%3 = xor i32 %1, -1
%4 = and i32 %3, %0
ret i32 %4
}
/* Variables and functions */
double RAND_MAX;
scalar_t__ rand();
double randf() { return ((double)rand() / RAND_MAX); }


x86 assembly (clang, -O0):
<randf>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
divsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<randf>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
divsd  (%rax),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define double @randf() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load double, double* @RAND_MAX
%4 = fdiv double %2, %3
ret double %4
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define double @randf() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load double, double* @RAND_MAX
%4 = fdiv double %2, %3
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main() {
  char newChar = 'a' + 2;
  printf("The char 'a' + 2 is equal to: %c \n", newChar);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"The char 'a' + 2 is equal to: %c \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 99, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8 signext %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"The char 'a' + 2 is equal to: %c \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8 signext 99)
ret i32 0
}
int test_imm_49int8_reg(signed char val) {
  return ((val) & (-0x49 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_49int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffffb7,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_49int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -73
%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_49int8_reg(i8 signext %0) {
%2 = and i8 %0, -73
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *calloc(size_t numelm, size_t elmsize) {
  void *p;
  size_t size;
  size = numelm * elmsize;
  p = malloc(size);
  if (p && size)
    memset(p, 0, size);
  return p;
}


x86 assembly (clang, -O0):
<calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116f <calloc+0x4f>
cmpq   $0x0,-0x20(%rbp)
je     116f <calloc+0x4f>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     114d <calloc+0x2d>
test   %r14,%r14
je     114d <calloc+0x2d>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @calloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp ne i8* %4, null
%6 = icmp ne i64 %3, 0
%7 = and i1 %6, %5
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @memset(i8* %4, i32 0, i64 %3)
br label %10
10: ; preds = %8, %2
ret i8* %4
}
/* Variables and functions */
int LZ5_compress_default(char const *, char *, int, int);
int LZ5_compress_limitedOutput(const char *source, char *dest, int inputSize,
                               int maxOutputSize) {
  return LZ5_compress_default(source, dest, inputSize, maxOutputSize);
}


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

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

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

LLVM IR (-O2):
define i32 @LZ5_compress_limitedOutput(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @LZ5_compress_default(i8* %0, i8* %1, i32 %2, i32 %3)
ret i32 %5
}
long tell(f) { return (lseek(f, 0L, 1)); }


x86 assembly (clang, -O0):
<tell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <lseek@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tell>:
push   %rax
xor    %esi,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <lseek@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @tell(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, i64, i32, ...) bitcast (i32 (...)* @lseek to i32 (i32, i64, i32, ...)*)(i32 %3, i64 0, i32 1)
%5 = sext i32 %4 to i64
ret i64 %5
}

LLVM IR (-O2):
define i64 @tell(i32 %0) {
%2 = tail call i32 (i32, i64, i32, ...) bitcast (i32 (...)* @lseek to i32 (i32, i64, i32, ...)*)(i32 %0, i64 0, i32 1)
%3 = sext i32 %2 to i64
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printk(char *);
int init_module(void) {
  printk("** Hello World! **\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"** Hello World! **\0A\00"
define i32 @init_module() {
%1 = call i32 @printk(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"** Hello World! **\0A\00"
define i32 @init_module() {
%1 = tail call i32 @printk(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct prior {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _Memrel(struct prior *);
void priorlist_done(struct prior **pPP) {
  struct prior *pp = *pPP;
  if (pp)
    _Memrel((pp));
  pp = NULL;
  *pPP = pp;
  return;
}


x86 assembly (clang, -O0):
<priorlist_done>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113b <priorlist_done+0x2b>
mov    -0x10(%rbp),%rdi
call   1030 <_Memrel@plt>
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<priorlist_done>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1121 <priorlist_done+0x11>
call   1030 <_Memrel@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.prior = type { i32 }
define void @priorlist_done(%struct.prior** %0) {
%2 = alloca %struct.prior**
%3 = alloca %struct.prior*
store %struct.prior** %0, %struct.prior*** %2
%4 = load %struct.prior**, %struct.prior*** %2
%5 = load %struct.prior*, %struct.prior** %4
store %struct.prior* %5, %struct.prior** %3
%6 = load %struct.prior*, %struct.prior** %3
%7 = icmp ne %struct.prior* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load %struct.prior*, %struct.prior** %3
%10 = call i32 @_Memrel(%struct.prior* %9)
br label %11
11: ; preds = %8, %1
store %struct.prior* null, %struct.prior** %3
%12 = load %struct.prior*, %struct.prior** %3
%13 = load %struct.prior**, %struct.prior*** %2
store %struct.prior* %12, %struct.prior** %13
ret void
}

LLVM IR (-O2):
%struct.prior = type { i32 }
define void @priorlist_done(%struct.prior** nocapture %0) {
%2 = load %struct.prior*, %struct.prior** %0
%3 = icmp eq %struct.prior* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @_Memrel(%struct.prior* %2)
br label %6
6: ; preds = %4, %1
store %struct.prior* null, %struct.prior** %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void shmem_longdouble_min_to_all(long double *target,
                                        long double *source, int nreduce,
                                        int PE_start, int logPE_stride,
                                        int PE_size, long double *pWrk,
                                        long *pSync) {
  printf("\nOpenSHMEM Analyzer\n");
}


x86 assembly (clang, -O0):
<shmem_longdouble_min_to_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"\0AOpenSHMEM Analyzer\0A\00"
define void @shmem_longdouble_min_to_all(x86_fp80* %0, x86_fp80* %1, i32 %2, i32 %3, i32 %4, i32 %5, x86_fp80* %6, i64* %7) {
%9 = alloca x86_fp80*
%10 = alloca x86_fp80*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca x86_fp80*
%16 = alloca i64*
store x86_fp80* %0, x86_fp80** %9
store x86_fp80* %1, x86_fp80** %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store x86_fp80* %6, x86_fp80** %15
store i64* %7, i64** %16
%17 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define void @shmem_longdouble_min_to_all(x86_fp80* nocapture readnone %0, x86_fp80* nocapture readnone %1, i32 %2, i32 %3, i32 %4, i32 %5, x86_fp80* nocapture readnone %6, i64* nocapture readnone %7) {
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ botonesyTijeras();
int /*<<< orphan*/ randomize();
int main() {
  randomize();
  botonesyTijeras();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <randomize@plt>
mov    $0x0,%al
call   1030 <botonesyTijeras@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @randomize()
%3 = call i32 (...) @botonesyTijeras()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @randomize()
%2 = tail call i32 (...) @botonesyTijeras()
ret i32 0
}
int main(void) {
  printf("starting: ...\n");
  asm(".text ; .byte 0xcc;");
  printf("breakpoint done ...\n");
  return 0;
}


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

x86 assembly (clang, -O2):
LLVM IR (-O0):
@.str = [15 x i8] c"starting: ...\0A\00"
@.str.1 = [21 x i8] c"breakpoint done ...\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
void *popen(void) { return 0; }


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

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

LLVM IR (-O0):
define i8* @popen() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @popen() {
ret i8* null
}
void noop_action(struct action *action, struct dir_ent *dir_ent) {}


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

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

LLVM IR (-O0):
%struct.action = type opaque
%struct.dir_ent = type opaque
define void @noop_action(%struct.action* %0, %struct.dir_ent* %1) {
%3 = alloca %struct.action*
%4 = alloca %struct.dir_ent*
store %struct.action* %0, %struct.action** %3
store %struct.dir_ent* %1, %struct.dir_ent** %4
ret void
}

LLVM IR (-O2):
%struct.action = type opaque
%struct.dir_ent = type opaque
define void @noop_action(%struct.action* nocapture %0, %struct.dir_ent* nocapture %1) {
ret void
}
void EPIConfigHB16Set(unsigned long ulBase, unsigned long ulConfig,
                      unsigned long ulMaxWait) {
  ;
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000014))) =
      (((ulConfig & 0x00000100) ? 0x80000000 : 0) |
       ((ulConfig & 0x00000800) ? 0x04000000 : 0) |
       ((ulConfig & 0x00000600) << 15));
  ulConfig &= ~0x0000FF00;
  ulConfig |= ulMaxWait << 8;
  (*((volatile unsigned long *)(ulBase + 0x00000010))) = ulConfig;
}


x86 assembly (clang, -O0):
<EPIConfigHB16Set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdx
and    $0x100,%rdx
xor    %eax,%eax
mov    $0x80000000,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    -0x10(%rbp),%rsi
and    $0x800,%rsi
xor    %ecx,%ecx
mov    $0x4000000,%edx
cmp    $0x0,%rsi
cmovne %edx,%ecx
or     %ecx,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
and    $0x600,%rax
shl    $0xf,%rax
or     %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x14(%rax)
mov    -0x10(%rbp),%rax
and    $0xffffffffffff00ff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EPIConfigHB16Set>:
mov    %esi,%r8d
and    $0x100,%r8d
shl    $0x17,%r8
mov    %rsi,%rcx
shl    $0xf,%rcx
mov    %ecx,%eax
and    $0x4000000,%eax
or     %r8,%rax
and    $0x3000000,%ecx
or     %rax,%rcx
mov    %rcx,0x14(%rdi)
and    $0xffffffffffff00ff,%rsi
shl    $0x8,%rdx
or     %rsi,%rdx
mov    %rdx,0x10(%rdi)
ret

LLVM IR (-O0):
define void @EPIConfigHB16Set(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %5
%8 = and i64 %7, 256
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 -2147483648, i32 0
%12 = load i64, i64* %5
%13 = and i64 %12, 2048
%14 = icmp ne i64 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 67108864, i32 0
%17 = or i32 %11, %16
%18 = zext i32 %17 to i64
%19 = load i64, i64* %5
%20 = and i64 %19, 1536
%21 = shl i64 %20, 15
%22 = or i64 %18, %21
%23 = load i64, i64* %4
%24 = add i64 %23, 20
%25 = inttoptr i64 %24 to i64*
store volatile i64 %22, i64* %25
%26 = load i64, i64* %5
%27 = and i64 %26, -65281
store i64 %27, i64* %5
%28 = load i64, i64* %6
%29 = shl i64 %28, 8
%30 = load i64, i64* %5
%31 = or i64 %30, %29
store i64 %31, i64* %5
%32 = load i64, i64* %5
%33 = load i64, i64* %4
%34 = add i64 %33, 16
%35 = inttoptr i64 %34 to i64*
store volatile i64 %32, i64* %35
ret void
}

LLVM IR (-O2):
define void @EPIConfigHB16Set(i64 %0, i64 %1, i64 %2) {
%4 = shl i64 %1, 23
%5 = and i64 %4, 2147483648
%6 = shl i64 %1, 15
%7 = and i64 %6, 67108864
%8 = or i64 %5, %7
%9 = and i64 %6, 50331648
%10 = or i64 %8, %9
%11 = add i64 %0, 20
%12 = inttoptr i64 %11 to i64*
store volatile i64 %10, i64* %12
%13 = and i64 %1, -65281
%14 = shl i64 %2, 8
%15 = or i64 %14, %13
%16 = add i64 %0, 16
%17 = inttoptr i64 %16 to i64*
store volatile i64 %15, i64* %17
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlock_t;

/* Variables and functions */
int /*<<< orphan*/ abort();
int pthread_rwlock_rdlock(int /*<<< orphan*/ *);
void __safe_p_rwlock_rdlock(pthread_rwlock_t *rw) {
  int en = pthread_rwlock_rdlock(rw);
  if (en) {
    abort();
  }
}


x86 assembly (clang, -O0):
<__safe_p_rwlock_rdlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <pthread_rwlock_rdlock@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1149 <__safe_p_rwlock_rdlock+0x29>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__safe_p_rwlock_rdlock>:
push   %rax
call   1040 <pthread_rwlock_rdlock@plt>
test   %eax,%eax
jne    112c <__safe_p_rwlock_rdlock+0xc>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define void @__safe_p_rwlock_rdlock(i32* %0) {
%2 = tail call i32 @pthread_rwlock_rdlock(i32* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "Usage: uniq [-udc] [+n] [-n] [input [output]]\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c"Usage: uniq [-udc] [+n] [-n] [input [output]]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c"Usage: uniq [-udc] [+n] [-n] [input [output]]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sighandler(int signum) { printf("Received: NOTIFICATION\n"); }


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

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

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

LLVM IR (-O2):
@str = [23 x i8] c"Received: NOTIFICATION\00"
define void @sighandler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int test_failure();
int main() { return -test_failure(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_failure()
%3 = sub nsw i32 0, %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_failure()
%2 = sub nsw i32 0, %1
ret i32 %2
}
void not_carry() {}


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

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

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

LLVM IR (-O2):
define void @not_carry() {
ret void
}
/* Type definitions */
struct webidl_node {
  int dummy;
};
struct binding {
  int dummy;
};

/* Variables and functions */
int generate_property_tinyid(struct binding *, int /*<<< orphan*/);
int /*<<< orphan*/ webidl_node_gettext(struct webidl_node *);
int webidl_property_tinyid_implements_cb(struct webidl_node *node, void *ctx) {
  struct binding *binding = ctx;
  return generate_property_tinyid(binding, webidl_node_gettext(node));
}


x86 assembly (clang, -O0):
<webidl_property_tinyid_implements_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <webidl_node_gettext@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1040 <generate_property_tinyid@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<webidl_property_tinyid_implements_cb>:
push   %rbx
mov    %rsi,%rbx
call   1030 <webidl_node_gettext@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <generate_property_tinyid@plt>

LLVM IR (-O0):
%struct.webidl_node = type { i32 }
%struct.binding = type { i32 }
define i32 @webidl_property_tinyid_implements_cb(%struct.webidl_node* %0, i8* %1) {
%3 = alloca %struct.webidl_node*
%4 = alloca i8*
%5 = alloca %struct.binding*
store %struct.webidl_node* %0, %struct.webidl_node** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to %struct.binding*
store %struct.binding* %7, %struct.binding** %5
%8 = load %struct.binding*, %struct.binding** %5
%9 = load %struct.webidl_node*, %struct.webidl_node** %3
%10 = call i32 @webidl_node_gettext(%struct.webidl_node* %9)
%11 = call i32 @generate_property_tinyid(%struct.binding* %8, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.webidl_node = type { i32 }
%struct.binding = type { i32 }
define i32 @webidl_property_tinyid_implements_cb(%struct.webidl_node* %0, i8* %1) {
%3 = bitcast i8* %1 to %struct.binding*
%4 = tail call i32 @webidl_node_gettext(%struct.webidl_node* %0)
%5 = tail call i32 @generate_property_tinyid(%struct.binding* %3, i32 %4)
ret i32 %5
}
/* Type definitions */
typedef void pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_mutex_lock(void *);
int /*<<< orphan*/ pthread_mutex_unlock(void *);
void *foo(void *arg) {
  pthread_mutex_t *mutex = arg;
  pthread_mutex_lock(mutex);
  pthread_mutex_unlock(mutex);
  return mutex;
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %rdi,%rbx
call   1040 <pthread_mutex_lock@plt>
mov    %rbx,%rdi
call   1030 <pthread_mutex_unlock@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @foo(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @pthread_mutex_lock(i8* %5)
%7 = load i8*, i8** %3
%8 = call i32 @pthread_mutex_unlock(i8* %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @foo(i8* returned %0) {
%2 = tail call i32 @pthread_mutex_lock(i8* %0)
%3 = tail call i32 @pthread_mutex_unlock(i8* %0)
ret i8* %0
}
void test_if(int *buf, int d) {
  if (d > 10) {
    buf[2] = 0;
  } else {
    buf[3] = 0;
  }
}


x86 assembly (clang, -O0):
<test_if>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jle    1125 <test_if+0x25>
mov    -0x8(%rbp),%rax
movl   $0x0,0x8(%rax)
jmp    1130 <test_if+0x30>
mov    -0x8(%rbp),%rax
movl   $0x0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_if>:
xor    %eax,%eax
cmp    $0xb,%esi
setl   %al
movl   $0x0,0x8(%rdi,%rax,4)
ret

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

LLVM IR (-O2):
define void @test_if(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 10
%4 = select i1 %3, i64 2, i64 3
%5 = getelementptr inbounds i32, i32* %0, i64 %4
store i32 0, i32* %5
ret void
}
/* Variables and functions */
int rand();
long get_random() { return rand() % 100; }


x86 assembly (clang, -O0):
<get_random>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_random>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @get_random() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 100
%3 = sext i32 %2 to i64
ret i64 %3
}

LLVM IR (-O2):
define i64 @get_random() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 100
%3 = sext i32 %2 to i64
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_strlcpy() {
  printf("NOT IMPLEMENTED:"
         "pa_strlcpy"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"NOT IMPLEMENTED:pa_strlcpy\0A\00"
define i32 @pa_strlcpy() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [27 x i8] c"NOT IMPLEMENTED:pa_strlcpy\00"
define i32 @pa_strlcpy() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int main() {
  while (1) {
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    110b <main+0xb>

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print(char *texto) { printf("%s\n", texto); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @print(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct alpha {
  int a;
  float b;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, float);
main() {
  union alpha {
    int a;
    float b;
  } u1;
  u1.a = 12;
  printf("%d %f", u1.a, u1.b);
}


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

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

LLVM IR (-O0):
%union.alpha = type { i32 }
@.str = [6 x i8] c"%d %f\00"
define i32 @main() {
%1 = alloca %union.alpha
%2 = bitcast %union.alpha* %1 to i32*
store i32 12, i32* %2
%3 = bitcast %union.alpha* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast %union.alpha* %1 to float*
%6 = load float, float* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4, float %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %f\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 12, float 0x36D8000000000000)
ret i32 0
}
int bitsToLongs(unsigned long bits) {
  return (bits + 8 * sizeof(unsigned long) - 1) / (8 * sizeof(unsigned long));
}


x86 assembly (clang, -O0):
<bitsToLongs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rax
sub    $0x1,%rax
shr    $0x6,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitsToLongs>:
lea    0x3f(%rdi),%rax
shr    $0x6,%rax
ret

LLVM IR (-O0):
define i32 @bitsToLongs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 64
%5 = sub i64 %4, 1
%6 = udiv i64 %5, 64
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @bitsToLongs(i64 %0) {
%2 = add i64 %0, 63
%3 = lshr i64 %2, 6
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int isst_send_msr_command(int, int, int /*<<< orphan*/, unsigned long long *);
int isst_get_config_tdp_lock_status(int cpu) {
  unsigned long long tdp_control = 0;
  int ret;
  ret = isst_send_msr_command(cpu, 0x64b, 0, &tdp_control);
  if (ret)
    return ret;
  ret = !!(tdp_control & (1 << (31)));
  return ret;
}


x86 assembly (clang, -O0):
<isst_get_config_tdp_lock_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x64b,%esi
xor    %edx,%edx
lea    -0x10(%rbp),%rcx
call   1030 <isst_send_msr_command@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     114e <isst_get_config_tdp_lock_status+0x3e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1171 <isst_get_config_tdp_lock_status+0x61>
mov    -0x10(%rbp),%rax
and    $0xffffffff80000000,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isst_get_config_tdp_lock_status>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rcx
mov    $0x64b,%esi
xor    %edx,%edx
call   1030 <isst_send_msr_command@plt>
xor    %ecx,%ecx
cmpq   $0x7fffffff,(%rsp)
7f
seta   %cl
test   %eax,%eax
cmove  %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @isst_get_config_tdp_lock_status(i32 %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%4 = call i32 @isst_send_msr_command(i32 %0, i32 1611, i32 0, i64* %2)
%5 = icmp eq i32 %4, 0
%6 = load i64, i64* %2
%7 = icmp ugt i64 %6, 2147483647
%8 = zext i1 %7 to i32
%9 = select i1 %5, i32 %8, i32 %4
ret i32 %9
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ puts(char *);
int main(void) {
  signed int val = -10;
  if ((val >= 0 && ~val >= 0) == 1)
    puts("unsigned int");
  else
    puts("signed int");
  if (((unsigned int)0 - 1 > 0) == 1)
    puts("unsigned int");
  else
    puts("signed int");
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffff6,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1144 <main+0x34>
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
cmp    $0x0,%eax
setge  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
jne    1166 <main+0x56>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
jmp    1172 <main+0x62>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"unsigned int\00"
@.str.1 = [11 x i8] c"signed int\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 -10, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i32, i32* %2
%7 = xor i32 %6, -1
%8 = icmp sge i32 %7, 0
br label %9
9: ; preds = %5, %0
%10 = phi i1 [ false, %0 ], [ %8, %5 ]
%11 = zext i1 %10 to i32
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %17
15: ; preds = %9
%16 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
%18 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}

LLVM IR (-O2):
@.str = [13 x i8] c"unsigned int\00"
@.str.1 = [11 x i8] c"signed int\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ printw(char *, char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ sleep(int);
int main() {
  initscr();
  move(5, 15);
  printw("%s", "Hello World");
  refresh();
  sleep(2);
  endwin();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <initscr@plt>
mov    $0x5,%edi
mov    $0xf,%esi
call   1090 <move@plt>
lea    0xe64(%rip),%rdi
lea    0xe60(%rip),%rsi
call   1040 <printw@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
mov    $0x2,%edi
call   1080 <sleep@plt>
mov    $0x0,%al
call   1060 <endwin@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <initscr@plt>
mov    $0x5,%edi
mov    $0xf,%esi
call   1090 <move@plt>
lea    0xe72(%rip),%rdi
lea    0xe6e(%rip),%rsi
call   1040 <printw@plt>
xor    %eax,%eax
call   1050 <refresh@plt>
mov    $0x2,%edi
call   1080 <sleep@plt>
xor    %eax,%eax
call   1060 <endwin@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [12 x i8] c"Hello World\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @initscr()
%3 = call i32 @move(i32 5, i32 15)
%4 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @refresh()
%6 = call i32 @sleep(i32 2)
%7 = call i32 (...) @endwin()
%8 = load i32, i32* @EXIT_SUCCESS
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [12 x i8] c"Hello World\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 @move(i32 5, i32 15)
%3 = tail call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (...) @refresh()
%5 = tail call i32 @sleep(i32 2)
%6 = tail call i32 (...) @endwin()
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @exit(i32 %7)
unreachable
}