xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ test2(int *);
void test() {
  int i = 1;
  test2(&i);
  printf("%d \n", i);
  test2(&i);
  printf("%d \n", i);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1040 <test2@plt>
mov    -0x4(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    -0x4(%rbp),%rdi
call   1040 <test2@plt>
mov    -0x4(%rbp),%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r14
push   %rbx
push   %rax
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1040 <test2@plt>
mov    0x4(%rsp),%esi
lea    0xebc(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <test2@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d \0A\00"
define void @test() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%3 = call i32 @test2(i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @test2(i32* %1)
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void errout(char *reason) {
  perror(reason);
  exit(1);
}


x86 assembly (clang, -O0):
<errout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<errout>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @errout(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @errout(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
void default_color(FILE *stream) { fprintf(stream, "%c[0m", 0x1B); }


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

x86 assembly (clang, -O2):
<default_color>:
lea    0xee9(%rip),%rsi
mov    $0x1b,%edx
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"%c[0m\00"
define void @default_color(i32* nocapture %0) {
%2 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 27)
ret void
}
/* Variables and functions */
unsigned int mask(int, int);
unsigned int right_rotate_n_bits(unsigned int f_num, int f_bits) {
  return (f_num >> f_bits) | ((f_num & (mask(f_bits - 1, f_bits)))
                              << (8 * sizeof(void *) - f_bits));
}


x86 assembly (clang, -O0):
<right_rotate_n_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
call   1030 <mask@plt>
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
and    %ecx,%edx
movslq -0x8(%rbp),%rsi
mov    $0x40,%ecx
sub    %rsi,%rcx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<right_rotate_n_bits>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
mov    %edi,%ebp
mov    %ebx,%ecx
shr    %cl,%ebp
lea    -0x1(%rbx),%edi
call   1030 <mask@plt>
and    %r14d,%eax
neg    %bl
mov    %ebx,%ecx
shl    %cl,%eax
or     %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @right_rotate_n_bits(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 = lshr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = load i32, i32* %4
%12 = call i32 @mask(i32 %10, i32 %11)
%13 = and i32 %8, %12
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = sub i64 64, %15
%17 = trunc i64 %16 to i32
%18 = shl i32 %13, %17
%19 = or i32 %7, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @right_rotate_n_bits(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = add nsw i32 %1, -1
%5 = tail call i32 @mask(i32 %4, i32 %1)
%6 = and i32 %5, %0
%7 = sub i32 64, %1
%8 = shl i32 %6, %7
%9 = or i32 %8, %3
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ clear_rect(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
void clear_screen(void) { clear_rect(0, 0, 24, 80); }


x86 assembly (clang, -O0):
<clear_screen>:
push   %rbp
mov    %rsp,%rbp
xor    %esi,%esi
mov    $0x18,%edx
mov    $0x50,%ecx
mov    %esi,%edi
call   1030 <clear_rect@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_screen>:
xor    %edi,%edi
xor    %esi,%esi
mov    $0x18,%edx
mov    $0x50,%ecx
jmp    1030 <clear_rect@plt>

LLVM IR (-O0):
define void @clear_screen() {
%1 = call i32 @clear_rect(i32 0, i32 0, i32 24, i32 80)
ret void
}

LLVM IR (-O2):
define void @clear_screen() {
%1 = tail call i32 @clear_rect(i32 0, i32 0, i32 24, i32 80)
ret void
}
unsigned insert_za(insn, value, errmsg)
unsigned insn;
int value __attribute__((unused));
const char **errmsg __attribute__((unused));
{ return insn | (31 << 21); }


x86 assembly (clang, -O0):
<insert_za>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
or     $0x3e00000,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_za>:
mov    %edi,%eax
or     $0x3e00000,%eax
ret

LLVM IR (-O0):
define i32 @insert_za(i32 %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = load i32, i32* %4
%8 = or i32 %7, 65011712
ret i32 %8
}

LLVM IR (-O2):
define i32 @insert_za(i32 %0, i32 %1, i8** nocapture readnone %2) {
%4 = or i32 %0, 65011712
ret i32 %4
}
int fz_colorburn_byte(int bd, int s) {
  if (s > 0)
    return 255 -
           ((255) < (255 * (255 - bd) / s) ? (255) : (255 * (255 - bd) / s));
  else
    return 0;
}


x86 assembly (clang, -O0):
<fz_colorburn_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1169 <fz_colorburn_byte+0x69>
mov    $0xff,%eax
sub    -0x8(%rbp),%eax
imul   $0xff,%eax,%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%ecx
mov    $0xff,%eax
cmp    %ecx,%eax
jge    1142 <fz_colorburn_byte+0x42>
mov    $0xff,%eax
mov    %eax,-0x10(%rbp)
jmp    1157 <fz_colorburn_byte+0x57>
mov    $0xff,%eax
sub    -0x8(%rbp),%eax
imul   $0xff,%eax,%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    $0xff,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1170 <fz_colorburn_byte+0x70>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fz_colorburn_byte>:
test   %esi,%esi
jle    112d <fz_colorburn_byte+0x2d>
mov    $0xff,%r8d
mov    $0xff,%ecx
sub    %edi,%ecx
mov    %ecx,%eax
shl    $0x8,%eax
sub    %ecx,%eax
cltd
idiv   %esi
mov    %eax,%ecx
sub    %eax,%r8d
xor    %eax,%eax
cmp    $0x100,%ecx
cmovl  %r8d,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @fz_colorburn_byte(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = sub nsw i32 255, %0
%6 = mul nsw i32 %5, 255
%7 = sdiv i32 %6, %1
%8 = icmp sgt i32 %7, 255
%9 = sub i32 255, %7
%10 = select i1 %8, i32 0, i32 %9
br label %11
11: ; preds = %2, %4
%12 = phi i32 [ %10, %4 ], [ 0, %2 ]
ret i32 %12
}
/* Type definitions */
struct epoll_event {
  int dummy;
};
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int syscall(int, int, struct epoll_event *, int, int,
            int /*<<< orphan*/ const *, int);
int epoll_pwait(int fd, struct epoll_event *ev, int cnt, int to,
                const sigset_t *sigs) {
  return syscall(319, fd, ev, cnt, to, sigs, 8);
}


x86 assembly (clang, -O0):
<epoll_pwait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x20(%rbp),%r9
mov    $0x13f,%edi
movl   $0x8,(%rsp)
call   1030 <syscall@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epoll_pwait>:
push   %rax
mov    %r8,%r9
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
movl   $0x8,(%rsp)
mov    $0x13f,%edi
call   1030 <syscall@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.epoll_event = type { i32 }
define i32 @epoll_pwait(i32 %0, %struct.epoll_event* %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca i32
%7 = alloca %struct.epoll_event*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
store i32 %0, i32* %6
store %struct.epoll_event* %1, %struct.epoll_event** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load %struct.epoll_event*, %struct.epoll_event** %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i32*, i32** %10
%16 = call i32 @syscall(i32 319, i32 %11, %struct.epoll_event* %12, i32 %13, i32 %14, i32* %15, i32 8)
ret i32 %16
}

LLVM IR (-O2):
%struct.epoll_event = type { i32 }
define i32 @epoll_pwait(i32 %0, %struct.epoll_event* %1, i32 %2, i32 %3, i32* %4) {
%6 = tail call i32 @syscall(i32 319, i32 %0, %struct.epoll_event* %1, i32 %2, i32 %3, i32* %4, i32 8)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ notifyEvent(char *, int, int /*<<< orphan*/,
                               int /*<<< orphan*/);
void sesc_acquire(int vaddr) { notifyEvent("sesc_acquire", vaddr, 0, 0); }


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

x86 assembly (clang, -O2):
<sesc_acquire>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <notifyEvent@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"sesc_acquire\00"
define void @sesc_acquire(i32 %0) {
%2 = tail call i32 @notifyEvent(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %0, i32 0, i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int);
void Sys_StreamSeek(FILE *f, int offset, int origin) {
  fseek(f, offset, origin);
}


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

x86 assembly (clang, -O2):
<Sys_StreamSeek>:
jmp    1030 <fseek@plt>

LLVM IR (-O0):
define void @Sys_StreamSeek(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
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @fseek(i32* %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @Sys_StreamSeek(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @fseek(i32* %0, i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  extern char **environ;
  int i;
  for (i = 0; environ[i] != NULL; i++)
    printf("%s\n", environ[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%rax
movslq -0x8(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     116b <main+0x5b>
mov    0x2ea2(%rip),%rax
mov    (%rax),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    0x2ecc(%rip),%r14
mov    (%r14),%rax
mov    (%rax),%rsi
test   %rsi,%rsi
je     1158 <main+0x48>
mov    $0x8,%ebx
lea    0xecd(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
call   1030 <printf@plt>
mov    (%r14),%rax
mov    (%rax,%rbx,1),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1140 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@environ = external global i8**
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = load i8**, i8*** @environ
%2 = load i8*, i8** %1
%3 = icmp eq i8* %2, null
br i1 %3, label %13, label %4
4: ; preds = %0, %4
%5 = phi i64 [ %8, %4 ], [ 0, %0 ]
%6 = phi i8* [ %11, %4 ], [ %2, %0 ]
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = add nuw i64 %5, 1
%9 = load i8**, i8*** @environ
%10 = getelementptr inbounds i8*, i8** %9, i64 %8
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %4
13: ; preds = %4, %0
ret i32 0
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void I2CSlaveIntDisableEx(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ;
  (*((volatile unsigned long *)(ui32Base + 0x0000080C))) &= ~ui32IntFlags;
}


x86 assembly (clang, -O0):
<I2CSlaveIntDisableEx>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
xor    $0xffffffffffffffff,%rdx
mov    -0x8(%rbp),%rax
mov    0x80c(%rax),%rcx
and    %rdx,%rcx
mov    %rcx,0x80c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CSlaveIntDisableEx>:
mov    %rdi,-0x8(%rsp)
mov    %rsi,-0x10(%rsp)
mov    -0x10(%rsp),%rax
not    %rax
mov    -0x8(%rsp),%rcx
and    %rax,0x80c(%rcx)
ret

LLVM IR (-O0):
define void @I2CSlaveIntDisableEx(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = xor i64 %5, -1
%7 = load volatile i64, i64* %3
%8 = add i64 %7, 2060
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
%11 = and i64 %10, %6
store volatile i64 %11, i64* %9
ret void
}

LLVM IR (-O2):
define void @I2CSlaveIntDisableEx(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = xor i64 %5, -1
%7 = load volatile i64, i64* %3
%8 = add i64 %7, 2060
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
%11 = and i64 %10, %6
store volatile i64 %11, i64* %9
ret void
}
double jac_pendulum_sign(double x) { return x < 0 ? -1 : x > 0 ? 1 : x; }


x86 assembly (clang, -O0):
<jac_pendulum_sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1129 <jac_pendulum_sign+0x29>
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1161 <jac_pendulum_sign+0x61>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114d <jac_pendulum_sign+0x4d>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1157 <jac_pendulum_sign+0x57>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<jac_pendulum_sign>:
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm0,%xmm2
movsd  0xeeb(%rip),%xmm3
andpd  %xmm2,%xmm3
andnpd %xmm0,%xmm2
orpd   %xmm3,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm2,%xmm1
movsd  0xed2(%rip),%xmm2
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @jac_pendulum_sign(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fcmp ogt double %0, 0.000000e+00
%4 = select i1 %3, double 1.000000e+00, double %0
%5 = select i1 %2, double -1.000000e+00, double %4
ret double %5
}
/* Variables and functions */
int pipe(int *);
int sync_pipe_create(int fd[]) { return pipe(fd); }


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

x86 assembly (clang, -O2):
<sync_pipe_create>:
jmp    1030 <pipe@plt>

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

LLVM IR (-O2):
define i32 @sync_pipe_create(i32* %0) {
%2 = tail call i32 @pipe(i32* %0)
ret i32 %2
}
/* Type definitions */
struct pollfd {
  int fd;
  int /*<<< orphan*/ events;
};

/* Variables and functions */
int /*<<< orphan*/ POLLOUT;
int poll(struct pollfd *, int, int);
int wait_for_write(int fd, int tout) {
  struct pollfd fds[1];
  fds[0].fd = fd;
  fds[0].events = POLLOUT;
  return poll(fds, 1, tout);
}


x86 assembly (clang, -O0):
<wait_for_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    0x2ecd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    $0x1,%esi
call   1030 <poll@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_for_write>:
push   %rax
mov    %esi,%edx
mov    %edi,(%rsp)
mov    0x2edb(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    %rsp,%rdi
mov    $0x1,%esi
call   1030 <poll@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.pollfd = type { i32, i32 }
@POLLOUT = global i32 0
define i32 @wait_for_write(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1 x %struct.pollfd]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = getelementptr inbounds [1 x %struct.pollfd], [1 x %struct.pollfd]* %5, i64 0, i64 0
%8 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %7, i32 0, i32 0
store i32 %6, i32* %8
%9 = load i32, i32* @POLLOUT
%10 = getelementptr inbounds [1 x %struct.pollfd], [1 x %struct.pollfd]* %5, i64 0, i64 0
%11 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %10, i32 0, i32 1
store i32 %9, i32* %11
%12 = getelementptr inbounds [1 x %struct.pollfd], [1 x %struct.pollfd]* %5, i64 0, i64 0
%13 = load i32, i32* %4
%14 = call i32 @poll(%struct.pollfd* %12, i32 1, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
%struct.pollfd = type { i32, i32 }
@POLLOUT = global i32 0
define i32 @wait_for_write(i32 %0, i32 %1) {
%3 = alloca [1 x %struct.pollfd]
%4 = bitcast [1 x %struct.pollfd]* %3 to i8*
%5 = getelementptr inbounds [1 x %struct.pollfd], [1 x %struct.pollfd]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1 x %struct.pollfd], [1 x %struct.pollfd]* %3, i64 0, i64 0, i32 0
store i32 %0, i32* %6
%7 = load i32, i32* @POLLOUT
%8 = getelementptr inbounds [1 x %struct.pollfd], [1 x %struct.pollfd]* %3, i64 0, i64 0, i32 1
store i32 %7, i32* %8
%9 = call i32 @poll(%struct.pollfd* %5, i32 1, i32 %1)
ret i32 %9
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ system(char *);
int ideviceinfo() {
  system("clear; ideviceinfo");
  return EXIT_SUCCESS;
}


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"clear; ideviceinfo\00"
@EXIT_SUCCESS = global i32 0
define i32 @ideviceinfo() {
%1 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}

LLVM IR (-O2):
@.str = [19 x i8] c"clear; ideviceinfo\00"
@EXIT_SUCCESS = global i32 0
define i32 @ideviceinfo() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
int main() {
  int n = 2;
  int m;
  while (n > 1) {
    n--;
  }
  m = 0;
  return n;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    112a <main+0x2a>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %2
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* %2
%9 = add nsw i32 %8, -1
store i32 %9, i32* %2
br label %4
10: ; preds = %4
store i32 0, i32* %3
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
void VMR3ReqPriorityCallWaitU(void) {}


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

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

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

LLVM IR (-O2):
define void @VMR3ReqPriorityCallWaitU() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cBreak();
int /*<<< orphan*/ dash();
int /*<<< orphan*/ dot();
void sX() {
  dash();
  dot();
  dot();
  dash();
  cBreak();
}


x86 assembly (clang, -O0):
<sX>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <dash@plt>
mov    $0x0,%al
call   1030 <dot@plt>
mov    $0x0,%al
call   1030 <dot@plt>
mov    $0x0,%al
call   1040 <dash@plt>
mov    $0x0,%al
call   1050 <cBreak@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sX>:
push   %rax
xor    %eax,%eax
call   1040 <dash@plt>
xor    %eax,%eax
call   1030 <dot@plt>
xor    %eax,%eax
call   1030 <dot@plt>
xor    %eax,%eax
call   1040 <dash@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <cBreak@plt>

LLVM IR (-O0):
define void @sX() {
%1 = call i32 (...) @dash()
%2 = call i32 (...) @dot()
%3 = call i32 (...) @dot()
%4 = call i32 (...) @dash()
%5 = call i32 (...) @cBreak()
ret void
}

LLVM IR (-O2):
define void @sX() {
%1 = tail call i32 (...) @dash()
%2 = tail call i32 (...) @dot()
%3 = tail call i32 (...) @dot()
%4 = tail call i32 (...) @dash()
%5 = tail call i32 (...) @cBreak()
ret void
}
/* Variables and functions */
double exp(double);
double d_exp(double *x) { return (exp(*x)); }


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

x86 assembly (clang, -O2):
<d_exp>:
movsd  (%rdi),%xmm0
jmp    1030 <exp@plt>

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

LLVM IR (-O2):
define double @d_exp(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call double @exp(double %2)
ret double %3
}
double fsqr(const double x) { return (x * x); }


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

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

LLVM IR (-O0):
define double @fsqr(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 @fsqr(double %0) {
%2 = fmul double %0, %0
ret double %2
}
/* Type definitions */
struct beri_debug {
  int dummy;
};

/* Variables and functions */
int beri_debug_client_reset(struct beri_debug *);
int /*<<< orphan*/ printf(char *);
int berictl_reset(struct beri_debug *bdp) {
  int ret;
  ret = beri_debug_client_reset(bdp);
  if (ret != 0)
    return (ret);
  printf("CPU reset\n");
  return (0);
}


x86 assembly (clang, -O0):
<berictl_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <beri_debug_client_reset@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     114d <berictl_reset+0x2d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1160 <berictl_reset+0x40>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<berictl_reset>:
push   %rbx
call   1030 <beri_debug_client_reset@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1138 <berictl_reset+0x18>
lea    0xecd(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.beri_debug = type { i32 }
@.str = [11 x i8] c"CPU reset\0A\00"
define i32 @berictl_reset(%struct.beri_debug* %0) {
%2 = alloca i32
%3 = alloca %struct.beri_debug*
%4 = alloca i32
store %struct.beri_debug* %0, %struct.beri_debug** %3
%5 = load %struct.beri_debug*, %struct.beri_debug** %3
%6 = call i32 @beri_debug_client_reset(%struct.beri_debug* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %13
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.beri_debug = type { i32 }
@str = [10 x i8] c"CPU reset\00"
define i32 @berictl_reset(%struct.beri_debug* %0) {
%2 = tail call i32 @beri_debug_client_reset(%struct.beri_debug* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
ret i32 %2
}
/* Type definitions */
struct timeval {
  int /*<<< orphan*/ tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
void cpTimeval(const struct timeval source, struct timeval *target) {
  (*target).tv_sec = source.tv_sec;
  (*target).tv_usec = source.tv_usec;
  return;
}


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

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

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define void @cpTimeval(i64 %0, %struct.timeval* %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval*
%5 = bitcast %struct.timeval* %3 to i64*
store i64 %0, i64* %5
store %struct.timeval* %1, %struct.timeval** %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%7 = load i32, i32* %6
%8 = load %struct.timeval*, %struct.timeval** %4
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
store i32 %7, i32* %9
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%11 = load i32, i32* %10
%12 = load %struct.timeval*, %struct.timeval** %4
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
store i32 %11, i32* %13
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define void @cpTimeval(i64 %0, %struct.timeval* nocapture writeonly %1) {
%3 = trunc i64 %0 to i32
%4 = lshr i64 %0, 32
%5 = trunc i64 %4 to i32
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
store i32 %5, i32* %6
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
store i32 %3, i32* %7
ret void
}
/* Variables and functions */
char *piece_shift_right(char *, char);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void test_piece_shift_right() {
  char str[100];
  strcpy(str, "zero,one,two,three,four");
  printf("should be four,zero,one,two,three: is = %s\n",
         piece_shift_right(str, ','));
}


x86 assembly (clang, -O0):
<test_piece_shift_right>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
mov    $0x2c,%esi
call   1050 <piece_shift_right@plt>
mov    %rax,%rsi
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_piece_shift_right>:
push   %rbx
sub    $0x70,%rsp
lea    0xec4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1050 <piece_shift_right@plt>
lea    0xebd(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"zero,one,two,three,four\00"
@.str.1 = [44 x i8] c"should be four,zero,one,two,three: is = %s\0A\00"
define void @test_piece_shift_right() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i8* @piece_shift_right(i8* %4, i8 signext 44)
%6 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"zero,one,two,three,four\00"
@.str.1 = [44 x i8] c"should be four,zero,one,two,three: is = %s\0A\00"
define void @test_piece_shift_right() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i8* @piece_shift_right(i8* %2, i8 signext 44)
%5 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
char *igraph_i_strdup(const char *s) {
  size_t n = strlen(s) + 1;
  char *result = (char *)malloc(sizeof(char) * n);
  if (result)
    memcpy(result, s, n);
  return result;
}


x86 assembly (clang, -O0):
<igraph_i_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     117d <igraph_i_strdup+0x4d>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<igraph_i_strdup>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%ebp
add    $0x1,%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     115e <igraph_i_strdup+0x2e>
movslq %ebp,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @igraph_i_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = sext i32 %3 to i64
%9 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %8)
br label %10
10: ; preds = %7, %1
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void MMX_SUBB(int dst_reg, int src_reg) {
  addbyte(0x66);
  addbyte(0x0f);
  addbyte(0xf8);
  addbyte(0xc0 | (dst_reg << 3) | src_reg);
}


x86 assembly (clang, -O0):
<MMX_SUBB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xf8,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0xc0,%edi
or     -0x8(%rbp),%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMX_SUBB>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xf8,%edi
call   1030 <addbyte@plt>
shl    $0x3,%ebp
or     %ebx,%ebp
or     $0xc0,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @MMX_SUBB(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @addbyte(i32 102)
%6 = call i32 @addbyte(i32 15)
%7 = call i32 @addbyte(i32 248)
%8 = load i32, i32* %3
%9 = shl i32 %8, 3
%10 = or i32 192, %9
%11 = load i32, i32* %4
%12 = or i32 %10, %11
%13 = call i32 @addbyte(i32 %12)
ret void
}

LLVM IR (-O2):
define void @MMX_SUBB(i32 %0, i32 %1) {
%3 = tail call i32 @addbyte(i32 102)
%4 = tail call i32 @addbyte(i32 15)
%5 = tail call i32 @addbyte(i32 248)
%6 = shl i32 %0, 3
%7 = or i32 %6, %1
%8 = or i32 %7, 192
%9 = tail call i32 @addbyte(i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ str_reverse(char *);
int main() {
  char c[] = "This is a test.";
  str_reverse(c);
  printf("%s\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <str_reverse@plt>
lea    -0x20(%rbp),%rsi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <str_reverse@plt>
lea    0xece(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.c = [16 x i8] c"This is a test.\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
store i32 0, i32* %1
%3 = bitcast [16 x i8]* %2 to i8*
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = call i32 @str_reverse(i8* %4)
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.c = [16 x i8] c"This is a test.\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @str_reverse(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: ttyflags [-v] [-a | tty ... ]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"usage: ttyflags [-v] [-a | tty ... ]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"usage: ttyflags [-v] [-a | tty ... ]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ serialize_end();
void banshee_serialize_end() { serialize_end(); }


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

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

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

LLVM IR (-O2):
define void @banshee_serialize_end() {
%1 = tail call i32 (...) @serialize_end()
ret void
}
/* Variables and functions */
scalar_t__ d_eucl(double *, double *, int);
double log(scalar_t__);
double d_eucl_log(double *f1, double *f2, int n) {
  return (((double)100000.0 * log(d_eucl(f1, f2, n) + 1)));
}


x86 assembly (clang, -O0):
<d_eucl_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <d_eucl@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  0xea6(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_eucl_log>:
push   %rax
call   1040 <d_eucl@plt>
lea    0x1(%rax),%rdi
call   1030 <log@plt>
mulsd  0xec9(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @d_eucl_log(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = load double*, double** %5
%9 = load i32, i32* %6
%10 = call i64 @d_eucl(double* %7, double* %8, i32 %9)
%11 = add nsw i64 %10, 1
%12 = call double @log(i64 %11)
%13 = fmul double 1.000000e+05, %12
ret double %13
}

LLVM IR (-O2):
define double @d_eucl_log(double* %0, double* %1, i32 %2) {
%4 = tail call i64 @d_eucl(double* %0, double* %1, i32 %2)
%5 = add nsw i64 %4, 1
%6 = tail call double @log(i64 %5)
%7 = fmul double %6, 1.000000e+05
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ Lcd_Cmd(int);
void Lcd_Shift_Right() {
  Lcd_Cmd(0x01);
  Lcd_Cmd(0x0C);
}


x86 assembly (clang, -O0):
<Lcd_Shift_Right>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <Lcd_Cmd@plt>
mov    $0xc,%edi
call   1030 <Lcd_Cmd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lcd_Shift_Right>:
push   %rax
mov    $0x1,%edi
call   1030 <Lcd_Cmd@plt>
mov    $0xc,%edi
pop    %rax
jmp    1030 <Lcd_Cmd@plt>

LLVM IR (-O0):
define void @Lcd_Shift_Right() {
%1 = call i32 @Lcd_Cmd(i32 1)
%2 = call i32 @Lcd_Cmd(i32 12)
ret void
}

LLVM IR (-O2):
define void @Lcd_Shift_Right() {
%1 = tail call i32 @Lcd_Cmd(i32 1)
%2 = tail call i32 @Lcd_Cmd(i32 12)
ret void
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int sd_bus_open_system(void **ret) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_bus_open_system>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    0x2ecf(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_open_system(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_open_system(i8** nocapture readnone %0) {
%2 = load i32, i32* @EINVAL
%3 = sub nsw i32 0, %2
ret i32 %3
}
int show_moose_else() {}


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

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

LLVM IR (-O0):
define i32 @show_moose_else() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @show_moose_else() {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
float ext_dev_read_float(uint32_t addr, void *ctxt) { return 0.0f; }


x86 assembly (clang, -O0):
<ext_dev_read_float>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ext_dev_read_float>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @ext_dev_read_float(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret float 0.000000e+00
}

LLVM IR (-O2):
define float @ext_dev_read_float(i32 %0, i8* nocapture readnone %1) {
ret float 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void townsenr17() { printf("Townsenr17 likes watermelon.\n"); }


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

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

LLVM IR (-O0):
@.str = [30 x i8] c"Townsenr17 likes watermelon.\0A\00"
define void @townsenr17() {
%1 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [29 x i8] c"Townsenr17 likes watermelon.\00"
define void @townsenr17() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
ret void
}
void XkbGetKeyboardByName() {}


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

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

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

LLVM IR (-O2):
define void @XkbGetKeyboardByName() {
ret void
}
/* Variables and functions */
scalar_t__ isalpha(char const);
scalar_t__ isspace(char const);
int resolveIndex(const char c) {
  int resIndex = -1;
  if (isalpha(c)) {
    resIndex = c - 'a';
  } else if (isspace(c)) {
    resIndex = ('z' - 'a' + 1);
  }
  return resIndex;
}


x86 assembly (clang, -O0):
<resolveIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
je     1157 <resolveIndex+0x37>
movsbl -0x1(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0x8(%rbp)
jmp    1176 <resolveIndex+0x56>
movsbl -0x1(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1171 <resolveIndex+0x51>
movl   $0x1a,-0x8(%rbp)
jmp    1176 <resolveIndex+0x56>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resolveIndex>:
push   %rbx
mov    %edi,%ebx
call   1040 <isalpha@plt>
test   %rax,%rax
je     1135 <resolveIndex+0x15>
movsbl %bl,%eax
add    $0xffffff9f,%eax
pop    %rbx
ret
movsbl %bl,%edi
call   1030 <isspace@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
or     $0x1a,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @resolveIndex(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 -1, i32* %3
%4 = load i8, i8* %2
%5 = call i64 @isalpha(i8 signext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 97
store i32 %10, i32* %3
br label %17
11: ; preds = %1
%12 = load i8, i8* %2
%13 = call i64 @isspace(i8 signext %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 26, i32* %3
br label %16
16: ; preds = %15, %11
br label %17
17: ; preds = %16, %7
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @resolveIndex(i8 signext %0) {
%2 = tail call i64 @isalpha(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = sext i8 %0 to i32
%6 = add nsw i32 %5, -97
br label %11
7: ; preds = %1
%8 = tail call i64 @isspace(i8 signext %0)
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i32 -1, i32 26
br label %11
11: ; preds = %7, %4
%12 = phi i32 [ %6, %4 ], [ %10, %7 ]
ret i32 %12
}