xunge/DecIR huggingface dataset:
int test_imm_CCint16_reg(short val) {
  return ((val) & (0xCC << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_CCint16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 204
%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_CCint16_reg(i16 signext %0) {
%2 = and i16 %0, 204
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void SSIDisable(uint32_t ui32Base) {
  ;
  (*((volatile unsigned long *)(ui32Base + 0x00000004))) &= ~(0x00000002);
}


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

x86 assembly (clang, -O2):
<SSIDisable>:
andq   $0xfffffffffffffffd,0x4(%rdi)
ret

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

LLVM IR (-O2):
define void @SSIDisable(i64 %0) {
%2 = add nsw i64 %0, 4
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = and i64 %4, -3
store volatile i64 %5, i64* %3
ret void
}
char *langDbgDevMsxAudio() { return "MSX Audio"; }


x86 assembly (clang, -O0):
<langDbgDevMsxAudio>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<langDbgDevMsxAudio>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"MSX Audio\00"
define i8* @langDbgDevMsxAudio() {
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [10 x i8] c"MSX Audio\00"
define i8* @langDbgDevMsxAudio() {
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope) {
  (void)attr;
  (void)contentionscope;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @pthread_attr_setscope(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
ret i32 0
}

LLVM IR (-O2):
define i32 @pthread_attr_setscope(i32* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
__attribute__((always_)) uint64_t detexPack64B16(uint32_t b16) {
  return (uint64_t)b16 << 32;
}


x86 assembly (clang, -O0):
<detexPack64B16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x20,%ecx
shl    %cl,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @detexPack64B16(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = shl i32 %4, 32
ret i32 %5
}

LLVM IR (-O2):
define i32 @detexPack64B16(i64 %0) {
ret i32 poison
}
unsigned int rnd(void) {
  static unsigned rseed = 42;
  return rseed = (rseed * 3877U + 29573U) % 139968U;
}


x86 assembly (clang, -O0):
<rnd>:
push   %rbp
mov    %rsp,%rbp
imul   $0xf25,0x2f12(%rip),%eax
add    $0x7385,%eax
mov    $0x222c0,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
mov    %eax,0x2efc(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd>:
imul   $0xf25,0x2f16(%rip),%eax
add    $0x7385,%eax
imul   $0x1df75681,%rax,%rcx
shr    $0x2e,%rcx
imul   $0x222c0,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x2ef8(%rip)
ret

LLVM IR (-O0):
@rnd.rseed = internal global i32 42
define i32 @rnd() {
%1 = load i32, i32* @rnd.rseed
%2 = mul i32 %1, 3877
%3 = add i32 %2, 29573
%4 = urem i32 %3, 139968
store i32 %4, i32* @rnd.rseed
ret i32 %4
}

LLVM IR (-O2):
@rnd.rseed = internal unnamed_addr global i32 42
define i32 @rnd() {
%1 = load i32, i32* @rnd.rseed
%2 = mul i32 %1, 3877
%3 = add i32 %2, 29573
%4 = urem i32 %3, 139968
store i32 %4, i32* @rnd.rseed
ret i32 %4
}
/* Variables and functions */
int strlen(char string[]) {
  int j;
  while (string[j] != '\0')
    ++j;
  return j;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     112b <strlen+0x2b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1108 <strlen+0x8>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ __VLTChangePermission(int /*<<< orphan*/);
__attribute__((constructor(100))) void __VLTprotect(void) {
  __VLTChangePermission(0);
}


x86 assembly (clang, -O0):
<__VLTprotect>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <__VLTChangePermission@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__VLTprotect>:
xor    %edi,%edi
jmp    1030 <__VLTChangePermission@plt>

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 100, void ()* @__VLTprotect, i8* null }]
define void @__VLTprotect() {
%1 = call i32 @__VLTChangePermission(i32 0)
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 100, void ()* @__VLTprotect, i8* null }]
define void @__VLTprotect() {
%1 = tail call i32 @__VLTChangePermission(i32 0)
ret void
}
void _libwrap_fini() {}


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

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

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

LLVM IR (-O2):
define void @_libwrap_fini() {
ret void
}
/* Variables and functions */
int errno;
int /*<<< orphan*/ printf(char *, int);
long syscall(int);
int main(int argc, char **argv) {
  long int rc = -99;
  rc = syscall(310);
  if (rc >= 0)
    printf("Return is: %li\n", rc);
  else
    printf("errno: %d\n", -errno);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0xffffffffffffff9d,-0x18(%rbp)
ff
mov    $0x136,%edi
call   1040 <syscall@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jl     116e <main+0x4e>
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
jmp    1185 <main+0x65>
xor    %esi,%esi
mov    0x2e69(%rip),%rax
sub    (%rax),%esi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x136,%edi
call   1040 <syscall@plt>
test   %rax,%rax
js     113b <main+0x1b>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
jmp    114d <main+0x2d>
mov    0x2e9e(%rip),%rax
xor    %esi,%esi
sub    (%rax),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Return is: %li\0A\00"
@.str.1 = [11 x i8] c"errno: %d\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 -99, i64* %6
%7 = call i64 @syscall(i32 310)
store i64 %7, i64* %6
%8 = load i64, i64* %6
%9 = icmp sge i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i64, i64* %6
%12 = trunc i64 %11 to i32
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %18
14: ; preds = %2
%15 = load i32, i32* @errno
%16 = sub nsw i32 0, %15
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %14, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Return is: %li\0A\00"
@.str.1 = [11 x i8] c"errno: %d\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @syscall(i32 310)
%4 = icmp sgt i64 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = trunc i64 %3 to i32
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %12
8: ; preds = %2
%9 = load i32, i32* @errno
%10 = sub nsw i32 0, %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %8, %5
ret i32 0
}
/* Type definitions */
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
void timespec_from_ms(struct timespec *ts, int ms) {
  ts->tv_sec = ms / (1000L);
  ts->tv_nsec = (ms % (1000L)) * (1000L * 1000L);
}


x86 assembly (clang, -O0):
<timespec_from_ms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
mov    $0x3e8,%ecx
cqto
idiv   %rcx
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
movslq -0xc(%rbp),%rax
mov    $0x3e8,%ecx
cqto
idiv   %rcx
imul   $0xf4240,%rdx,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<timespec_from_ms>:
movslq %esi,%rax
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
mov    %ecx,(%rdi)
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
imul   $0xf4240,%eax,%eax
mov    %eax,0x4(%rdi)
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define void @timespec_from_ms(%struct.timespec* %0, i32 %1) {
%3 = alloca %struct.timespec*
%4 = alloca i32
store %struct.timespec* %0, %struct.timespec** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sext i32 %5 to i64
%7 = sdiv i64 %6, 1000
%8 = trunc i64 %7 to i32
%9 = load %struct.timespec*, %struct.timespec** %3
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
store i32 %8, i32* %10
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = srem i64 %12, 1000
%14 = mul nsw i64 %13, 1000000
%15 = trunc i64 %14 to i32
%16 = load %struct.timespec*, %struct.timespec** %3
%17 = getelementptr inbounds %struct.timespec, %struct.timespec* %16, i32 0, i32 1
store i32 %15, i32* %17
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
define void @timespec_from_ms(%struct.timespec* nocapture writeonly %0, i32 %1) {
%3 = sdiv i32 %1, 1000
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
store i32 %3, i32* %4
%5 = srem i32 %1, 1000
%6 = mul nsw i32 %5, 1000000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
store i32 %6, i32* %7
ret void
}
int free_image_array(the_array, length)
short **the_array;
long length;
{
  int i;
  for (i = 0; i < length; i++)
    free(the_array[i]);
  free(the_array);
  return (1);
}


x86 assembly (clang, -O0):
<free_image_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1154 <free_image_array+0x44>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <free_image_array+0x17>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_image_array>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %rsi,%rsi
jle    1142 <free_image_array+0x32>
mov    %rsi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_image_array+0x20>
mov    %r14,%rdi
call   1030 <free@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @free_image_array(i16** nocapture %0, i64 %1) {
%3 = icmp sgt i64 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %2, %4
%5 = phi i64 [ %9, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i16*, i16** %0, i64 %5
%7 = bitcast i16** %6 to i8**
%8 = load i8*, i8** %7
tail call void @free(i8* %8)
%9 = add nuw nsw i64 %5, 1
%10 = icmp eq i64 %9, %1
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = bitcast i16** %0 to i8*
tail call void @free(i8* %12)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ transfer(int, int /*<<< orphan*/);
void f_jump(void) { transfer(0x80000000, 0); }


x86 assembly (clang, -O0):
<f_jump>:
push   %rbp
mov    %rsp,%rbp
mov    $0x80000000,%edi
xor    %esi,%esi
call   1030 <transfer@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_jump>:
mov    $0x80000000,%edi
xor    %esi,%esi
jmp    1030 <transfer@plt>

LLVM IR (-O0):
define void @f_jump() {
%1 = call i32 @transfer(i32 -2147483648, i32 0)
ret void
}

LLVM IR (-O2):
define void @f_jump() {
%1 = tail call i32 @transfer(i32 -2147483648, i32 0)
ret void
}
void dump16(unsigned char *c, unsigned i) {
  c[0] = (i >> 8) & 0xff;
  c[1] = i & 0xff;
}


x86 assembly (clang, -O0):
<dump16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump16>:
rol    $0x8,%si
mov    %si,(%rdi)
ret

LLVM IR (-O0):
define void @dump16(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = lshr i32 %5, 8
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %4
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %13, i8* %15
ret void
}

LLVM IR (-O2):
define void @dump16(i8* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 8
%4 = trunc i32 %3 to i8
store i8 %4, i8* %0
%5 = trunc i32 %1 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void write_stdout(char *string) { write(1, string, strlen(string)); }


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

x86 assembly (clang, -O2):
<write_stdout>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @write_stdout(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @write(i32 1, i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
define void @write_stdout(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @write(i32 1, i8* %0, i32 %2)
ret void
}
/* Variables and functions */
char *U_WMRCORENONE_set(char *);
char *U_WMR61_set(void) { return U_WMRCORENONE_set("U_WMR61"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR61\00"
define i8* @U_WMR61_set() {
%1 = call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR61\00"
define i8* @U_WMR61_set() {
%1 = tail call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(void) {
  puts("START");
  puts("jakieś pierdy tutaj");
  puts("INFO nie jest zdefiniowane");
  puts("KONIEC");
  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 <puts@plt>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"START\00"
@.str.1 = [21 x i8] c"jakie\C5\9B pierdy tutaj\00"
@.str.2 = [27 x i8] c"INFO nie jest zdefiniowane\00"
@.str.3 = [7 x i8] c"KONIEC\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"START\00"
@.str.1 = [21 x i8] c"jakie\C5\9B pierdy tutaj\00"
@.str.2 = [27 x i8] c"INFO nie jest zdefiniowane\00"
@.str.3 = [7 x i8] c"KONIEC\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
const char *mz_version(void) { return "10.0.3"; }


x86 assembly (clang, -O0):
<mz_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mz_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"10.0.3\00"
define i8* @mz_version() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [7 x i8] c"10.0.3\00"
define i8* @mz_version() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
void kernel__Int__output(long self) {
  printf("%ld\n", self);
RET_LABEL:;
}


x86 assembly (clang, -O0):
<kernel__Int__output>:
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):
<kernel__Int__output>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
define void @kernel__Int__output(i64 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %0)
ret void
}
double fltsidf(int i) { return i; }


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

x86 assembly (clang, -O2):
<fltsidf>:
cvtsi2sd %edi,%xmm0
ret

LLVM IR (-O0):
define double @fltsidf(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
ret double %4
}

LLVM IR (-O2):
define double @fltsidf(i32 %0) {
%2 = sitofp i32 %0 to double
ret double %2
}
void INT_AD(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_AD() {
ret void
}
/* Variables and functions */
double M_PI;
double sin(double);
double dphi_dx(double L, double a_phix, double phi_x, double x) {
  return -M_PI * a_phix * phi_x * sin(M_PI * a_phix * x / L) / L;
}


x86 assembly (clang, -O0):
<dphi_dx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    0x2eb5(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e84(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dphi_dx>:
sub    $0x28,%rsp
movapd %xmm0,%xmm4
movsd  %xmm0,0x8(%rsp)
mov    0x2ec3(%rip),%rax
movsd  (%rax),%xmm0
movapd 0xecf(%rip),%xmm5
xorpd  %xmm0,%xmm5
mulsd  %xmm1,%xmm5
mulsd  %xmm2,%xmm5
movapd %xmm5,0x10(%rsp)
mulsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
divsd  %xmm4,%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @dphi_dx(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* @M_PI
%10 = fneg double %9
%11 = load double, double* %6
%12 = fmul double %10, %11
%13 = load double, double* %7
%14 = fmul double %12, %13
%15 = load double, double* @M_PI
%16 = load double, double* %6
%17 = fmul double %15, %16
%18 = load double, double* %8
%19 = fmul double %17, %18
%20 = load double, double* %5
%21 = fdiv double %19, %20
%22 = call double @sin(double %21)
%23 = fmul double %14, %22
%24 = load double, double* %5
%25 = fdiv double %23, %24
ret double %25
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @dphi_dx(double %0, double %1, double %2, double %3) {
%5 = load double, double* @M_PI
%6 = fneg double %5
%7 = fmul double %6, %1
%8 = fmul double %7, %2
%9 = fmul double %5, %1
%10 = fmul double %9, %3
%11 = fdiv double %10, %0
%12 = tail call double @sin(double %11)
%13 = fmul double %12, %8
%14 = fdiv double %13, %0
ret double %14
}
/* Variables and functions */
int /*<<< orphan*/ MultM(double **, double **, double **);
int /*<<< orphan*/ genYRotMatrix(double, double **);
void CoordRotY(double theta, double m[3][3]) {
  double a[3][3];
  genYRotMatrix(theta, a);
  MultM(m, a, m);
}


x86 assembly (clang, -O0):
<CoordRotY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x60(%rbp),%rdi
call   1030 <genYRotMatrix@plt>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <MultM@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CoordRotY>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <genYRotMatrix@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <MultM@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @CoordRotY(double %0, [3 x double]* %1) {
%3 = alloca double
%4 = alloca [3 x double]*
%5 = alloca [3 x [3 x double]]
store double %0, double* %3
store [3 x double]* %1, [3 x double]** %4
%6 = load double, double* %3
%7 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0
%8 = bitcast [3 x double]* %7 to double**
%9 = call i32 @genYRotMatrix(double %6, double** %8)
%10 = load [3 x double]*, [3 x double]** %4
%11 = bitcast [3 x double]* %10 to double**
%12 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0
%13 = bitcast [3 x double]* %12 to double**
%14 = load [3 x double]*, [3 x double]** %4
%15 = bitcast [3 x double]* %14 to double**
%16 = call i32 @MultM(double** %11, double** %13, double** %15)
ret void
}

LLVM IR (-O2):
define void @CoordRotY(double %0, [3 x double]* %1) {
%3 = alloca [3 x [3 x double]]
%4 = bitcast [3 x [3 x double]]* %3 to i8*
%5 = bitcast [3 x [3 x double]]* %3 to double**
%6 = call i32 @genYRotMatrix(double %0, double** %5)
%7 = bitcast [3 x double]* %1 to double**
%8 = call i32 @MultM(double** %7, double** %5, double** %7)
ret void
}
int fibo_lib(int x) {
  if (x <= 1) {
    return x;
  } else {
    return fibo_lib(x - 1) + fibo_lib(x - 2);
  }
}


x86 assembly (clang, -O0):
<fibo_lib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1130 <fibo_lib+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <fibo_lib+0x43>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fibo_lib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fibo_lib@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibo_lib>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%edi
jge    1120 <fibo_lib+0x10>
mov    %ebx,%ecx
jmp    1144 <fibo_lib+0x34>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rbx),%edi
call   1030 <fibo_lib@plt>
lea    -0x2(%rbx),%ecx
add    %eax,%ebp
cmp    $0x3,%ebx
mov    %ecx,%ebx
ja     1130 <fibo_lib+0x20>
add    %ecx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fibo_lib(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fibo_lib(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 4
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %9, %3 ]
%13 = phi i32 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i32 %13, %12
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
unsigned xtime(unsigned x) {
  assert(x < 0x100);
  x <<= 1;
  if (x & 0x100)
    x ^= 0x11b;
  assert(x < 0x100);
  return x;
}


x86 assembly (clang, -O0):
<xtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     1154 <xtime+0x44>
mov    -0x4(%rbp),%eax
xor    $0x11b,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtime>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x100,%ebx
setb   %dil
call   1030 <assert@plt>
lea    (%rbx,%rbx,1),%eax
mov    %eax,%ebp
xor    $0x11b,%ebp
test   $0x80,%bl
cmove  %eax,%ebp
xor    %edi,%edi
cmp    $0x100,%ebp
setb   %dil
call   1030 <assert@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @xtime(i32 %0) {
%2 = icmp ult i32 %0, 256
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = shl i32 %0, 1
%6 = and i32 %0, 128
%7 = icmp eq i32 %6, 0
%8 = xor i32 %5, 283
%9 = select i1 %7, i32 %5, i32 %8
%10 = icmp ult i32 %9, 256
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
ret i32 %9
}
int sl_islower(int c) { return (c >= 'a' && c <= 'z'); }


x86 assembly (clang, -O0):
<sl_islower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x61,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <sl_islower+0x20>
cmpl   $0x7a,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sl_islower>:
add    $0xffffff9f,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @sl_islower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 97
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 122
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @sl_islower(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
int test_imm_65int16_mem(short *val) {
  return ((*val) & (0x65 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_65int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, 101
%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_65int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 101
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ clock_set();
void clock_wait() {
  clock_set();
  return;
}


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

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

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

LLVM IR (-O2):
define void @clock_wait() {
%1 = tail call i32 (...) @clock_set()
ret void
}
unsigned long read32(short *p) {
  return ((unsigned long)*(unsigned char *)p) << 24 |
         ((unsigned long)*((unsigned char *)p + 1)) << 16 |
         ((unsigned long)*((unsigned char *)p + 2)) << 8 |
         (unsigned long)*((unsigned char *)p + 3);
}


x86 assembly (clang, -O0):
<read32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%rax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read32>:
mov    (%rdi),%eax
shl    $0x20,%rax
bswap  %rax
ret

LLVM IR (-O0):
define i64 @read32(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = bitcast i16* %3 to i8*
%5 = load i8, i8* %4
%6 = zext i8 %5 to i64
%7 = shl i64 %6, 24
%8 = load i16*, i16** %2
%9 = bitcast i16* %8 to i8*
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = shl i64 %12, 16
%14 = or i64 %7, %13
%15 = load i16*, i16** %2
%16 = bitcast i16* %15 to i8*
%17 = getelementptr inbounds i8, i8* %16, i64 2
%18 = load i8, i8* %17
%19 = zext i8 %18 to i64
%20 = shl i64 %19, 8
%21 = or i64 %14, %20
%22 = load i16*, i16** %2
%23 = bitcast i16* %22 to i8*
%24 = getelementptr inbounds i8, i8* %23, i64 3
%25 = load i8, i8* %24
%26 = zext i8 %25 to i64
%27 = or i64 %21, %26
ret i64 %27
}

LLVM IR (-O2):
define i64 @read32(i16* nocapture %0) {
%2 = bitcast i16* %0 to i8*
%3 = load i8, i8* %2
%4 = zext i8 %3 to i64
%5 = shl nuw nsw i64 %4, 24
%6 = getelementptr inbounds i8, i8* %2, i64 1
%7 = load i8, i8* %6
%8 = zext i8 %7 to i64
%9 = shl nuw nsw i64 %8, 16
%10 = or i64 %9, %5
%11 = getelementptr inbounds i16, i16* %0, i64 1
%12 = bitcast i16* %11 to i8*
%13 = load i8, i8* %12
%14 = zext i8 %13 to i64
%15 = shl nuw nsw i64 %14, 8
%16 = or i64 %10, %15
%17 = getelementptr inbounds i8, i8* %2, i64 3
%18 = load i8, i8* %17
%19 = zext i8 %18 to i64
%20 = or i64 %16, %19
ret i64 %20
}
/* Variables and functions */
int /*<<< orphan*/ ins2(int, int, int /*<<< orphan*/);
void ins(int pos, int v) { ins2(pos, v, 0); }


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

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

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

LLVM IR (-O2):
define void @ins(i32 %0, i32 %1) {
%3 = tail call i32 @ins2(i32 %0, i32 %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ draw_hex_table();
int /*<<< orphan*/ draw_oct_table();
int main(void) {
  draw_hex_table();
  draw_oct_table();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @draw_hex_table()
%2 = tail call i32 (...) @draw_oct_table()
ret i32 0
}
/* Variables and functions */
int myrand();
int irand(int n) {
  int r, rmax = n * (32767 / n);
  while ((r = myrand()) >= rmax)
    ;
  return r / (32767 / n);
}


x86 assembly (clang, -O0):
<irand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x7fff,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <myrand@plt>
mov    %eax,-0x8(%rbp)
cmp    -0xc(%rbp),%eax
jl     114d <irand+0x3d>
jmp    1135 <irand+0x25>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x7fff,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cltd
idiv   %ecx
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irand>:
push   %rbp
push   %rbx
push   %rax
mov    $0x7fff,%eax
xor    %edx,%edx
idiv   %edi
mov    %eax,%ebx
mov    %eax,%ebp
imul   %edi,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <myrand@plt>
cmp    %ebp,%eax
jge    1130 <irand+0x20>
cltd
idiv   %ebx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @irand(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = sdiv i32 32767, %6
%8 = mul nsw i32 %5, %7
store i32 %8, i32* %4
br label %9
9: ; preds = %13, %1
%10 = call i32 (...) @myrand()
store i32 %10, i32* %3
%11 = load i32, i32* %4
%12 = icmp sge i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %9
br label %9
14: ; preds = %9
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = sdiv i32 32767, %16
%18 = sdiv i32 %15, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @irand(i32 %0) {
%2 = sdiv i32 32767, %0
%3 = mul nsw i32 %2, %0
br label %4
4: ; preds = %4, %1
%5 = tail call i32 (...) @myrand()
%6 = icmp slt i32 %5, %3
br i1 %6, label %7, label %4
7: ; preds = %4
%8 = sdiv i32 %5, %2
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ cl_program;
typedef scalar_t__ cl_int;
typedef int /*<<< orphan*/ cl_device_id;

/* Variables and functions */
scalar_t__ CL_SUCCESS;
int /*<<< orphan*/ assert(int);
scalar_t__ clBuildProgram(int /*<<< orphan*/, int, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *);
int BuildProgram(cl_program program, cl_device_id dev) {
  cl_int status = clBuildProgram(program, 1, &dev, NULL, NULL, NULL);
  assert(status == CL_SUCCESS);
  return 0;
}


x86 assembly (clang, -O0):
<BuildProgram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
lea    -0x8(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%rcx
mov    %r9,%r8
call   1030 <clBuildProgram@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2e87(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BuildProgram>:
push   %rax
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    $0x1,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <clBuildProgram@plt>
mov    0x2e9d(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@CL_SUCCESS = global i64 0
define i32 @BuildProgram(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = call i64 @clBuildProgram(i32 %6, i32 1, i32* %4, i32* null, i32* null, i32* null)
store i64 %7, i64* %5
%8 = load i64, i64* %5
%9 = load i64, i64* @CL_SUCCESS
%10 = icmp eq i64 %8, %9
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
ret i32 0
}

LLVM IR (-O2):
@CL_SUCCESS = global i64 0
define i32 @BuildProgram(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i64 @clBuildProgram(i32 %0, i32 1, i32* %3, i32* null, i32* null, i32* null)
%5 = load i64, i64* @CL_SUCCESS
%6 = icmp eq i64 %4, %5
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
long double __ieee754_expl(long double x) {
  fputs("__ieee754_expl not implemented\n", stderr);
  __set_errno(ENOSYS);
  return 0.0;
}


x86 assembly (clang, -O0):
<__ieee754_expl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
lea    0xec2(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
fldz
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ieee754_expl>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
fldz
pop    %rax
ret

LLVM IR (-O0):
@.str = [32 x i8] c"__ieee754_expl not implemented\0A\00"
@stderr = global i32 0
@ENOSYS = global i32 0
define x86_fp80 @__ieee754_expl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load i32, i32* @stderr
%4 = call i32 @fputs(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret x86_fp80 0xK00000000000000000000
}

LLVM IR (-O2):
@.str = [32 x i8] c"__ieee754_expl not implemented\0A\00"
@stderr = global i32 0
@ENOSYS = global i32 0
define x86_fp80 @__ieee754_expl(x86_fp80 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fputs(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @ENOSYS
%5 = tail call i32 @__set_errno(i32 %4)
ret x86_fp80 0xK00000000000000000000
}
/* Variables and functions */
int read(int const, unsigned char *, int);
int irlink_read(const int port, unsigned char *buffer, int bufferSize) {
  if (port == -1) {
    return -1;
  }
  return read(port, buffer, bufferSize);
}


x86 assembly (clang, -O0):
<irlink_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1138 <irlink_read+0x28>
movl   $0xffffffff,-0x4(%rbp)
jmp    114a <irlink_read+0x3a>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <read@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irlink_read>:
cmp    $0xffffffff,%edi
je     111a <irlink_read+0xa>
jmp    1030 <read@plt>
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @irlink_read(i32 %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %0, -1
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @read(i32 %0, i8* %1, i32 %2)
br label %7
7: ; preds = %3, %5
%8 = phi i32 [ %6, %5 ], [ -1, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ mdaq_stream_alloc(unsigned char, int);
void OutStreamInit(unsigned char stream_ch, unsigned char vector_size) {
  mdaq_stream_alloc(stream_ch, (1));
}


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

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

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

LLVM IR (-O2):
define void @OutStreamInit(i8 zeroext %0, i8 zeroext %1) {
%3 = tail call i32 @mdaq_stream_alloc(i8 zeroext %0, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ re_cfree(void *);
void re_free(void *object) { re_cfree(object); }


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

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

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

LLVM IR (-O2):
define void @re_free(i8* %0) {
%2 = tail call i32 @re_cfree(i8* %0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t xTaskGetTickCount() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @xTaskGetTickCount() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ show_free_metadata();
int /*<<< orphan*/ show_malloc_metadata();
int main(void) {
  show_malloc_metadata();
  show_free_metadata();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @show_malloc_metadata()
%2 = tail call i32 (...) @show_free_metadata()
ret i32 0
}