xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int pthread_cancel(pthread_t thread) {
  kill(thread, SIGINT);
  return 0;
}


x86 assembly (clang, -O0):
<pthread_cancel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_cancel>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGINT = global i32 0
define i32 @pthread_cancel(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = call i32 @kill(i32 %3, i32 %4)
ret i32 0
}

LLVM IR (-O2):
@SIGINT = global i32 0
define i32 @pthread_cancel(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = tail call i32 @kill(i32 %0, i32 %2)
ret i32 0
}
void _set_dnr(unsigned char *u) { u[2] |= (1 << 6); }


x86 assembly (clang, -O0):
<_set_dnr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%ecx
or     $0x40,%ecx
mov    %cl,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_set_dnr>:
orb    $0x40,0x2(%rdi)
ret

LLVM IR (-O0):
define void @_set_dnr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 2
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = or i32 %6, 64
%8 = trunc i32 %7 to i8
store i8 %8, i8* %4
ret void
}

LLVM IR (-O2):
define void @_set_dnr(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
%3 = load i8, i8* %2
%4 = or i8 %3, 64
store i8 %4, i8* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void printVersion(void) {
  printf("Version: %s\n", "1.00");
  return;
}


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

x86 assembly (clang, -O2):
<printVersion>:
lea    0xee9(%rip),%rdi
lea    0xeef(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Version: %s\0A\00"
@.str.1 = [5 x i8] c"1.00\00"
define void @printVersion() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Version: %s\0A\00"
@.str.1 = [5 x i8] c"1.00\00"
define void @printVersion() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int xprintf_print(char **, int *);
int xsprintf(char *out, const char *format, ...) {
  int *varg = (int *)(&format);
  return xprintf_print(&out, varg);
}


x86 assembly (clang, -O0):
<xsprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    -0x8(%rbp),%rdi
call   1030 <xprintf_print@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xsprintf>:
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
mov    %rsi,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <xprintf_print@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @xsprintf(i8* %0, i8* %1, ...) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = bitcast i8** %4 to i32*
store i32* %6, i32** %5
%7 = load i32*, i32** %5
%8 = call i32 @xprintf_print(i8** %3, i32* %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @xsprintf(i8* %0, i8* %1, ...) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = bitcast i8** %4 to i32*
%6 = call i32 @xprintf_print(i8** %3, i32* %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ setbitu(unsigned char *, int, int, int);
void setbitg(unsigned char *buff, int pos, int len, int value) {
  setbitu(buff, pos, 1, value < 0 ? 1 : 0);
  setbitu(buff, pos + 1, len - 1, value < 0 ? -value : value);
}


x86 assembly (clang, -O0):
<setbitg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
mov    $0x1,%eax
cmp    $0x0,%edx
cmovl  %eax,%ecx
mov    $0x1,%edx
call   1030 <setbitu@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1177 <setbitg+0x67>
xor    %eax,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    117d <setbitg+0x6d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%ecx
call   1030 <setbitu@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setbitg>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
shr    $0x1f,%ecx
mov    $0x1,%edx
call   1030 <setbitu@plt>
add    $0x1,%ebp
add    $0xffffffff,%r14d
mov    %ebx,%ecx
neg    %ecx
cmovs  %ebx,%ecx
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <setbitu@plt>

LLVM IR (-O0):
define void @setbitg(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %8
%12 = icmp slt i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
%15 = call i32 @setbitu(i8* %9, i32 %10, i32 1, i32 %14)
%16 = load i8*, i8** %5
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
%19 = load i32, i32* %7
%20 = sub nsw i32 %19, 1
%21 = load i32, i32* %8
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %4
%24 = load i32, i32* %8
%25 = sub nsw i32 0, %24
br label %28
26: ; preds = %4
%27 = load i32, i32* %8
br label %28
28: ; preds = %26, %23
%29 = phi i32 [ %25, %23 ], [ %27, %26 ]
%30 = call i32 @setbitu(i8* %16, i32 %18, i32 %20, i32 %29)
ret void
}

LLVM IR (-O2):
define void @setbitg(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = lshr i32 %3, 31
%6 = tail call i32 @setbitu(i8* %0, i32 %1, i32 1, i32 %5)
%7 = add nsw i32 %1, 1
%8 = add nsw i32 %2, -1
%9 = tail call i32 @llvm.abs.i32(i32 %3, i1 true)
%10 = tail call i32 @setbitu(i8* %0, i32 %7, i32 %8, i32 %9)
ret void
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, long);
main(void) {
  int c;
  long char_coutn;
  char_coutn = 0;
  while ((c = getchar()) != EOF && c != '\n') {
    ++char_coutn;
  }
  printf("%d\n", char_coutn);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
mov    0x2e9c(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x11(%rbp)
je     1161 <main+0x41>
cmpl   $0xa,-0x8(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1171 <main+0x51>
jmp    1182 <main+0x62>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1137 <main+0x17>
mov    -0x10(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffffffffffff,%rbx
mov    0x2eb6(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%rbx
cmp    $0xa,%eax
je     1155 <main+0x35>
cmp    (%r14),%eax
jne    1140 <main+0x20>
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %8, %1 ]
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
%6 = icmp ne i32 %3, 10
%7 = and i1 %6, %5
%8 = add nuw nsw i64 %2, 1
br i1 %7, label %1, label %9
9: ; preds = %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cputime_setup();
int /*<<< orphan*/ loadbang_setup();
int /*<<< orphan*/ namecanvas_setup();
int /*<<< orphan*/ oscformat_setup();
int /*<<< orphan*/ oscparse_setup();
int /*<<< orphan*/ random_setup();
int /*<<< orphan*/ realtime_setup();
void x_misc_setup(void) {
  random_setup();
  loadbang_setup();
  namecanvas_setup();
  cputime_setup();
  realtime_setup();
  oscparse_setup();
  oscformat_setup();
}


x86 assembly (clang, -O0):
<x_misc_setup>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1070 <random_setup@plt>
mov    $0x0,%al
call   1030 <loadbang_setup@plt>
mov    $0x0,%al
call   1090 <namecanvas_setup@plt>
mov    $0x0,%al
call   1060 <cputime_setup@plt>
mov    $0x0,%al
call   1040 <realtime_setup@plt>
mov    $0x0,%al
call   1080 <oscparse_setup@plt>
mov    $0x0,%al
call   1050 <oscformat_setup@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_misc_setup>:
push   %rax
xor    %eax,%eax
call   1070 <random_setup@plt>
xor    %eax,%eax
call   1030 <loadbang_setup@plt>
xor    %eax,%eax
call   1090 <namecanvas_setup@plt>
xor    %eax,%eax
call   1060 <cputime_setup@plt>
xor    %eax,%eax
call   1040 <realtime_setup@plt>
xor    %eax,%eax
call   1080 <oscparse_setup@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <oscformat_setup@plt>

LLVM IR (-O0):
define void @x_misc_setup() {
%1 = call i32 (...) @random_setup()
%2 = call i32 (...) @loadbang_setup()
%3 = call i32 (...) @namecanvas_setup()
%4 = call i32 (...) @cputime_setup()
%5 = call i32 (...) @realtime_setup()
%6 = call i32 (...) @oscparse_setup()
%7 = call i32 (...) @oscformat_setup()
ret void
}

LLVM IR (-O2):
define void @x_misc_setup() {
%1 = tail call i32 (...) @random_setup()
%2 = tail call i32 (...) @loadbang_setup()
%3 = tail call i32 (...) @namecanvas_setup()
%4 = tail call i32 (...) @cputime_setup()
%5 = tail call i32 (...) @realtime_setup()
%6 = tail call i32 (...) @oscparse_setup()
%7 = tail call i32 (...) @oscformat_setup()
ret void
}
/* Variables and functions */
char getchar();
void clearInputBuffer() {
  while (getchar() != '\n')
    ;
}


x86 assembly (clang, -O0):
<clearInputBuffer>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <clearInputBuffer+0x9>
mov    $0x0,%al
call   1030 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1131 <clearInputBuffer+0x21>
jmp    1119 <clearInputBuffer+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearInputBuffer>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
jne    1120 <clearInputBuffer+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @clearInputBuffer() {
br label %1
1: ; preds = %5, %0
%2 = call signext i8 (...) @getchar()
%3 = sext i8 %2 to i32
%4 = icmp ne i32 %3, 10
br i1 %4, label %5, label %6
5: ; preds = %1
br label %1
6: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @clearInputBuffer() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %4, label %1
4: ; preds = %1
ret void
}
/* Type definitions */
struct tree {
  int dummy;
};

/* Variables and functions */
scalar_t__ malloc(int);
int *treeToArray(struct tree *t) {
  int *ip = (int *)malloc(sizeof(int) * 100);
  return ip;
}


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

x86 assembly (clang, -O2):
<treeToArray>:
mov    $0x190,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
%struct.tree = type { i32 }
define i32* @treeToArray(%struct.tree* %0) {
%2 = alloca %struct.tree*
%3 = alloca i32*
store %struct.tree* %0, %struct.tree** %2
%4 = call i64 @malloc(i32 400)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
ret i32* %6
}

LLVM IR (-O2):
%struct.tree = type { i32 }
define i32* @treeToArray(%struct.tree* nocapture readnone %0) {
%2 = tail call i64 @malloc(i32 400)
%3 = inttoptr i64 %2 to i32*
ret i32* %3
}
int main() {
  int x;
  for (x = -128; x <= 128; x++) {
    int a = __builtin_ffs(x);
    if (x == 0 && a != 0)
      __builtin_abort();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffff80,-0x8(%rbp)
cmpl   $0x80,-0x8(%rbp)
jg     1173 <main+0x63>
mov    -0x8(%rbp),%edx
bsf    %edx,%eax
add    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1160 <main+0x50>
cmpl   $0x0,-0xc(%rbp)
je     1160 <main+0x50>
call   1030 <abort@plt>
jmp    1165 <main+0x55>
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>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 -128, i32* %2
br label %4
4: ; preds = %20, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 128
br i1 %6, label %7, label %23
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 @llvm.cttz.i32(i32 %8, i1 true)
%10 = add i32 %9, 1
%11 = icmp eq i32 %8, 0
%12 = select i1 %11, i32 0, i32 %10
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %7
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
unreachable
19: ; preds = %15, %7
br label %20
20: ; preds = %19
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %4
23: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
float minimoDiDueNumeri(float numero1, float numero2) {
  if (numero1 > numero2) {
    return numero1;
  } else {
    return numero2;
  }
}


x86 assembly (clang, -O0):
<minimoDiDueNumeri>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    112c <minimoDiDueNumeri+0x2c>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1136 <minimoDiDueNumeri+0x36>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<minimoDiDueNumeri>:
maxss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @minimoDiDueNumeri(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int dogs;
  printf("How many dogs do you have?\n");
  scanf("%d", &dogs);
  printf("So you have %d dog(s)!\n", dogs);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"How many dogs do you have?\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"So you have %d dog(s)!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"So you have %d dog(s)!\0A\00"
@str = [27 x i8] c"How many dogs do you have?\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void shmem_short_min_to_all(short *target, short *source, int nreduce,
                                   int PE_start, int logPE_stride, int PE_size,
                                   short *pWrk, long *pSync) {
  printf("\nOpenSHMEM Analyzer\n");
}


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

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

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

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define void @shmem_short_min_to_all(i16* nocapture readnone %0, i16* nocapture readnone %1, i32 %2, i32 %3, i32 %4, i32 %5, i16* nocapture readnone %6, i64* nocapture readnone %7) {
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int get_next_rec_buffer(int);
int /*<<< orphan*/ is_pulse(int);
int get_next_pulse(int maxusec) {
  int data;
  data = get_next_rec_buffer(maxusec);
  if (data == 0)
    return (0);
  if (!is_pulse(data)) {
    do {
    } while (0);
    return (0);
  }
  return (data & (0x00FFFFFF));
}


x86 assembly (clang, -O0):
<get_next_pulse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <get_next_rec_buffer@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114c <get_next_pulse+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    117e <get_next_pulse+0x5e>
mov    -0xc(%rbp),%edi
call   1030 <is_pulse@plt>
cmp    $0x0,%eax
jne    1173 <get_next_pulse+0x53>
jmp    1162 <get_next_pulse+0x42>
jmp    1167 <get_next_pulse+0x47>
movl   $0x0,-0x4(%rbp)
jmp    117e <get_next_pulse+0x5e>
mov    -0xc(%rbp),%eax
and    $0xffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_next_pulse>:
push   %rbx
call   1040 <get_next_rec_buffer@plt>
test   %eax,%eax
je     1140 <get_next_pulse+0x20>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <is_pulse@plt>
and    $0xffffff,%ebx
test   %eax,%eax
cmove  %eax,%ebx
jmp    1142 <get_next_pulse+0x22>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_next_pulse(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @get_next_rec_buffer(i32 %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %20
10: ; preds = %1
%11 = load i32, i32* %4
%12 = call i32 @is_pulse(i32 %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10
br label %15
15: ; preds = %14
br label %16
16: ; preds = %15
store i32 0, i32* %2
br label %20
17: ; preds = %10
%18 = load i32, i32* %4
%19 = and i32 %18, 16777215
store i32 %19, i32* %2
br label %20
20: ; preds = %17, %16, %9
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @get_next_pulse(i32 %0) {
%2 = tail call i32 @get_next_rec_buffer(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i32 @is_pulse(i32 %2)
%6 = icmp eq i32 %5, 0
%7 = and i32 %2, 16777215
%8 = select i1 %6, i32 0, i32 %7
br label %9
9: ; preds = %4, %1
%10 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %10
}
/* Variables and functions */
scalar_t__ test_bishop(int, int);
scalar_t__ test_rook(int, int);
int test_Queen(int file, int rank) {
  if (test_rook(file, rank))
    return 1;
  if (test_bishop(file, rank))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<test_Queen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <test_rook@plt>
cmp    $0x0,%rax
je     114f <test_Queen+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1177 <test_Queen+0x57>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <test_bishop@plt>
cmp    $0x0,%rax
je     1170 <test_Queen+0x50>
movl   $0x1,-0x4(%rbp)
jmp    1177 <test_Queen+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_Queen>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <test_rook@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    114d <test_Queen+0x2d>
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <test_bishop@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @test_Queen(i32 %0, i32 %1) {
%3 = tail call i64 @test_rook(i32 %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i64 @test_bishop(i32 %0, i32 %1)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %2
%10 = phi i32 [ 1, %2 ], [ %8, %5 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ _wrmsr(unsigned int, unsigned long long);
void wrmsr(unsigned int msr, unsigned int lo, unsigned int hi) {
  unsigned long long val = (((unsigned long long)hi) << 32) | lo;
  _wrmsr(msr, val);
}


x86 assembly (clang, -O0):
<wrmsr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x20,%rax
mov    -0x8(%rbp),%ecx
or     %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <_wrmsr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrmsr>:
shl    $0x20,%rdx
mov    %esi,%esi
or     %rdx,%rsi
jmp    1030 <_wrmsr@plt>

LLVM IR (-O0):
define void @wrmsr(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = zext i32 %8 to i64
%10 = shl i64 %9, 32
%11 = load i32, i32* %5
%12 = zext i32 %11 to i64
%13 = or i64 %10, %12
store i64 %13, i64* %7
%14 = load i32, i32* %4
%15 = load i64, i64* %7
%16 = call i32 @_wrmsr(i32 %14, i64 %15)
ret void
}

LLVM IR (-O2):
define void @wrmsr(i32 %0, i32 %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = shl nuw i64 %4, 32
%6 = zext i32 %1 to i64
%7 = or i64 %5, %6
%8 = tail call i32 @_wrmsr(i32 %0, i64 %7)
ret void
}
char hex(int x) { return ("0123456789ABCDEF")[x & 0x0F]; }


x86 assembly (clang, -O0):
<hex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0xee9(%rip),%rax
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex>:
and    $0xf,%edi
lea    0xef6(%rip),%rax
mov    (%rdi,%rax,1),%al
ret

LLVM IR (-O0):
@.str = [17 x i8] c"0123456789ABCDEF\00"
define signext i8 @hex(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 15
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %5
%7 = load i8, i8* %6
ret i8 %7
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789ABCDEF\00"
define signext i8 @hex(i32 %0) {
%2 = and i32 %0, 15
%3 = zext i32 %2 to i64
%4 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %3
%5 = load i8, i8* %4
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sticky() { printf("sticky, br / peanutbutter.so \n"); }


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"sticky, br / peanutbutter.so \0A\00"
define void @sticky() {
%1 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [30 x i8] c"sticky, br / peanutbutter.so \00"
define void @sticky() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct rectangular_coordinates {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rotate_rectangular(double **,
                                      struct rectangular_coordinates *);
void vsop87_ecliptic_to_equator(struct rectangular_coordinates *pos) {
  static double rot_matrix[3][3] = {
      {1.000000000000, 0.000000440360, -0.000000190919},
      {-0.000000479966, 0.917482137087, -0.397776982902},
      {0.000000000000, 0.397776982902, 0.917482137087}};
  rotate_rectangular(rot_matrix, pos);
}


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

x86 assembly (clang, -O2):
<vsop87_ecliptic_to_equator>:
mov    %rdi,%rsi
lea    0x2f16(%rip),%rdi
jmp    1030 <rotate_rectangular@plt>

LLVM IR (-O0):
%struct.rectangular_coordinates = type { i32 }
@vsop87_ecliptic_to_equator.rot_matrix = internal global [3 x [3 x double]] [[3 x double] [double 1.000000e+00, double 4.403600e-07, double -1.909190e-07], [3 x double] [double -4.799660e-07, double 0x3FED5C037FAE7DC7, double 0xBFD9752D972A99DD], [3 x double] [double 0.000000e+00, double 0x3FD9752D972A99DD, double 0x3FED5C037FAE7DC7]]
define void @vsop87_ecliptic_to_equator(%struct.rectangular_coordinates* %0) {
%2 = alloca %struct.rectangular_coordinates*
store %struct.rectangular_coordinates* %0, %struct.rectangular_coordinates** %2
%3 = load %struct.rectangular_coordinates*, %struct.rectangular_coordinates** %2
%4 = call i32 @rotate_rectangular(double** bitcast ([3 x [3 x double]]* @vsop87_ecliptic_to_equator.rot_matrix to double**), %struct.rectangular_coordinates* %3)
ret void
}

LLVM IR (-O2):
%struct.rectangular_coordinates = type { i32 }
@vsop87_ecliptic_to_equator.rot_matrix = internal global [3 x [3 x double]] [[3 x double] [double 1.000000e+00, double 4.403600e-07, double -1.909190e-07], [3 x double] [double -4.799660e-07, double 0x3FED5C037FAE7DC7, double 0xBFD9752D972A99DD], [3 x double] [double 0.000000e+00, double 0x3FD9752D972A99DD, double 0x3FED5C037FAE7DC7]]
define void @vsop87_ecliptic_to_equator(%struct.rectangular_coordinates* %0) {
%2 = tail call i32 @rotate_rectangular(double** bitcast ([3 x [3 x double]]* @vsop87_ecliptic_to_equator.rot_matrix to double**), %struct.rectangular_coordinates* %0)
ret void
}
void XkbChangeNames() {}


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

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

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

LLVM IR (-O2):
define void @XkbChangeNames() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void rtp2435_set_width(uint8_t *header, uint8_t width) { header[6] = width; }


x86 assembly (clang, -O0):
<rtp2435_set_width>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtp2435_set_width>:
mov    %esi,0x18(%rdi)
ret

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

LLVM IR (-O2):
define void @rtp2435_set_width(i32* nocapture writeonly %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 6
store i32 %1, i32* %3
ret void
}
void s3c_i2c6_setname(char *name) {}


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

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

LLVM IR (-O0):
define void @s3c_i2c6_setname(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @s3c_i2c6_setname(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ENOTSUP;
int /*<<< orphan*/ errno;
int fwscanf(FILE *stream, const wchar_t *format, ...) {
  errno = ENOTSUP;
  return -1;
}


x86 assembly (clang, -O0):
<fwscanf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed5(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebc(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fwscanf>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOTSUP = global i32 0
@errno = global i32 0
define i32 @fwscanf(i32* %0, i32* %1, ...) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32, i32* @ENOTSUP
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOTSUP = global i32 0
@errno = global i32 0
define i32 @fwscanf(i32* nocapture readnone %0, i32* nocapture readnone %1, ...) {
%3 = load i32, i32* @ENOTSUP
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ default_completions();
void edit_bootstrap(void) { default_completions(); }


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

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

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

LLVM IR (-O2):
define void @edit_bootstrap() {
%1 = tail call i32 (...) @default_completions()
ret void
}
void av_frame_set_sample_rate() {}


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

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

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

LLVM IR (-O2):
define void @av_frame_set_sample_rate() {
ret void
}
/* Variables and functions */
scalar_t__ printf(char *, int);
int main(void) {
  int ret = 42;
  while (1)
    ret += printf("hello world: %d\n", ret);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2a,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x2a,%ebp
lea    0xee1(%rip),%rbx
nop
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    %ebp,%eax
mov    %eax,%ebp
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [17 x i8] c"hello world: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 42, i32* %2
br label %3
3: ; preds = %0, %3
%4 = load i32, i32* %2
%5 = call i64 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = add nsw i64 %7, %5
%9 = trunc i64 %8 to i32
store i32 %9, i32* %2
br label %3
}

LLVM IR (-O2):
@.str = [17 x i8] c"hello world: %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 42, %0 ], [ %5, %1 ]
%3 = tail call i64 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = trunc i64 %3 to i32
%5 = add i32 %2, %4
br label %1
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void CRCSeedSet(uint32_t ui32Base, uint32_t ui32Seed) {
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000410))) = ui32Seed;
}


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

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

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

LLVM IR (-O2):
define void @CRCSeedSet(i64 %0, i64 %1) {
%3 = add nsw i64 %0, 1040
%4 = inttoptr i64 %3 to i64*
store volatile i64 %1, i64* %4
ret void
}
void SSIDataPut(unsigned long ulBase, unsigned long ulData) {
  ;

  ;
  while (!((*((volatile unsigned long *)(ulBase + 0x0000000C))) & 0x00000002)) {
  }
  (*((volatile unsigned long *)(ulBase + 0x00000008))) = ulData;
}


x86 assembly (clang, -O0):
<SSIDataPut>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rax
and    $0x2,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112e <SSIDataPut+0x2e>
jmp    1133 <SSIDataPut+0x33>
jmp    110c <SSIDataPut+0xc>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIDataPut>:
testq  $0x2,0xc(%rdi)
je     1100 <SSIDataPut>
mov    %rsi,0x8(%rdi)
ret

LLVM IR (-O0):
define void @SSIDataPut(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
br label %5
5: ; preds = %13, %2
%6 = load i64, i64* %3
%7 = add i64 %6, 12
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, 2
%11 = icmp ne i64 %10, 0
%12 = xor i1 %11, true
br i1 %12, label %13, label %14
13: ; preds = %5
br label %5
14: ; preds = %5
%15 = load i64, i64* %4
%16 = load i64, i64* %3
%17 = add i64 %16, 8
%18 = inttoptr i64 %17 to i64*
store volatile i64 %15, i64* %18
ret void
}

LLVM IR (-O2):
define void @SSIDataPut(i64 %0, i64 %1) {
%3 = add i64 %0, 12
%4 = inttoptr i64 %3 to i64*
br label %5
5: ; preds = %5, %2
%6 = load volatile i64, i64* %4
%7 = and i64 %6, 2
%8 = icmp eq i64 %7, 0
br i1 %8, label %5, label %9
9: ; preds = %5
%10 = add i64 %0, 8
%11 = inttoptr i64 %10 to i64*
store volatile i64 %1, i64* %11
ret void
}
__attribute__((always_)) void far_jmp(unsigned short cs, unsigned long eip) {
  struct {
    unsigned long eip;
    unsigned short cs;
  } __attribute__((__packed__)) FARJMP;
  FARJMP.cs = cs;
  FARJMP.eip = eip;
  __asm__ __volatile__("ljmp *(%0)" : : "q"(&FARJMP) : "memory");
}


x86 assembly (clang, -O0):
<far_jmp>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x2(%rbp),%ax
mov    %ax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x20(%rbp),%rax
ljmp   *(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<far_jmp>:
mov    %di,-0x8(%rsp)
mov    %rsi,-0x10(%rsp)
lea    -0x10(%rsp),%rax
ljmp   *(%rax)
ret

LLVM IR (-O0):
%struct.anon = type <{ i64, i16 }>
define void @far_jmp(i16 zeroext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
%5 = alloca %struct.anon
store i16 %0, i16* %3
store i64 %1, i64* %4
%6 = load i16, i16* %3
%7 = getelementptr inbounds %struct.anon, %struct.anon* %5, i32 0, i32 1
store i16 %6, i16* %7
%8 = load i64, i64* %4
%9 = getelementptr inbounds %struct.anon, %struct.anon* %5, i32 0, i32 0
store i64 %8, i64* %9
ret void
}

LLVM IR (-O2):
%struct.anon = type <{ i64, i16 }>
define void @far_jmp(i16 zeroext %0, i64 %1) {
%3 = alloca %struct.anon
%4 = bitcast %struct.anon* %3 to i8*
%5 = getelementptr inbounds %struct.anon, %struct.anon* %3, i64 0, i32 1
store i16 %0, i16* %5
%6 = getelementptr inbounds %struct.anon, %struct.anon* %3, i64 0, i32 0
store i64 %1, i64* %6
ret void
}
int test_imm_9Eint16_mem(short *val) {
  return ((*val) & (-0x9E << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_9Eint16_mem>:
movzwl (%rdi),%eax
test   $0xff62,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_9Eint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -158
%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_9Eint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -158
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_A5uint16_mem(unsigned short *val) {
  return ((*val) & (0xA5 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_A5uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 165
%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_A5uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 165
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void smpte_hbrmt_set_frame(uint8_t *p_hbrmt, uint8_t frame) {
  p_hbrmt[4] |= (frame >> 4);
  p_hbrmt[5] |= (frame & 0xf) << 4;
}


x86 assembly (clang, -O0):
<smpte_hbrmt_set_frame>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x4,%ecx
mov    -0x8(%rbp),%rax
or     0x10(%rax),%ecx
mov    %ecx,0x10(%rax)
mov    -0xc(%rbp),%ecx
and    $0xf,%ecx
shl    $0x4,%ecx
mov    -0x8(%rbp),%rax
or     0x14(%rax),%ecx
mov    %ecx,0x14(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<smpte_hbrmt_set_frame>:
mov    %esi,%eax
sar    $0x4,%eax
or     %eax,0x10(%rdi)
shl    $0x4,%esi
movzbl %sil,%eax
or     %eax,0x14(%rdi)
ret

LLVM IR (-O0):
define void @smpte_hbrmt_set_frame(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 4
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 4
%9 = load i32, i32* %8
%10 = or i32 %9, %6
store i32 %10, i32* %8
%11 = load i32, i32* %4
%12 = and i32 %11, 15
%13 = shl i32 %12, 4
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 5
%16 = load i32, i32* %15
%17 = or i32 %16, %13
store i32 %17, i32* %15
ret void
}

LLVM IR (-O2):
define void @smpte_hbrmt_set_frame(i32* nocapture %0, i32 %1) {
%3 = ashr i32 %1, 4
%4 = getelementptr inbounds i32, i32* %0, i64 4
%5 = load i32, i32* %4
%6 = or i32 %5, %3
store i32 %6, i32* %4
%7 = shl i32 %1, 4
%8 = and i32 %7, 240
%9 = getelementptr inbounds i32, i32* %0, i64 5
%10 = load i32, i32* %9
%11 = or i32 %10, %8
store i32 %11, i32* %9
ret void
}
int _() { return 0; }


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

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

LLVM IR (-O0):
define i32 @_() {
ret i32 0
}

LLVM IR (-O2):
define i32 @_() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ets_printf(char *);
void __attribute__((noreturn)) ram_main() {
  while (1) {
    ets_printf("Hello world!\n");
  }
}


x86 assembly (clang, -O0):
<ram_main>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <ram_main+0x9>
lea    0xee0(%rip),%rdi
call   1030 <ets_printf@plt>
jmp    1119 <ram_main+0x9>

x86 assembly (clang, -O2):
<ram_main>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <ets_printf@plt>
jmp    1120 <ram_main+0x10>

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
define void @ram_main() {
br label %1
1: ; preds = %0, %1
%2 = call i32 @ets_printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %1
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello world!\0A\00"
define void @ram_main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @ets_printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %1
}
void error(name) char *name;
{ err(1, "%s", name); }


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xed4(%rip),%rsi
mov    $0x0,%al
call   1030 <err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
jmp    1030 <err@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @error(i8* %0) {
%2 = tail call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @err to i32 (i32, i8*, i8*, ...)*)(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
char *five_loud();
scalar_t__ strcmp(char const *, char *);
char *test_five_loud() {
  const char *out = five_loud();
  do {
    if (strcmp(out, "FIVE"))
      return "error, five_loud != FIVE";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_five_loud>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <five_loud@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     115d <test_five_loud+0x3d>
lea    0xeac(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    116a <test_five_loud+0x4a>
jmp    1162 <test_five_loud+0x42>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_five_loud>:
push   %rax
xor    %eax,%eax
call   1040 <five_loud@plt>
lea    0xee5(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
lea    0xebf(%rip),%rcx
cmovne %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"FIVE\00"
@.str.1 = [25 x i8] c"error, five_loud != FIVE\00"
define i8* @test_five_loud() {
%1 = tail call i8* (...) @five_loud()
%2 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i8* null, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0)
ret i8* %4
}