xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int bits_setb(uint8_t *vec, size_t size, uint8_t bit) {
  if (size <= (bit >> 3))
    return -1;
  *(vec + (bit >> 3)) |= (uint8_t)(1 << (bit & 0x07));
  return 1;
}


x86 assembly (clang, -O0):
<bits_setb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
ja     1131 <bits_setb+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    1158 <bits_setb+0x58>
mov    -0x1c(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bits_setb>:
mov    %edx,%eax
sar    $0x3,%eax
movslq %eax,%r8
mov    $0xffffffff,%eax
cmp    %rsi,%r8
jae    1127 <bits_setb+0x27>
and    $0x7,%dl
mov    $0x1,%esi
mov    %edx,%ecx
shl    %cl,%esi
mov    $0x1,%eax
or     %esi,(%rdi,%r8,4)
ret

LLVM IR (-O0):
define i32 @bits_setb(i32* %0, i64 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32
store i32* %0, i32** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
%8 = load i64, i64* %6
%9 = load i32, i32* %7
%10 = ashr i32 %9, 3
%11 = sext i32 %10 to i64
%12 = icmp ule i64 %8, %11
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 -1, i32* %4
br label %25
14: ; preds = %3
%15 = load i32, i32* %7
%16 = and i32 %15, 7
%17 = shl i32 1, %16
%18 = load i32*, i32** %5
%19 = load i32, i32* %7
%20 = ashr i32 %19, 3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %18, i64 %21
%23 = load i32, i32* %22
%24 = or i32 %23, %17
store i32 %24, i32* %22
store i32 1, i32* %4
br label %25
25: ; preds = %14, %13
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @bits_setb(i32* nocapture %0, i64 %1, i32 %2) {
%4 = ashr i32 %2, 3
%5 = sext i32 %4 to i64
%6 = icmp ult i64 %5, %1
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = and i32 %2, 7
%9 = shl nuw nsw i32 1, %8
%10 = getelementptr inbounds i32, i32* %0, i64 %5
%11 = load i32, i32* %10
%12 = or i32 %11, %9
store i32 %12, i32* %10
br label %13
13: ; preds = %3, %7
%14 = phi i32 [ 1, %7 ], [ -1, %3 ]
ret i32 %14
}
void ARGBToUV444Row_Any_NEON() {}


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

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

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

LLVM IR (-O2):
define void @ARGBToUV444Row_Any_NEON() {
ret void
}
/* Variables and functions */
scalar_t__ pow(float, int);
float sqrt(scalar_t__);
float hip(float a, float b) { return sqrt(pow(a, 2) + pow(b, 2)); }


x86 assembly (clang, -O0):
<hip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    -0x10(%rbp),%rdi
add    %rax,%rdi
call   1040 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hip>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm1,0xc(%rsp)
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,%rbx
movss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define float @hip(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = call i64 @pow(float %5, i32 2)
%7 = load float, float* %4
%8 = call i64 @pow(float %7, i32 2)
%9 = add nsw i64 %6, %8
%10 = call float @sqrt(i64 %9)
ret float %10
}

LLVM IR (-O2):
define float @hip(float %0, float %1) {
%3 = tail call i64 @pow(float %0, i32 2)
%4 = tail call i64 @pow(float %1, i32 2)
%5 = add nsw i64 %4, %3
%6 = tail call float @sqrt(i64 %5)
ret float %6
}
void gtk_label_get_text() {}


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

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

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

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

/* Variables and functions */
int O_EXCL;
int O_RDWR;
int /*<<< orphan*/ *fdopen(int, char const *);
int open(char const *, int, int /*<<< orphan*/);
FILE *fopen_excl(const char *path, const char *mode) {
  int fd;
  fd = open(path, O_RDWR | O_EXCL, 0);
  if (fd < 0)
    return NULL;
  return fdopen(fd, mode);
}


x86 assembly (clang, -O0):
<fopen_excl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    0x2e94(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   1040 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1167 <fopen_excl+0x47>
movq   $0x0,-0x8(%rbp)
jmp    1177 <fopen_excl+0x57>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <fdopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fopen_excl>:
push   %rbx
mov    %rsi,%rbx
mov    0x2ebd(%rip),%rax
mov    0x2ea6(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
xor    %edx,%edx
call   1040 <open@plt>
test   %eax,%eax
js     114c <fopen_excl+0x2c>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <fdopen@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@O_RDWR = global i32 0
@O_EXCL = global i32 0
define i32* @fopen_excl(i8* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = load i32, i32* @O_RDWR
%9 = load i32, i32* @O_EXCL
%10 = or i32 %8, %9
%11 = call i32 @open(i8* %7, i32 %10, i32 0)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %2
store i32* null, i32** %3
br label %19
15: ; preds = %2
%16 = load i32, i32* %6
%17 = load i8*, i8** %5
%18 = call i32* @fdopen(i32 %16, i8* %17)
store i32* %18, i32** %3
br label %19
19: ; preds = %15, %14
%20 = load i32*, i32** %3
ret i32* %20
}

LLVM IR (-O2):
@O_RDWR = global i32 0
@O_EXCL = global i32 0
define noalias i32* @fopen_excl(i8* nocapture %0, i8* nocapture %1) {
%3 = load i32, i32* @O_RDWR
%4 = load i32, i32* @O_EXCL
%5 = or i32 %4, %3
%6 = tail call i32 @open(i8* %0, i32 %5, i32 0)
%7 = icmp slt i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32* @fdopen(i32 %6, i8* %1)
br label %10
10: ; preds = %2, %8
%11 = phi i32* [ %9, %8 ], [ null, %2 ]
ret i32* %11
}
char Chop(char *string) {
  register char c;
  register char *ptr;
  c = '\0';
  for (ptr = string; *ptr; ptr++)
    ;
  if (ptr != string) {
    c = *(--ptr);
    *ptr = '\0';
  }
  return (c);
}


x86 assembly (clang, -O0):
<Chop>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1137 <Chop+0x37>
jmp    1126 <Chop+0x26>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <Chop+0x14>
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     1161 <Chop+0x61>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
mov    -0x1(%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
movsbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Chop>:
mov    $0xffffffffffffffff,%rcx
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rcx,1)
lea    0x1(%rcx),%rcx
jne    1110 <Chop+0x10>
test   %rcx,%rcx
je     112a <Chop+0x2a>
mov    -0x1(%rdi,%rcx,1),%al
movb   $0x0,-0x1(%rdi,%rcx,1)
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define signext i8 @Chop(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = icmp eq i8* %3, %0
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = getelementptr inbounds i8, i8* %3, i64 -1
%11 = load i8, i8* %10
store i8 0, i8* %10
br label %12
12: ; preds = %9, %7
%13 = phi i8 [ %11, %9 ], [ 0, %7 ]
ret i8 %13
}
/* Type definitions */
struct soap {
  int dummy;
};

/* Variables and functions */
int soap_send(struct soap *, char *);
int soap_body_begin_out(struct soap *soap) {
  return soap_send(soap, "<SOAP-ENV:Body>");
}


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

x86 assembly (clang, -O2):
<soap_body_begin_out>:
lea    0xee9(%rip),%rsi
jmp    1030 <soap_send@plt>

LLVM IR (-O0):
%struct.soap = type { i32 }
@.str = [16 x i8] c"<SOAP-ENV:Body>\00"
define i32 @soap_body_begin_out(%struct.soap* %0) {
%2 = alloca %struct.soap*
store %struct.soap* %0, %struct.soap** %2
%3 = load %struct.soap*, %struct.soap** %2
%4 = call i32 @soap_send(%struct.soap* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
%struct.soap = type { i32 }
@.str = [16 x i8] c"<SOAP-ENV:Body>\00"
define i32 @soap_body_begin_out(%struct.soap* %0) {
%2 = tail call i32 @soap_send(%struct.soap* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, char, size_t);
void bzero(void *s, size_t n) { memset(s, '\0', n); }


x86 assembly (clang, -O0):
<bzero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bzero>:
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @bzero(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @memset(i8* %5, i8 signext 0, i64 %6)
ret void
}

LLVM IR (-O2):
define void @bzero(i8* %0, i64 %1) {
%3 = tail call i32 @memset(i8* %0, i8 signext 0, i64 %1)
ret void
}
/* Variables and functions */
void *malloc(int);
void *ciao_malloc(int size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<ciao_malloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @ciao_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ japi_drawimage(int, int, int, int);
void j_drawimage(int arg0, int arg1, int arg2, int arg3) {
  japi_drawimage(arg0, arg1, arg2, arg3);
}


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

x86 assembly (clang, -O2):
<j_drawimage>:
jmp    1030 <japi_drawimage@plt>

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

LLVM IR (-O2):
define void @j_drawimage(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @japi_drawimage(i32 %0, i32 %1, i32 %2, i32 %3)
ret void
}
void bgscan_notify_beacon_loss(struct wpa_supplicant *wpa_s) {}


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

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

LLVM IR (-O0):
%struct.wpa_supplicant = type opaque
define void @bgscan_notify_beacon_loss(%struct.wpa_supplicant* %0) {
%2 = alloca %struct.wpa_supplicant*
store %struct.wpa_supplicant* %0, %struct.wpa_supplicant** %2
ret void
}

LLVM IR (-O2):
%struct.wpa_supplicant = type opaque
define void @bgscan_notify_beacon_loss(%struct.wpa_supplicant* nocapture %0) {
ret void
}
int div_round(int a, int b) {
  int res;
  res = a / b;
  if ((a % b) != 0)
    res++;
  return res;
}


x86 assembly (clang, -O0):
<div_round>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
je     112d <div_round+0x2d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<div_round>:
mov    %edi,%eax
cltd
idiv   %esi
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @div_round(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
%4 = srem i32 %0, %1
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
%7 = add nsw i32 %3, %6
ret i32 %7
}
int add_digits(int n) {
  if (n == 0)
    return 0;
  return (n % 10) + add_digits(n / 10);
}


x86 assembly (clang, -O0):
<add_digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <add_digits+0x21>
movl   $0x0,-0x4(%rbp)
jmp    1159 <add_digits+0x49>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <add_digits@plt>
mov    -0xc(%rbp),%edx
add    %eax,%edx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_digits>:
xor    %eax,%eax
test   %edi,%edi
je     113b <add_digits+0x3b>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %esi,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <add_digits+0x10>
ret

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

LLVM IR (-O2):
define i32 @add_digits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ %0, %1 ]
%5 = phi i32 [ %8, %3 ], [ 0, %1 ]
%6 = srem i32 %4, 10
%7 = sdiv i32 %4, 10
%8 = add nsw i32 %6, %5
%9 = add i32 %4, 9
%10 = icmp ult i32 %9, 19
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %12
}
/* Type definitions */
struct sgttyb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int gtty(int fd, struct sgttyb *params) {
  if (params == NULL) {
    __set_errno(EINVAL);
    return -1;
  }
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<gtty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1144 <gtty+0x34>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1159 <gtty+0x49>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtty>:
push   %rax
test   %rsi,%rsi
jne    111f <gtty+0xf>
mov    0x2ebb(%rip),%rax
jmp    1126 <gtty+0x16>
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sgttyb = type { i32 }
@EINVAL = global i32 0
@ENOSYS = global i32 0
define i32 @gtty(i32 %0, %struct.sgttyb* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.sgttyb*
store i32 %0, i32* %4
store %struct.sgttyb* %1, %struct.sgttyb** %5
%6 = load %struct.sgttyb*, %struct.sgttyb** %5
%7 = icmp eq %struct.sgttyb* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @EINVAL
%10 = call i32 @__set_errno(i32 %9)
store i32 -1, i32* %3
br label %14
11: ; preds = %2
%12 = load i32, i32* @ENOSYS
%13 = call i32 @__set_errno(i32 %12)
store i32 -1, i32* %3
br label %14
14: ; preds = %11, %8
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
%struct.sgttyb = type { i32 }
@EINVAL = global i32 0
@ENOSYS = global i32 0
define i32 @gtty(i32 %0, %struct.sgttyb* readnone %1) {
%3 = icmp eq %struct.sgttyb* %1, null
%4 = load i32, i32* @EINVAL
%5 = load i32, i32* @ENOSYS
%6 = select i1 %3, i32 %4, i32 %5
%7 = tail call i32 @__set_errno(i32 %6)
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double, double, double);
void print_in_flight_statistics(double time, double altitude,
                                double total_acceleration, double speed) {
  printf("|%10.2lf  |%9.1lf  |%12.2lf  |%11.2lf  |\n", time, altitude,
         total_acceleration, speed);
}


x86 assembly (clang, -O0):
<print_in_flight_statistics>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [42 x i8] c"|%10.2lf |%9.1lf |%12.2lf |%11.2lf |\0A\00"
define void @print_in_flight_statistics(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = load double, double* %6
%11 = load double, double* %7
%12 = load double, double* %8
%13 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), double %9, double %10, double %11, double %12)
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"|%10.2lf |%9.1lf |%12.2lf |%11.2lf |\0A\00"
define void @print_in_flight_statistics(double %0, double %1, double %2, double %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), double %0, double %1, double %2, double %3)
ret void
}
/* Type definitions */
struct wl_shm_pool {
  int dummy;
};
struct wl_proxy {
  int dummy;
};

/* Variables and functions */
void *wl_proxy_get_user_data(struct wl_proxy *);
void *wl_shm_pool_get_user_data(struct wl_shm_pool *wl_shm_pool) {
  return wl_proxy_get_user_data((struct wl_proxy *)wl_shm_pool);
}


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

x86 assembly (clang, -O2):
<wl_shm_pool_get_user_data>:
jmp    1030 <wl_proxy_get_user_data@plt>

LLVM IR (-O0):
%struct.wl_shm_pool = type { i32 }
%struct.wl_proxy = type { i32 }
define i8* @wl_shm_pool_get_user_data(%struct.wl_shm_pool* %0) {
%2 = alloca %struct.wl_shm_pool*
store %struct.wl_shm_pool* %0, %struct.wl_shm_pool** %2
%3 = load %struct.wl_shm_pool*, %struct.wl_shm_pool** %2
%4 = bitcast %struct.wl_shm_pool* %3 to %struct.wl_proxy*
%5 = call i8* @wl_proxy_get_user_data(%struct.wl_proxy* %4)
ret i8* %5
}

LLVM IR (-O2):
%struct.wl_shm_pool = type { i32 }
%struct.wl_proxy = type { i32 }
define i8* @wl_shm_pool_get_user_data(%struct.wl_shm_pool* %0) {
%2 = bitcast %struct.wl_shm_pool* %0 to %struct.wl_proxy*
%3 = tail call i8* @wl_proxy_get_user_data(%struct.wl_proxy* %2)
ret i8* %3
}
int ceph_osd_op_type_lock(int op) { return (op & 0x0f00) == 0x0100; }


x86 assembly (clang, -O0):
<ceph_osd_op_type_lock>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf00,%eax
cmp    $0x100,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceph_osd_op_type_lock>:
and    $0xf00,%edi
xor    %eax,%eax
cmp    $0x100,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @ceph_osd_op_type_lock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 3840
%5 = icmp eq i32 %4, 256
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @ceph_osd_op_type_lock(i32 %0) {
%2 = and i32 %0, 3840
%3 = icmp eq i32 %2, 256
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int machdep_sys_waitsys(int, int *, int, int /*<<< orphan*/ *);
machdep_sys_waitpid(int a, int *b, int c) {
  return (machdep_sys_waitsys(a, b, c, NULL));
}


x86 assembly (clang, -O0):
<machdep_sys_waitpid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <machdep_sys_waitsys@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<machdep_sys_waitpid>:
xor    %ecx,%ecx
jmp    1030 <machdep_sys_waitsys@plt>

LLVM IR (-O0):
define i32 @machdep_sys_waitpid(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 @machdep_sys_waitsys(i32 %7, i32* %8, i32 %9, i32* null)
ret i32 %10
}

LLVM IR (-O2):
define i32 @machdep_sys_waitpid(i32 %0, i32* %1, i32 %2) {
%4 = tail call i32 @machdep_sys_waitsys(i32 %0, i32* %1, i32 %2, i32* null)
ret i32 %4
}
void *_dlsym(void *ptr, const char *str) {}


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

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

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

LLVM IR (-O2):
define noalias i8* @_dlsym(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* undef
}
/* Variables and functions */
double sqrt(int);
double LSKeyframeAnimationFunctionEaseOutCirc(double t, double b, double c,
                                              double d) {
  return c * sqrt(1 - (t = t / d - 1) * t) + b;
}


x86 assembly (clang, -O0):
<LSKeyframeAnimationFunctionEaseOutCirc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe87(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LSKeyframeAnimationFunctionEaseOutCirc>:
sub    $0x18,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
divsd  %xmm3,%xmm0
addsd  0xed4(%rip),%xmm0
mulsd  %xmm0,%xmm0
movsd  0xed0(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sqrt@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @LSKeyframeAnimationFunctionEaseOutCirc(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %7
%10 = load double, double* %5
%11 = load double, double* %8
%12 = fdiv double %10, %11
%13 = fsub double %12, 1.000000e+00
store double %13, double* %5
%14 = load double, double* %5
%15 = fneg double %13
%16 = call double @llvm.fmuladd.f64(double %15, double %14, double 1.000000e+00)
%17 = fptosi double %16 to i32
%18 = call double @sqrt(i32 %17)
%19 = load double, double* %6
%20 = call double @llvm.fmuladd.f64(double %9, double %18, double %19)
ret double %20
}

LLVM IR (-O2):
define double @LSKeyframeAnimationFunctionEaseOutCirc(double %0, double %1, double %2, double %3) {
%5 = fdiv double %0, %3
%6 = fadd double %5, -1.000000e+00
%7 = fneg double %6
%8 = tail call double @llvm.fmuladd.f64(double %7, double %6, double 1.000000e+00)
%9 = fptosi double %8 to i32
%10 = tail call double @sqrt(i32 %9)
%11 = tail call double @llvm.fmuladd.f64(double %2, double %10, double %1)
ret double %11
}
void avcodec_fill_audio_frame() {}


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

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

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

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

/* Variables and functions */
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy) {
  ;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @pthread_attr_setschedpolicy(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @pthread_attr_setschedpolicy(i32* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ core9_swap(char *, int);
void U_EMRPIE_swap(char *record, int torev) { core9_swap(record, torev); }


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

x86 assembly (clang, -O2):
<U_EMRPIE_swap>:
jmp    1030 <core9_swap@plt>

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

LLVM IR (-O2):
define void @U_EMRPIE_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core9_swap(i8* %0, i32 %1)
ret void
}
int mod47(char *str) {
  int val = 1;
  while (*str != '\0' && *str != '\n') {
    val *= (*str) - 'A' + 1;
    val %= 47;
    str++;
  }
  return val;
}


x86 assembly (clang, -O0):
<mod47>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
je     1134 <mod47+0x34>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1144 <mod47+0x44>
jmp    1177 <mod47+0x77>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
add    $0x1,%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2f,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <mod47+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod47>:
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%rdi),%ecx
test   %ecx,%ecx
je     1147 <mod47+0x47>
cmp    $0xa,%cl
je     1147 <mod47+0x47>
add    $0xffffffc0,%ecx
imul   %eax,%ecx
movslq %ecx,%rax
imul   $0xffffffffae4c415d,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x2f,%ecx,%ecx
sub    %ecx,%eax
add    $0x1,%rdi
jmp    1110 <mod47+0x10>
ret

LLVM IR (-O0):
define i32 @mod47(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %3
br label %4
4: ; preds = %16, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 10
br label %14
14: ; preds = %9, %4
%15 = phi i1 [ false, %4 ], [ %13, %9 ]
br i1 %15, label %16, label %28
16: ; preds = %14
%17 = load i8*, i8** %2
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = sub nsw i32 %19, 65
%21 = add nsw i32 %20, 1
%22 = load i32, i32* %3
%23 = mul nsw i32 %22, %21
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = srem i32 %24, 47
store i32 %25, i32* %3
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %2
br label %4
28: ; preds = %14
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @mod47(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %11, %6 ]
%4 = phi i32 [ 1, %1 ], [ %10, %6 ]
%5 = load i8, i8* %3
switch i8 %5, label %6 [
i8 0, label %12
i8 10, label %12
]
6: ; preds = %2
%7 = sext i8 %5 to i32
%8 = add nsw i32 %7, -64
%9 = mul nsw i32 %8, %4
%10 = srem i32 %9, 47
%11 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
12: ; preds = %2, %2
ret i32 %4
}
int enter_sock(int fd) {
  if (fd == -1)
    return 0;
  else
    return fd;
}


x86 assembly (clang, -O0):
<enter_sock>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    111d <enter_sock+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1123 <enter_sock+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<enter_sock>:
xor    %eax,%eax
cmp    $0xffffffff,%edi
cmovne %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @enter_sock(i32 %0) {
%2 = icmp eq i32 %0, -1
%3 = select i1 %2, i32 0, i32 %0
ret i32 %3
}
int opponent_color(int color) { return 2 - color; }


x86 assembly (clang, -O0):
<opponent_color>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x2,%eax
sub    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<opponent_color>:
mov    $0x2,%eax
sub    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @opponent_color(i32 %0) {
%2 = sub nsw i32 2, %0
ret i32 %2
}
/* Variables and functions */
int calibrated_to_driver();
int mtx_to_driver();
int uvz_to_driver();
int files_to_driver() {
  int retval = 0;
  retval = mtx_to_driver();
  if (retval)
    return retval;
  retval = uvz_to_driver();
  if (retval)
    return retval;
  retval = calibrated_to_driver();
  return retval;
}


x86 assembly (clang, -O0):
<files_to_driver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <mtx_to_driver@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     115e <files_to_driver+0x2e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118d <files_to_driver+0x5d>
mov    $0x0,%al
call   1050 <uvz_to_driver@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     117d <files_to_driver+0x4d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118d <files_to_driver+0x5d>
mov    $0x0,%al
call   1030 <calibrated_to_driver@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<files_to_driver>:
push   %rax
xor    %eax,%eax
call   1040 <mtx_to_driver@plt>
test   %eax,%eax
jne    1147 <files_to_driver+0x17>
xor    %eax,%eax
call   1050 <uvz_to_driver@plt>
test   %eax,%eax
je     1149 <files_to_driver+0x19>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
jmp    1030 <calibrated_to_driver@plt>

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

LLVM IR (-O2):
define i32 @files_to_driver() {
%1 = tail call i32 (...) @mtx_to_driver()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = tail call i32 (...) @uvz_to_driver()
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (...) @calibrated_to_driver()
br label %8
8: ; preds = %3, %0, %6
%9 = phi i32 [ %7, %6 ], [ %1, %0 ], [ %4, %3 ]
ret i32 %9
}
void to_sign_char_store_n(__float128 a, signed char *p, long n) {
  p[n] = (signed char)a;
}


x86 assembly (clang, -O0):
<to_sign_char_store_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movaps %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movaps -0x10(%rbp),%xmm0
call   1130 <__fixtfsi>
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_sign_char_store_n>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1120 <__fixtfsi>
mov    %al,(%rbx,%r14,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
nopl   0x0(%rax,%rax,1)

LLVM IR (-O0):
define void @to_sign_char_store_n(fp128 %0, i8* %1, i64 %2) {
%4 = alloca fp128
%5 = alloca i8*
%6 = alloca i64
store fp128 %0, fp128* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load fp128, fp128* %4
%8 = fptosi fp128 %7 to i8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = getelementptr inbounds i8, i8* %9, i64 %10
store i8 %8, i8* %11
ret void
}

LLVM IR (-O2):
define void @to_sign_char_store_n(fp128 %0, i8* nocapture writeonly %1, i64 %2) {
%4 = fptosi fp128 %0 to i8
%5 = getelementptr inbounds i8, i8* %1, i64 %2
store i8 %4, i8* %5
ret void
}
void TOSH_wait_250ns(void) {
  asm("NOP");
  asm("NOP");
}


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

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

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

LLVM IR (-O2):
define void @TOSH_wait_250ns() {
tail call void asm sideeffect "NOP", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "NOP", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int func_nodebug(int neg) { return -neg; }


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

x86 assembly (clang, -O2):
<func_nodebug>:
mov    %edi,%eax
neg    %eax
ret

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

LLVM IR (-O2):
define i32 @func_nodebug(i32 %0) {
%2 = sub nsw i32 0, %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ write_instr(int);
void eval_bit_xor(void) { write_instr(0x22); }


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

x86 assembly (clang, -O2):
<eval_bit_xor>:
mov    $0x22,%edi
jmp    1030 <write_instr@plt>

LLVM IR (-O0):
define void @eval_bit_xor() {
%1 = call i32 @write_instr(i32 34)
ret void
}

LLVM IR (-O2):
define void @eval_bit_xor() {
%1 = tail call i32 @write_instr(i32 34)
ret void
}
int charcomp(const void *a, const void *b) {
  return (*((char *)b) - *((char *)a));
}


x86 assembly (clang, -O0):
<charcomp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<charcomp>:
movsbl (%rsi),%eax
movsbl (%rdi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @charcomp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @charcomp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = load i8, i8* %0
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}
void RTMemCacheAllocEx(void) {}


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

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

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

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

/* Variables and functions */
int yaffs_do_xattrib_mod(struct yaffs_obj *, int, char const *, void const *,
                         int, int);
int yaffs_set_xattrib(struct yaffs_obj *obj, const char *name,
                      const void *value, int size, int flags) {
  return yaffs_do_xattrib_mod(obj, 1, name, value, size, flags);
}


x86 assembly (clang, -O0):
<yaffs_set_xattrib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    $0x1,%esi
call   1030 <yaffs_do_xattrib_mod@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yaffs_set_xattrib>:
mov    %r8d,%r9d
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    $0x1,%esi
jmp    1030 <yaffs_do_xattrib_mod@plt>

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

LLVM IR (-O2):
%struct.yaffs_obj = type { i32 }
define i32 @yaffs_set_xattrib(%struct.yaffs_obj* %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = tail call i32 @yaffs_do_xattrib_mod(%struct.yaffs_obj* %0, i32 1, i8* %1, i8* %2, i32 %3, i32 %4)
ret i32 %6
}
unsigned int CalcChecksumOfBuffer(const char *buffer, unsigned int size) {
  return CalcChecksumOfBuffer((const unsigned char *)buffer, size);
}


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

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

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

LLVM IR (-O2):
define i32 @CalcChecksumOfBuffer(i8* nocapture readnone %0, i32 %1) {
br label %3
3: ; preds = %3, %2
br label %3
}
/* Type definitions */
typedef int /*<<< orphan*/ siginfo_t;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ PTRACE_GETSIGINFO;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int ptrace(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
siginfo_t ptrace_getsiginfo(pid_t target) {
  siginfo_t targetsig;
  if (ptrace(PTRACE_GETSIGINFO, target, NULL, &targetsig) == -1) {
    fprintf(stderr, "ptrace(PTRACE_GETSIGINFO) failed\n");
    exit(1);
  }
  return targetsig;
}


x86 assembly (clang, -O0):
<ptrace_getsiginfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
lea    -0x8(%rbp),%rcx
call   1040 <ptrace@plt>
cmp    $0xffffffff,%eax
jne    117c <ptrace_getsiginfo+0x4c>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xe93(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptrace_getsiginfo>:
push   %rax
mov    %edi,%esi
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0x4(%rsp),%rcx
xor    %edx,%edx
call   1040 <ptrace@plt>
cmp    $0xffffffff,%eax
je     1153 <ptrace_getsiginfo+0x23>
mov    0x4(%rsp),%eax
pop    %rcx
ret
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@PTRACE_GETSIGINFO = global i32 0
@stderr = global i32 0
@.str = [34 x i8] c"ptrace(PTRACE_GETSIGINFO) failed\0A\00"
define i32 @ptrace_getsiginfo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @PTRACE_GETSIGINFO
%5 = load i32, i32* %2
%6 = call i32 @ptrace(i32 %4, i32 %5, i32* null, i32* %3)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@PTRACE_GETSIGINFO = global i32 0
@stderr = global i32 0
@.str = [34 x i8] c"ptrace(PTRACE_GETSIGINFO) failed\0A\00"
define i32 @ptrace_getsiginfo(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @PTRACE_GETSIGINFO
%5 = call i32 @ptrace(i32 %4, i32 %0, i32* null, i32* %2)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
%12 = load i32, i32* %2
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ GLsizei;
typedef int /*<<< orphan*/ GLdouble;

/* Variables and functions */
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ gluOrtho2D(double, int /*<<< orphan*/, double,
                              int /*<<< orphan*/);
void stroke_reshape(int w, int h) {
  glViewport(0, 0, (GLsizei)w, (GLsizei)h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluOrtho2D(0.0, (GLdouble)w, 0.0, (GLdouble)h);
}


x86 assembly (clang, -O0):
<stroke_reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1060 <glViewport@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1040 <glLoadIdentity@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   1050 <gluOrtho2D@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stroke_reshape>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1060 <glViewport@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1040 <glLoadIdentity@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <gluOrtho2D@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
define void @stroke_reshape(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @glViewport(i32 0, i32 0, i32 %5, i32 %6)
%8 = load i32, i32* @GL_PROJECTION
%9 = call i32 @glMatrixMode(i32 %8)
%10 = call i32 (...) @glLoadIdentity()
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 @gluOrtho2D(double 0.000000e+00, i32 %11, double 0.000000e+00, i32 %12)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
define void @stroke_reshape(i32 %0, i32 %1) {
%3 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %1)
%4 = load i32, i32* @GL_PROJECTION
%5 = tail call i32 @glMatrixMode(i32 %4)
%6 = tail call i32 (...) @glLoadIdentity()
%7 = tail call i32 @gluOrtho2D(double 0.000000e+00, i32 %0, double 0.000000e+00, i32 %1)
ret void
}