xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ syscall(int, long, long, long, long, long, long);
void *brk(void *addr) {
  return (void *)syscall(0x0c, (long)(addr), (long)(0), (long)(0), (long)(0),
                         (long)(0), (long)(0));
}


x86 assembly (clang, -O0):
<brk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0xc,%edi
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%rdx
mov    %r9,%rcx
mov    %r9,%r8
movq   $0x0,(%rsp)
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brk>:
push   %rax
mov    %rdi,%rsi
movq   $0x0,(%rsp)
mov    $0xc,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <syscall@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i8* @brk(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = call i64 @syscall(i32 12, i64 %4, i64 0, i64 0, i64 0, i64 0, i64 0)
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
define i8* @brk(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i64 @syscall(i32 12, i64 %2, i64 0, i64 0, i64 0, i64 0, i64 0)
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Type definitions */
typedef int uint32_t;

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


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

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

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

LLVM IR (-O2):
define i32 @librpip_gpio_close() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void instruction() {
  printf("This is a game.  You will have fun.  Be sure to enter the\n");
  printf("name of the room exactly as printed.  Enjoy.\n\n");
}


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

x86 assembly (clang, -O2):
<instruction>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf16(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [59 x i8] c"This is a game. You will have fun. Be sure to enter the\0A\00"
@.str.1 = [47 x i8] c"name of the room exactly as printed. Enjoy.\0A\0A\00"
define void @instruction() {
%1 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [58 x i8] c"This is a game. You will have fun. Be sure to enter the\00"
@str.2 = [46 x i8] c"name of the room exactly as printed. Enjoy.\0A\00"
define void @instruction() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned char CRC8(unsigned char, unsigned char);
unsigned char CountCRCSlow(unsigned char initVal, unsigned char *c,
                           unsigned char size) {
  unsigned char i;
  for (i = 0; i < size; i++)
    initVal = CRC8(c[i], initVal);
  return initVal;
}


x86 assembly (clang, -O0):
<CountCRCSlow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movzbl -0x12(%rbp),%eax
movzbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jge    1162 <CountCRCSlow+0x52>
mov    -0x10(%rbp),%rax
movzbl -0x12(%rbp),%ecx
mov    (%rax,%rcx,1),%al
movzbl %al,%edi
movzbl -0x1(%rbp),%esi
call   1030 <CRC8@plt>
mov    %al,-0x1(%rbp)
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    112b <CountCRCSlow+0x1b>
movzbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CountCRCSlow>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%eax
test   %edx,%edx
je     1146 <CountCRCSlow+0x36>
mov    %rsi,%r14
movzbl %dl,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%r14,%rbx,1),%edi
movzbl %al,%esi
call   1030 <CRC8@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <CountCRCSlow+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define zeroext i8 @CountCRCSlow(i8 zeroext %0, i8* nocapture %1, i8 zeroext %2) {
%4 = icmp eq i8 %2, 0
br i1 %4, label %15, label %5
5: ; preds = %3
%6 = zext i8 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %13, %7 ]
%9 = phi i8 [ %0, %5 ], [ %12, %7 ]
%10 = getelementptr inbounds i8, i8* %1, i64 %8
%11 = load i8, i8* %10
%12 = tail call zeroext i8 @CRC8(i8 zeroext %11, i8 zeroext %9)
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %15, label %7
15: ; preds = %7, %3
%16 = phi i8 [ %0, %3 ], [ %12, %7 ]
ret i8 %16
}
/* Variables and functions */
int /*<<< orphan*/ ot(char *);
defstorage() { ot(".comm "); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c".comm \00"
define i32 @defstorage() {
%1 = alloca i32
%2 = call i32 @ot(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [7 x i8] c".comm \00"
define i32 @defstorage() {
%1 = tail call i32 @ot(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
#define GLUT_KEY_DOWN 131
#define GLUT_KEY_LEFT 130
#define GLUT_KEY_RIGHT 129
#define GLUT_KEY_UP 128
int /*<<< orphan*/ glutPostRedisplay();
void SpecialKey(int key, int x, int y) {
  switch (key) {
  case GLUT_KEY_UP:
    break;
  case GLUT_KEY_DOWN:
    break;
  case GLUT_KEY_LEFT:
    break;
  case GLUT_KEY_RIGHT:
    break;
  }
  glutPostRedisplay();
}


x86 assembly (clang, -O0):
<SpecialKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     115e <SpecialKey+0x4e>
mov    -0x18(%rbp),%rax
lea    0xebf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    115e <SpecialKey+0x4e>
jmp    115e <SpecialKey+0x4e>
jmp    115e <SpecialKey+0x4e>
jmp    115e <SpecialKey+0x4e>
mov    $0x0,%al
call   1030 <glutPostRedisplay@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @SpecialKey(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
switch i32 %7, label %12 [
i32 128, label %8
i32 131, label %9
i32 130, label %10
i32 129, label %11
]
8: ; preds = %3
br label %12
9: ; preds = %3
br label %12
10: ; preds = %3
br label %12
11: ; preds = %3
br label %12
12: ; preds = %3, %11, %10, %9, %8
%13 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
define void @SpecialKey(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (...) @glutPostRedisplay()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _ptrc_glBindBuffer(int, int /*<<< orphan*/);
bool unbind() {
  _ptrc_glBindBuffer(0x8893, 0);
  return true;
}


x86 assembly (clang, -O0):
<unbind>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8893,%edi
xor    %esi,%esi
call   1030 <_ptrc_glBindBuffer@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unbind>:
push   %rax
mov    $0x8893,%edi
xor    %esi,%esi
call   1030 <_ptrc_glBindBuffer@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @unbind() {
%1 = call i32 @_ptrc_glBindBuffer(i32 34963, i32 0)
ret i32 1
}

LLVM IR (-O2):
define i32 @unbind() {
%1 = tail call i32 @_ptrc_glBindBuffer(i32 34963, i32 0)
ret i32 1
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ read_cycle_stat(int);
int /*<<< orphan*/ write(int, int *, int);
void process_input(int fd, uint8_t val) {
  switch (val) {
  case 0xDD:
    read_cycle_stat(fd);
    break;
  default:
    write(1, &val, 1);
    break;
  }
}


x86 assembly (clang, -O0):
<process_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0xdd,%eax
jne    114e <process_input+0x2e>
jmp    1141 <process_input+0x21>
mov    -0x4(%rbp),%edi
call   1040 <read_cycle_stat@plt>
jmp    115e <process_input+0x3e>
mov    $0x1,%edx
lea    -0x8(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_input>:
push   %rax
mov    %esi,0x4(%rsp)
cmp    $0xdd,%esi
jne    1133 <process_input+0x13>
pop    %rax
jmp    1040 <read_cycle_stat@plt>
lea    0x4(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @process_input(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
switch i32 %5, label %9 [
i32 221, label %6
]
6: ; preds = %2
%7 = load i32, i32* %3
%8 = call i32 @read_cycle_stat(i32 %7)
br label %11
9: ; preds = %2
%10 = call i32 @write(i32 1, i32* %4, i32 1)
br label %11
11: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
define void @process_input(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = icmp eq i32 %1, 221
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @read_cycle_stat(i32 %0)
br label %9
7: ; preds = %2
%8 = call i32 @write(i32 1, i32* %3, i32 1)
br label %9
9: ; preds = %7, %5
ret void
}
int retmaior(int *a, int *b) {
  int *tmp;
  if (*a > *b)
    return *a;
  else {
    *tmp = *a;
    *a = *b;
    *b = *tmp;
    return *b;
  }
}


x86 assembly (clang, -O0):
<retmaior>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jle    112c <retmaior+0x2c>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <retmaior+0x59>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @retmaior(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = icmp sgt i32 %3, %4
tail call void @llvm.assume(i1 %5)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ pthread_create(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                          void *(*)(void *), void *);
int /*<<< orphan*/ stderr;
void sirius_pthread_create(pthread_t *thread, const pthread_attr_t *attr,
                           void *(*start_routine)(void *), void *arg) {
  if (pthread_create(thread, attr, start_routine, arg)) {
    fprintf(stderr, "pthread_create() failed.\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<sirius_pthread_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1040 <pthread_create@plt>
cmp    $0x0,%rax
je     1186 <sirius_pthread_create+0x56>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"pthread_create() failed.\0A\00"
define void @sirius_pthread_create(i32* %0, i32* %1, i8* (i8*)* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8* (i8*)*
%8 = alloca i8*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i8* (i8*)* %2, i8* (i8*)** %7
store i8* %3, i8** %8
%9 = load i32*, i32** %5
%10 = load i32*, i32** %6
%11 = load i8* (i8*)*, i8* (i8*)** %7
%12 = load i8*, i8** %8
%13 = call i64 @pthread_create(i32* %9, i32* %10, i8* (i8*)* %11, i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %4
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %4
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"pthread_create() failed.\0A\00"
define void @sirius_pthread_create(i32* %0, i32* %1, i8* (i8*)* %2, i8* %3) {
%5 = tail call i64 @pthread_create(i32* %0, i32* %1, i8* (i8*)* %2, i8* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %4
ret void
}
char *scan_white(char *src) {
  while (*src == ' ' || *src == '\t')
    src++;
  return src;
}


x86 assembly (clang, -O0):
<scan_white>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     112d <scan_white+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <scan_white+0x3d>
jmp    114e <scan_white+0x4e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <scan_white+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_white>:
mov    %rdi,%rax
jmp    1114 <scan_white+0x14>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1110 <scan_white+0x10>
cmp    $0x9,%cl
je     1110 <scan_white+0x10>
ret

LLVM IR (-O0):
define i8* @scan_white(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 32
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 9
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ true, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @scan_white(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 9, label %5
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
ret i8* %3
}
int main(void) {
  char s[27];
  char t;
  s[0] = 'a' + t;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movsbl -0x21(%rbp),%eax
add    $0x61,%eax
mov    %al,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [27 x i8]
%2 = alloca i8
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = add nsw i32 97, %4
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
store i8 %6, i8* %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ LED_INIT(int);
void init_demo(void) {
  LED_INIT(2);
  {};
}


x86 assembly (clang, -O0):
<init_demo>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <LED_INIT@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @init_demo() {
%1 = call i32 @LED_INIT(i32 2)
ret void
}

LLVM IR (-O2):
define void @init_demo() {
%1 = tail call i32 @LED_INIT(i32 2)
ret void
}
double Div(double a, double b) { return a / b; }


x86 assembly (clang, -O0):
<Div>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Div>:
divsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @Div(double %0, double %1) {
%3 = fdiv double %0, %1
ret double %3
}
/* Variables and functions */
char *ho_strchr(const char *s, int c) {
  for (; *s; ++s) {
    if (*s == c)
      return (char *)s;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<ho_strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <ho_strchr+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1135 <ho_strchr+0x35>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <ho_strchr+0x53>
jmp    113a <ho_strchr+0x3a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <ho_strchr+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ho_strchr>:
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <ho_strchr+0x23>
mov    %rdi,%rax
nopl   0x0(%rax)
movsbl %cl,%ecx
cmp    %esi,%ecx
je     1125 <ho_strchr+0x25>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <ho_strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @ho_strchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %12, %10 ], [ %3, %2 ]
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = sext i8 %6 to i32
%9 = icmp eq i32 %8, %1
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %2
%15 = phi i8* [ null, %2 ], [ null, %10 ], [ %7, %5 ]
ret i8* %15
}
/* Variables and functions */
int __clzsi2(long long);
int __clzdi2(long long val) {
  if (val >> 32) {
    return __clzsi2(val >> 32);
  } else {
    return __clzsi2(val) + 32;
  }
}


x86 assembly (clang, -O0):
<__clzdi2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x20,%rax
cmp    $0x0,%rax
je     1143 <__clzdi2+0x33>
mov    -0x10(%rbp),%rdi
sar    $0x20,%rdi
call   1030 <__clzsi2@plt>
mov    %eax,-0x4(%rbp)
jmp    1152 <__clzdi2+0x42>
mov    -0x10(%rbp),%rdi
call   1030 <__clzsi2@plt>
add    $0x20,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__clzdi2>:
mov    %rdi,%rax
shr    $0x20,%rax
jne    1124 <__clzdi2+0x14>
push   %rax
call   1030 <__clzsi2@plt>
add    $0x20,%eax
pop    %rcx
ret
sar    $0x20,%rdi
jmp    1030 <__clzsi2@plt>

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

LLVM IR (-O2):
define i32 @__clzdi2(i64 %0) {
%2 = icmp ult i64 %0, 4294967296
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = ashr i64 %0, 32
%5 = tail call i32 @__clzsi2(i64 %4)
br label %9
6: ; preds = %1
%7 = tail call i32 @__clzsi2(i64 %0)
%8 = add nsw i32 %7, 32
br label %9
9: ; preds = %6, %3
%10 = phi i32 [ %5, %3 ], [ %8, %6 ]
ret i32 %10
}
int test_imm_F0int8_mem(signed char *val) {
  return ((*val) & (-0xF0 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_F0int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff10,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_F0int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -240
%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_F0int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -240
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t complementBit_fun_uint16_t(uint16_t x, uint32_t i) {
  return x ^ 1 << i;
}


x86 assembly (clang, -O0):
<complementBit_fun_uint16_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @complementBit_fun_uint16_t(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void vector_print_3d(const double a[3]) {
  for (int i = 0; i < 3; i++)
    printf("%15f\n", a[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<vector_print_3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1156 <vector_print_3d+0x46>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xebf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <vector_print_3d+0x13>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_print_3d>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
lea    0xece(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x8(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%15f\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @vector_print_3d(double* %0) {
%2 = alloca double*
%3 = alloca i32
store double* %0, double** %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 3
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load double*, double** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds double, double* %8, i64 %10
%12 = load double, double* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %12)
br label %14
14: ; preds = %7
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %4
17: ; preds = %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%15f\0A\00"
define void @vector_print_3d(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %2)
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %5)
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %8)
%10 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello, Embedded Systems!!!!\n");
  printf("One more thing!! This is awesome!!!!\n");
  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 <printf@plt>
lea    0xeeb(%rip),%rdi
call   1030 <printf@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    0xef8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Hello, Embedded Systems!!!!\0A\00"
@.str.1 = [38 x i8] c"One more thing!! This is awesome!!!!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [28 x i8] c"Hello, Embedded Systems!!!!\00"
@str.2 = [37 x i8] c"One more thing!! This is awesome!!!!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int usleep(unsigned int);
int Sleep(unsigned int mSec) { return usleep(mSec * 1000); }


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

x86 assembly (clang, -O2):
<Sleep>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define i32 @Sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @Sleep(i32 %0) {
%2 = mul i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void my_free(const void *s) {
  if (s)
    free((void *)s);
}


x86 assembly (clang, -O0):
<my_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <my_free+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @my_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @my_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
char getScancode();
char getchar() { return getScancode(); }


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

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

LLVM IR (-O0):
define signext i8 @getchar() {
%1 = call signext i8 (...) @getScancode()
ret i8 %1
}

LLVM IR (-O2):
define signext i8 @getchar() {
%1 = tail call signext i8 (...) @getScancode()
ret i8 %1
}
/* Variables and functions */
int /*<<< orphan*/ DrawBMP219(unsigned long, unsigned long, unsigned long,
                              unsigned long, unsigned long, unsigned long,
                              unsigned long, unsigned long, unsigned long);
void drawbmp(unsigned long xs, unsigned long ys, unsigned long ws,
             unsigned long hs, unsigned long xd, unsigned long yd,
             unsigned long wd, unsigned long hd, unsigned long c) {
  DrawBMP219(xs, ys, ws, hs, xd, yd, wd, hd, c);
}


x86 assembly (clang, -O0):
<drawbmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%r11
mov    0x18(%rbp),%r10
mov    0x20(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <DrawBMP219@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawbmp>:
jmp    1030 <DrawBMP219@plt>

LLVM IR (-O0):
define void @drawbmp(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6, i64 %7, i64 %8) {
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
store i64 %0, i64* %10
store i64 %1, i64* %11
store i64 %2, i64* %12
store i64 %3, i64* %13
store i64 %4, i64* %14
store i64 %5, i64* %15
store i64 %6, i64* %16
store i64 %7, i64* %17
store i64 %8, i64* %18
%19 = load i64, i64* %10
%20 = load i64, i64* %11
%21 = load i64, i64* %12
%22 = load i64, i64* %13
%23 = load i64, i64* %14
%24 = load i64, i64* %15
%25 = load i64, i64* %16
%26 = load i64, i64* %17
%27 = load i64, i64* %18
%28 = call i32 @DrawBMP219(i64 %19, i64 %20, i64 %21, i64 %22, i64 %23, i64 %24, i64 %25, i64 %26, i64 %27)
ret void
}

LLVM IR (-O2):
define void @drawbmp(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6, i64 %7, i64 %8) {
%10 = tail call i32 @DrawBMP219(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6, i64 %7, i64 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int funkcja_testowa(int dane) {
  printf("funkcja_testowa wywolana. dane=%d\r\n", dane);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [36 x i8] c"funkcja_testowa wywolana. dane=%d\0D\0A\00"
define i32 @funkcja_testowa(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 0
}
unsigned long PWMFaultIntGet(unsigned long ulBase) {
  return ((ulBase == 0x40028000) ? 25 : 154);
}


x86 assembly (clang, -O0):
<PWMFaultIntGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x9a,%eax
mov    $0x19,%ecx
cmp    $0x40028000,%rdx
cmove  %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMFaultIntGet>:
cmp    $0x40028000,%rdi
mov    $0x19,%ecx
mov    $0x9a,%eax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
define i64 @PWMFaultIntGet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 1073905664
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 25, i32 154
%7 = sext i32 %6 to i64
ret i64 %7
}

LLVM IR (-O2):
define i64 @PWMFaultIntGet(i64 %0) {
%2 = icmp eq i64 %0, 1073905664
%3 = select i1 %2, i64 25, i64 154
ret i64 %3
}
void babl_base_destroy(void) {}


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

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

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

LLVM IR (-O2):
define void @babl_base_destroy() {
ret void
}
void tcp_fin(struct Seaper *seap, struct NetFrame *frame) {
  seap;
  frame;
}


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

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

LLVM IR (-O0):
%struct.Seaper = type opaque
%struct.NetFrame = type opaque
define void @tcp_fin(%struct.Seaper* %0, %struct.NetFrame* %1) {
%3 = alloca %struct.Seaper*
%4 = alloca %struct.NetFrame*
store %struct.Seaper* %0, %struct.Seaper** %3
store %struct.NetFrame* %1, %struct.NetFrame** %4
%5 = load %struct.Seaper*, %struct.Seaper** %3
%6 = load %struct.NetFrame*, %struct.NetFrame** %4
ret void
}

LLVM IR (-O2):
%struct.Seaper = type opaque
%struct.NetFrame = type opaque
define void @tcp_fin(%struct.Seaper* nocapture %0, %struct.NetFrame* nocapture %1) {
ret void
}
/* Variables and functions */
int *bar();
int foo(int a) {
  int *b = bar();
  return b[a];
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <bar@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <bar@plt>
movslq %ebx,%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i32* (...) @bar()
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = tail call i32* (...) @bar()
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i32, i32* %2, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
void produce_v(int *v) {
  v[0] = 0;
  v[1] = 1;
  v[2] = 2;
}


x86 assembly (clang, -O0):
<produce_v>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1,0x4(%rax)
mov    -0x8(%rbp),%rax
movl   $0x2,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<produce_v>:
movabs $0x100000000,%rax
mov    %rax,(%rdi)
movl   $0x2,0x8(%rdi)
ret

LLVM IR (-O0):
define void @produce_v(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
store i32 0, i32* %4
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 1, i32* %6
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 2
store i32 2, i32* %8
ret void
}

LLVM IR (-O2):
define void @produce_v(i32* nocapture writeonly %0) {
store i32 0, i32* %0
%2 = getelementptr inbounds i32, i32* %0, i64 1
store i32 1, i32* %2
%3 = getelementptr inbounds i32, i32* %0, i64 2
store i32 2, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void yuv2rgb_init(unsigned bpp, int mode) {
  printf("broken, this should use the swscaler\n");
}


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

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

LLVM IR (-O0):
@.str = [38 x i8] c"broken, this should use the swscaler\0A\00"
define void @yuv2rgb_init(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [37 x i8] c"broken, this should use the swscaler\00"
define void @yuv2rgb_init(i32 %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ latinSquare(int);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/);
int main() {
  srand((unsigned int)time((time_t)0));
  latinSquare(5);
  latinSquare(5);
  latinSquare(10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x5,%edi
call   1030 <latinSquare@plt>
mov    $0x5,%edi
call   1030 <latinSquare@plt>
mov    $0xa,%edi
call   1030 <latinSquare@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x5,%edi
call   1030 <latinSquare@plt>
mov    $0x5,%edi
call   1030 <latinSquare@plt>
mov    $0xa,%edi
call   1030 <latinSquare@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @time(i32 0)
%3 = trunc i64 %2 to i32
%4 = call i32 @srand(i32 %3)
%5 = call i32 @latinSquare(i32 5)
%6 = call i32 @latinSquare(i32 5)
%7 = call i32 @latinSquare(i32 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @time(i32 0)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @srand(i32 %2)
%4 = tail call i32 @latinSquare(i32 5)
%5 = tail call i32 @latinSquare(i32 5)
%6 = tail call i32 @latinSquare(i32 10)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fprintf(int /*<<< orphan*/ *, char *, char *, char *);
int ini_writestring(FILE *file, char *key, char *value) {
  return fprintf(file, "        %s = %s\n", key, value);
}


x86 assembly (clang, -O0):
<ini_writestring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ini_writestring>:
mov    %rdx,%rcx
mov    %rsi,%rdx
lea    0xee3(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@.str = [17 x i8] c" %s = %s\0A\00"
define i32 @ini_writestring(i32* nocapture %0, i8* %1, i8* %2) {
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
ret i32 %4
}
double ltr_int_sqr(double f) { return (f * f); }


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

x86 assembly (clang, -O2):
<ltr_int_sqr>:
mulsd  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @ltr_int_sqr(double %0) {
%2 = fmul double %0, %0
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ pushNarray(char *, unsigned int);
void pushinteger8array_(char *x, unsigned int *n) { pushNarray(x, (*n * 8)); }


x86 assembly (clang, -O0):
<pushinteger8array_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
shl    $0x3,%esi
call   1030 <pushNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pushinteger8array_>:
mov    (%rsi),%esi
shl    $0x3,%esi
jmp    1030 <pushNarray@plt>

LLVM IR (-O0):
define void @pushinteger8array_(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
%8 = mul i32 %7, 8
%9 = call i32 @pushNarray(i8* %5, i32 %8)
ret void
}

LLVM IR (-O2):
define void @pushinteger8array_(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 3
%5 = tail call i32 @pushNarray(i8* %0, i32 %4)
ret void
}
/* Type definitions */
struct linked_mem_pool {
  int dummy;
};

/* Variables and functions */
int linked_mem_pool_lack(struct linked_mem_pool *);
int virtual_machine_resource_pool_linked_lack(void *pool_ptr) {
  struct linked_mem_pool *linked_mem_pool_ptr = pool_ptr;
  return linked_mem_pool_lack(linked_mem_pool_ptr);
}


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

x86 assembly (clang, -O2):
<virtual_machine_resource_pool_linked_lack>:
jmp    1030 <linked_mem_pool_lack@plt>

LLVM IR (-O0):
%struct.linked_mem_pool = type { i32 }
define i32 @virtual_machine_resource_pool_linked_lack(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.linked_mem_pool*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.linked_mem_pool*
store %struct.linked_mem_pool* %5, %struct.linked_mem_pool** %3
%6 = load %struct.linked_mem_pool*, %struct.linked_mem_pool** %3
%7 = call i32 @linked_mem_pool_lack(%struct.linked_mem_pool* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.linked_mem_pool = type { i32 }
define i32 @virtual_machine_resource_pool_linked_lack(i8* %0) {
%2 = bitcast i8* %0 to %struct.linked_mem_pool*
%3 = tail call i32 @linked_mem_pool_lack(%struct.linked_mem_pool* %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ RamWrite32A(int, int);
unsigned char RdStatus(int);
void OisEnaNCL(void) {
  unsigned char UcStRd = 1;
  RamWrite32A(0xF012, 0x00000002 | 0x00000001);
  while (UcStRd) {
    UcStRd = RdStatus(1);
  }
}


x86 assembly (clang, -O0):
<OisEnaNCL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x1,-0x1(%rbp)
mov    $0xf012,%edi
mov    $0x3,%esi
call   1030 <RamWrite32A@plt>
cmpb   $0x0,-0x1(%rbp)
je     1157 <OisEnaNCL+0x37>
mov    $0x1,%edi
call   1040 <RdStatus@plt>
mov    %al,-0x1(%rbp)
jmp    113b <OisEnaNCL+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OisEnaNCL>:
push   %rax
mov    $0xf012,%edi
mov    $0x3,%esi
call   1030 <RamWrite32A@plt>
mov    $0x1,%edi
call   1040 <RdStatus@plt>
test   %al,%al
jne    1130 <OisEnaNCL+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @OisEnaNCL() {
%1 = alloca i8
store i8 1, i8* %1
%2 = call i32 @RamWrite32A(i32 61458, i32 3)
br label %3
3: ; preds = %6, %0
%4 = load i8, i8* %1
%5 = icmp ne i8 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = call zeroext i8 @RdStatus(i32 1)
store i8 %7, i8* %1
br label %3
8: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @OisEnaNCL() {
%1 = tail call i32 @RamWrite32A(i32 61458, i32 3)
br label %2
2: ; preds = %0, %2
%3 = tail call zeroext i8 @RdStatus(i32 1)
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %2
5: ; preds = %2
ret void
}