xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ _is_node_unused(void *);
int _is_node_used(void *node) {
  if (node == NULL)
    return 0;
  return _is_node_unused(node) ? 0 : 1;
}


x86 assembly (clang, -O0):
<_is_node_used>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <_is_node_used+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1150 <_is_node_used+0x40>
mov    -0x10(%rbp),%rdi
call   1030 <_is_node_unused@plt>
mov    %rax,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_node_used>:
test   %rdi,%rdi
je     112b <_is_node_used+0x1b>
push   %rax
call   1030 <_is_node_unused@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @_is_node_used(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %13
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i64 @_is_node_unused(i8* %8)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 0, i32 1
store i32 %12, i32* %2
br label %13
13: ; preds = %7, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @_is_node_used(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i64 @_is_node_unused(i8* %0)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
void test() {
  char *x = 0;
  *x = 3;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x3,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @test() {
%1 = alloca i8*
store i8* null, i8** %1
%2 = load i8*, i8** %1
store i8 3, i8* %2
ret void
}

LLVM IR (-O2):
/* Variables and functions */
scalar_t__ isspace(char);
char *find_start_of_text(char *string) {
  while (*string != '\0' && isspace(*string)) {
    string++;
  }
  return string;
}


x86 assembly (clang, -O0):
<find_start_of_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1147 <find_start_of_text+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1157 <find_start_of_text+0x47>
jmp    1168 <find_start_of_text+0x58>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <find_start_of_text+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_start_of_text>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1139 <find_start_of_text+0x29>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1139 <find_start_of_text+0x29>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <find_start_of_text+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @find_start_of_text(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %9
%5 = phi i8 [ %11, %9 ], [ %2, %1 ]
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = tail call i64 @isspace(i8 signext %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %9, %1
%14 = phi i8* [ %0, %1 ], [ %10, %9 ], [ %6, %4 ]
ret i8* %14
}
int mbStrLen(str)
char *str;
{
  char *p = str;
  int clen, len = 0;
  while ((clen = mbCharLen(p)) > 0) {
    len++;
    p += clen;
  }
  return len;
}


x86 assembly (clang, -O0):
<mbStrLen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <mbCharLen@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    1161 <mbStrLen+0x51>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    112b <mbStrLen+0x1b>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mbStrLen>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <mbCharLen@plt>
test   %eax,%eax
jle    1146 <mbStrLen+0x36>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
mov    %eax,%eax
add    %rax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <mbCharLen@plt>
test   %eax,%eax
jg     1130 <mbStrLen+0x20>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @mbStrLen(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @mbCharLen to i32 (i8*, ...)*)(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1, %4
%5 = phi i32 [ %11, %4 ], [ %2, %1 ]
%6 = phi i32 [ %8, %4 ], [ 0, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = add nuw nsw i32 %6, 1
%9 = zext i32 %5 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = tail call i32 (i8*, ...) bitcast (i32 (...)* @mbCharLen to i32 (i8*, ...)*)(i8* %10)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %4, label %13
13: ; preds = %4, %1
%14 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %14
}
_Bool Float__GT_(float x, float y) { return x > y; }


x86 assembly (clang, -O0):
<Float__GT_>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Float__GT_>:
ucomiss %xmm1,%xmm0
seta   %al
ret

LLVM IR (-O0):
define zeroext i1 @Float__GT_(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 = load float, float* %4
%7 = fcmp ogt float %5, %6
ret i1 %7
}

LLVM IR (-O2):
define zeroext i1 @Float__GT_(float %0, float %1) {
%3 = fcmp ogt float %0, %1
ret i1 %3
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void breakout(void) { system("/bin/sh"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"/bin/sh\00"
define void @breakout() {
%1 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
define void @breakout() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
int main() { return 10 - 17; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0xfffffff9,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 -7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void error_exit(const char *error_msg) {
  printf("%s\n", error_msg);
  exit(-1);
}


x86 assembly (clang, -O0):
<error_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error_exit>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @error_exit(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 -1)
unreachable
}
char ascii85_char(unsigned long x) {
  unsigned u;
  int i;
  char back;
  back = (char)0;
  u = (unsigned)x;
  i = (int)u;
  i += 33;
  back = (char)i;
  return back;
}


x86 assembly (clang, -O0):
<ascii85_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x11(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x21,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascii85_char>:
lea    0x21(%rdi),%eax
ret

LLVM IR (-O0):
define signext i8 @ascii85_char(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i64 %0, i64* %2
store i8 0, i8* %5
%6 = load i64, i64* %2
%7 = trunc i64 %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 33
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = trunc i32 %11 to i8
store i8 %12, i8* %5
%13 = load i8, i8* %5
ret i8 %13
}

LLVM IR (-O2):
define signext i8 @ascii85_char(i64 %0) {
%2 = trunc i64 %0 to i8
%3 = add i8 %2, 33
ret i8 %3
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("%d\n", EOF);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EOF
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char const *const, char *);
FILE *openFile(const char *restrict const fileName) {
  FILE *fp = fopen(fileName, "a+");
  if (fp) {
    return fp;
  } else
    return NULL;
}


x86 assembly (clang, -O0):
<openFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1148 <openFile+0x38>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1150 <openFile+0x40>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"a+\00"
define i32* @openFile(i8* noalias %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32*, i32** %4
store i32* %10, i32** %2
br label %12
11: ; preds = %1
store i32* null, i32** %2
br label %12
12: ; preds = %11, %9
%13 = load i32*, i32** %2
ret i32* %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"a+\00"
define noalias i32* @openFile(i8* noalias nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32* %2
}
void STAMR3Dump(void) {}


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

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

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

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

/* Variables and functions */
int rl_multi_string_pages(struct rlite *, long, short *);
int rl_string_pages(struct rlite *db, long page, short *pages) {
  return rl_multi_string_pages(db, page, pages);
}


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

x86 assembly (clang, -O2):
<rl_string_pages>:
jmp    1030 <rl_multi_string_pages@plt>

LLVM IR (-O0):
%struct.rlite = type { i32 }
define i32 @rl_string_pages(%struct.rlite* %0, i64 %1, i16* %2) {
%4 = alloca %struct.rlite*
%5 = alloca i64
%6 = alloca i16*
store %struct.rlite* %0, %struct.rlite** %4
store i64 %1, i64* %5
store i16* %2, i16** %6
%7 = load %struct.rlite*, %struct.rlite** %4
%8 = load i64, i64* %5
%9 = load i16*, i16** %6
%10 = call i32 @rl_multi_string_pages(%struct.rlite* %7, i64 %8, i16* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.rlite = type { i32 }
define i32 @rl_string_pages(%struct.rlite* %0, i64 %1, i16* %2) {
%4 = tail call i32 @rl_multi_string_pages(%struct.rlite* %0, i64 %1, i16* %2)
ret i32 %4
}
/* Variables and functions */
void pdf_digest_md5(char *s, size_t len, unsigned char *digest) { int n; }


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

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

LLVM IR (-O0):
define void @pdf_digest_md5(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
ret void
}

LLVM IR (-O2):
define void @pdf_digest_md5(i8* nocapture %0, i64 %1, i8* nocapture %2) {
ret void
}
void clock_delay(unsigned int d) {}


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

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

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

LLVM IR (-O2):
define void @clock_delay(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int syscall(int, int /*<<< orphan*/, unsigned int);
int sys_pidfd_open(pid_t pid, unsigned int flags) {
  return syscall(-1, pid, flags);
}


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

x86 assembly (clang, -O2):
<sys_pidfd_open>:
mov    %esi,%edx
mov    %edi,%esi
mov    $0xffffffff,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @sys_pidfd_open(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 @syscall(i32 -1, i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @sys_pidfd_open(i32 %0, i32 %1) {
%3 = tail call i32 @syscall(i32 -1, i32 %0, i32 %1)
ret i32 %3
}
int test_imm_85uint16_mem(unsigned short *val) {
  return ((*val) & (0x85 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_85uint16_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, 133
%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_85uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 133
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void nullplot(int x, int y, int draw) {}


x86 assembly (clang, -O0):
<nullplot>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @nullplot(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
ret void
}

LLVM IR (-O2):
define void @nullplot(i32 %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_char(int c) {
  if (c < ' ')
    printf("^%c", c + '@');
  else
    printf("%c", c);
}


x86 assembly (clang, -O0):
<print_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jge    113c <print_char+0x2c>
mov    -0x4(%rbp),%esi
add    $0x40,%esi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
jmp    114b <print_char+0x3b>
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_char>:
mov    %edi,%esi
cmp    $0x1f,%edi
jg     1126 <print_char+0x16>
add    $0x40,%esi
lea    0xedf(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xed4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"^%c\00"
@.str.1 = [3 x i8] c"%c\00"
define void @print_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 32
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 64
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %5
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"^%c\00"
@.str.1 = [3 x i8] c"%c\00"
define void @print_char(i32 %0) {
%2 = icmp slt i32 %0, 32
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = add nsw i32 %0, 64
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %8
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %8
8: ; preds = %6, %3
ret void
}
void AAS_RT_PrintMemoryUsage() {}


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

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

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

LLVM IR (-O2):
define void @AAS_RT_PrintMemoryUsage() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ffpmsg(char *);
int mem_createmem(long, int *);
int mem_create(char *filename, int *handle) {
  int status;
  status = mem_createmem(2880L, handle);
  if (status) {
    ffpmsg("failed to create empty memory file (mem_create)");
    return (status);
  }
  return (0);
}


x86 assembly (clang, -O0):
<mem_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0xb40,%edi
call   1040 <mem_createmem@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1162 <mem_create+0x42>
lea    0xeae(%rip),%rdi
call   1030 <ffpmsg@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <mem_create+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_create>:
push   %rbx
mov    $0xb40,%edi
call   1040 <mem_createmem@plt>
mov    %eax,%ebx
test   %eax,%eax
je     113d <mem_create+0x1d>
lea    0xec8(%rip),%rdi
call   1030 <ffpmsg@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"failed to create empty memory file (mem_create)\00"
define i32 @mem_create(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
%7 = load i32*, i32** %5
%8 = call i32 @mem_createmem(i64 2880, i32* %7)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @ffpmsg(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %6
store i32 %13, i32* %3
br label %15
14: ; preds = %2
store i32 0, i32* %3
br label %15
15: ; preds = %14, %11
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@.str = [48 x i8] c"failed to create empty memory file (mem_create)\00"
define i32 @mem_create(i8* nocapture readnone %0, i32* %1) {
%3 = tail call i32 @mem_createmem(i64 2880, i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @ffpmsg(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
ret i32 %3
}
/* Type definitions */
struct node {
  int dummy;
};
struct generator {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wp(struct generator *, char *, struct node *);
void generate_delete(struct generator *g, struct node *p) {
  wp(g, "~{int ret = slice_del(z);~C", p);
  wp(g,
     "~Mif (ret < 0) return ret;~N"
     "~}",
     p);
}


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

x86 assembly (clang, -O2):
<generate_delete>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rsi
mov    %r14,%rdx
call   1030 <wp@plt>
lea    0xeec(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <wp@plt>

LLVM IR (-O0):
%struct.generator = type { i32 }
%struct.node = type { i32 }
@.str = [28 x i8] c"~{int ret = slice_del(z);~C\00"
@.str.1 = [31 x i8] c"~Mif (ret < 0) return ret;~N~}\00"
define void @generate_delete(%struct.generator* %0, %struct.node* %1) {
%3 = alloca %struct.generator*
%4 = alloca %struct.node*
store %struct.generator* %0, %struct.generator** %3
store %struct.node* %1, %struct.node** %4
%5 = load %struct.generator*, %struct.generator** %3
%6 = load %struct.node*, %struct.node** %4
%7 = call i32 @wp(%struct.generator* %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), %struct.node* %6)
%8 = load %struct.generator*, %struct.generator** %3
%9 = load %struct.node*, %struct.node** %4
%10 = call i32 @wp(%struct.generator* %8, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), %struct.node* %9)
ret void
}

LLVM IR (-O2):
%struct.generator = type { i32 }
%struct.node = type { i32 }
@.str = [28 x i8] c"~{int ret = slice_del(z);~C\00"
@.str.1 = [31 x i8] c"~Mif (ret < 0) return ret;~N~}\00"
define void @generate_delete(%struct.generator* %0, %struct.node* %1) {
%3 = tail call i32 @wp(%struct.generator* %0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), %struct.node* %1)
%4 = tail call i32 @wp(%struct.generator* %0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), %struct.node* %1)
ret void
}
/* Variables and functions */
scalar_t__ frexp(float, int *);
float frexpf(float x, int *exp) { return (float)frexp(x, exp); }


x86 assembly (clang, -O0):
<frexpf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
call   1030 <frexp@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frexpf>:
push   %rax
call   1030 <frexp@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @frexpf(float %0, i32* %1) {
%3 = alloca float
%4 = alloca i32*
store float %0, float* %3
store i32* %1, i32** %4
%5 = load float, float* %3
%6 = load i32*, i32** %4
%7 = call i64 @frexp(float %5, i32* %6)
%8 = sitofp i64 %7 to float
ret float %8
}

LLVM IR (-O2):
define float @frexpf(float %0, i32* nocapture %1) {
%3 = tail call i64 @frexp(float %0, i32* %1)
%4 = sitofp i64 %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, int *);
int GetInput(char str[50]) {
  int number;
  printf("%s", str);
  scanf("%d", &number);
  return number;
}


x86 assembly (clang, -O0):
<GetInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetInput>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @GetInput(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ _gravitateDown();
int /*<<< orphan*/ _gravitateLeft();
int /*<<< orphan*/ _gravitateRight();
int /*<<< orphan*/ _gravitateUp();
void gravitate(int d) {
  switch (d) {
  case 4:
    _gravitateLeft();
    break;
  case 3:
    _gravitateRight();
    break;
  case 2:
    _gravitateDown();
    break;
  case 1:
    _gravitateUp();
    break;
  }
}


x86 assembly (clang, -O0):
<gravitate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     119f <gravitate+0x5f>
mov    -0x10(%rbp),%rax
lea    0xe95(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1050 <_gravitateLeft@plt>
jmp    119f <gravitate+0x5f>
mov    $0x0,%al
call   1030 <_gravitateRight@plt>
jmp    119f <gravitate+0x5f>
mov    $0x0,%al
call   1040 <_gravitateDown@plt>
jmp    119f <gravitate+0x5f>
mov    $0x0,%al
call   1060 <_gravitateUp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gravitate>:
add    $0xffffffff,%edi
cmp    $0x3,%edi
ja     115f <gravitate+0x1f>
lea    0xeb1(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xor    %eax,%eax
jmp    1060 <_gravitateUp@plt>
ret
xor    %eax,%eax
jmp    1040 <_gravitateDown@plt>
xor    %eax,%eax
jmp    1030 <_gravitateRight@plt>
xor    %eax,%eax
jmp    1050 <_gravitateLeft@plt>

LLVM IR (-O0):
define void @gravitate(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %12 [
i32 4, label %4
i32 3, label %6
i32 2, label %8
i32 1, label %10
]
4: ; preds = %1
%5 = call i32 (...) @_gravitateLeft()
br label %12
6: ; preds = %1
%7 = call i32 (...) @_gravitateRight()
br label %12
8: ; preds = %1
%9 = call i32 (...) @_gravitateDown()
br label %12
10: ; preds = %1
%11 = call i32 (...) @_gravitateUp()
br label %12
12: ; preds = %1, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
define void @gravitate(i32 %0) {
switch i32 %0, label %10 [
i32 4, label %2
i32 3, label %4
i32 2, label %6
i32 1, label %8
]
2: ; preds = %1
%3 = tail call i32 (...) @_gravitateLeft()
br label %10
4: ; preds = %1
%5 = tail call i32 (...) @_gravitateRight()
br label %10
6: ; preds = %1
%7 = tail call i32 (...) @_gravitateDown()
br label %10
8: ; preds = %1
%9 = tail call i32 (...) @_gravitateUp()
br label %10
10: ; preds = %1, %8, %6, %4, %2
ret void
}
void npf__bufputc_nop(int c, void *ctx) {
  (void)c;
  (void)ctx;
}


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

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

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

LLVM IR (-O2):
define void @npf__bufputc_nop(i32 %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long);
int main(void) {
  char *greeting = "Hello World";
  char *c = &greeting[1];
  unsigned long badnews = *(unsigned long *)c;
  printf("%ld\n", badnews);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
movabs $0x726f57206f6c6c65,%rsi
57 6f 72
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hello World\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i32 0, i32* %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %8
store i64 %9, i64* %4
%10 = load i64, i64* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %10)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 8245905239558614117)
ret i32 0
}
const char *charset_from_utf8(const char *from) { return from; }


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

x86 assembly (clang, -O2):
<charset_from_utf8>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @charset_from_utf8(i8* readnone returned %0) {
ret i8* %0
}
int PyDTrace_GC_START_ENABLED(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @PyDTrace_GC_START_ENABLED() {
ret i32 0
}
void __halt(void) { __asm__("hlt"); }


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

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

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

LLVM IR (-O2):
define void @__halt() {
tail call void asm sideeffect "hlt", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
scalar_t__ is_prime(int);
int euler_problem_7() {
  int i, count = 1;
  for (i = 3;; i += 2) {
    if (is_prime(i)) {
      ++count;
    }
    if (count == 10001) {
      return i;
    }
  }
}


x86 assembly (clang, -O0):
<euler_problem_7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x8(%rbp)
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <is_prime@plt>
cmp    $0x0,%rax
je     1141 <euler_problem_7+0x31>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x2711,-0x8(%rbp)
jne    1157 <euler_problem_7+0x47>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    115c <euler_problem_7+0x4c>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    1126 <euler_problem_7+0x16>

x86 assembly (clang, -O2):
<euler_problem_7>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebx
mov    $0x1,%ebp
nopl   (%rax)
add    $0x2,%ebx
mov    %ebx,%edi
call   1030 <is_prime@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebp
cmp    $0x2711,%ebp
jne    1120 <euler_problem_7+0x10>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @euler_problem_7() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 3, %0 ], [ %9, %1 ]
%3 = phi i32 [ 1, %0 ], [ %7, %1 ]
%4 = tail call i64 @is_prime(i32 %2)
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
%7 = add nuw nsw i32 %3, %6
%8 = icmp eq i32 %7, 10001
%9 = add nuw nsw i32 %2, 2
br i1 %8, label %10, label %1
10: ; preds = %1
ret i32 %2
}
/* Type definitions */
struct timeval {
  long long tv_sec;
  long long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long long gu_time_monotonic() {
  struct timeval tmp;
  gettimeofday(&tmp, NULL);
  return ((tmp.tv_sec * 1000000000LL) + (tmp.tv_usec * 1000LL));
}


x86 assembly (clang, -O0):
<gu_time_monotonic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3b9aca00,-0x10(%rbp),%rax
3b
imul   $0x3e8,-0x8(%rbp),%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gu_time_monotonic>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3b9aca00,0x8(%rsp),%rcx
9a 3b
imul   $0x3e8,0x10(%rsp),%rax
add    %rcx,%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i64 @gu_time_monotonic() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i64, i64* %3
%5 = mul nsw i64 %4, 1000000000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i64, i64* %6
%8 = mul nsw i64 %7, 1000
%9 = add nsw i64 %5, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i64 @gu_time_monotonic() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = mul nsw i64 %5, 1000000000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i64, i64* %7
%9 = mul nsw i64 %8, 1000
%10 = add nsw i64 %9, %6
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ stdin;
int main() {
  char *word;
  word = (char *)malloc(5000 * sizeof(char));
  fgets(word, 5000, stdin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1388,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2ea0(%rip),%rax
mov    (%rax),%edx
mov    $0x1388,%esi
call   1030 <fgets@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1388,%edi
call   1040 <malloc@plt>
mov    0x2eb6(%rip),%rcx
mov    (%rcx),%edx
mov    %rax,%rdi
mov    $0x1388,%esi
call   1030 <fgets@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 5000)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i32 5000, i32 %6)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main() {
%1 = tail call i64 @malloc(i32 5000)
%2 = inttoptr i64 %1 to i8*
%3 = load i32, i32* @stdin
%4 = tail call i32 @fgets(i8* %2, i32 5000, i32 %3)
ret i32 0
}
int cad_mover(char m1[], char m2[], int n) {
  while (n-- && (*m2++ = *m1++))
    ;
  return 1;
}


x86 assembly (clang, -O0):
<cad_mover>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     1156 <cad_mover+0x56>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1166 <cad_mover+0x66>
jmp    116b <cad_mover+0x6b>
jmp    110f <cad_mover+0xf>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cad_mover>:
mov    %edx,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %ecx,%eax
je     1123 <cad_mover+0x23>
movzbl (%rdi,%rcx,1),%edx
mov    %dl,(%rsi,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <cad_mover+0x10>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @cad_mover(i8* nocapture %0, i8* nocapture writeonly %1, i32 %2) {
br label %4
4: ; preds = %9, %3
%5 = phi i8* [ %0, %3 ], [ %11, %9 ]
%6 = phi i8* [ %1, %3 ], [ %13, %9 ]
%7 = phi i32 [ %2, %3 ], [ %10, %9 ]
%8 = icmp eq i32 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %4
%10 = add nsw i32 %7, -1
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = load i8, i8* %5
%13 = getelementptr inbounds i8, i8* %6, i64 1
store i8 %12, i8* %6
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %9
ret i32 1
}
void *Cyc_Dict_intersect_f(void *(*f)(void *, void *, void *), void *a,
                           void *b1, void *b2) {
  return ({ f(a, b1, b2); });
}


x86 assembly (clang, -O0):
<Cyc_Dict_intersect_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   *%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Dict_intersect_f>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    *%rax

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

LLVM IR (-O2):
define i8* @Cyc_Dict_intersect_f(i8* (i8*, i8*, i8*)* nocapture %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i8* %0(i8* %1, i8* %2, i8* %3)
ret i8* %5
}
void on_idle(union ui_state *ui_state) {}


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

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

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

LLVM IR (-O2):
%union.ui_state = type opaque
define void @on_idle(%union.ui_state* nocapture %0) {
ret void
}
/* Variables and functions */
int fc8080_video_select(void *, unsigned char, unsigned char, unsigned char);
int bbm_com_video_select(void *handle, unsigned char subch_id,
                         unsigned char buf_id, unsigned char cdi_id) {
  int res;
  res = fc8080_video_select(handle, subch_id, buf_id, cdi_id);
  return res;
}


x86 assembly (clang, -O0):
<bbm_com_video_select>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %rdi,-0x8(%rbp)
mov    %dl,-0x9(%rbp)
mov    %cl,-0xa(%rbp)
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%cl
mov    -0xa(%rbp),%al
movzbl %cl,%esi
movzbl %al,%edx
movzbl -0xb(%rbp),%ecx
call   1030 <fc8080_video_select@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbm_com_video_select>:
jmp    1030 <fc8080_video_select@plt>

LLVM IR (-O0):
define i32 @bbm_com_video_select(i8* %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i32
store i8* %0, i8** %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%10 = load i8*, i8** %5
%11 = load i8, i8* %6
%12 = load i8, i8* %7
%13 = load i8, i8* %8
%14 = call i32 @fc8080_video_select(i8* %10, i8 zeroext %11, i8 zeroext %12, i8 zeroext %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
ret i32 %15
}

LLVM IR (-O2):
define i32 @bbm_com_video_select(i8* %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = tail call i32 @fc8080_video_select(i8* %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3)
ret i32 %5
}
void *pcre_compile2(const char **errorptr, int *errorcodeptr) {
  if (errorptr == 0) {
    return 0;
  }
  *errorptr = 0;
  *errorptr = "foo";
  return errorcodeptr;
}


x86 assembly (clang, -O0):
<pcre_compile2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1124 <pcre_compile2+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1145 <pcre_compile2+0x45>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
lea    0xec6(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcre_compile2>:
test   %rdi,%rdi
je     1113 <pcre_compile2+0x13>
mov    %rsi,%rax
lea    0xef1(%rip),%rcx
mov    %rcx,(%rdi)
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
define i8* @pcre_compile2(i8** %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i32*
store i8** %0, i8*** %4
store i32* %1, i32** %5
%6 = load i8**, i8*** %4
%7 = icmp eq i8** %6, null
br i1 %7, label %8, label %9
8: ; preds = %2
store i8* null, i8** %3
br label %14
9: ; preds = %2
%10 = load i8**, i8*** %4
store i8* null, i8** %10
%11 = load i8**, i8*** %4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %11
%12 = load i32*, i32** %5
%13 = bitcast i32* %12 to i8*
store i8* %13, i8** %3
br label %14
14: ; preds = %9, %8
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
define i8* @pcre_compile2(i8** writeonly %0, i32* readnone %1) {
%3 = icmp eq i8** %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %0
%5 = bitcast i32* %1 to i8*
br label %6
6: ; preds = %2, %4
%7 = phi i8* [ %5, %4 ], [ null, %2 ]
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ datasette_internal_reset();
int /*<<< orphan*/ resources_get_int(char *, int *);
void datasette_reset(void) {
  int ds_reset;
  resources_get_int("DatasetteResetWithCPU", &ds_reset);
  if (ds_reset)
    datasette_internal_reset();
}


x86 assembly (clang, -O0):
<datasette_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <resources_get_int@plt>
cmpl   $0x0,-0x4(%rbp)
je     1149 <datasette_reset+0x29>
mov    $0x0,%al
call   1040 <datasette_internal_reset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<datasette_reset>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <resources_get_int@plt>
cmpl   $0x0,0x4(%rsp)
je     1140 <datasette_reset+0x20>
xor    %eax,%eax
call   1040 <datasette_internal_reset@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [22 x i8] c"DatasetteResetWithCPU\00"
define void @datasette_reset() {
%1 = alloca i32
%2 = call i32 @resources_get_int(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @datasette_internal_reset()
br label %7
7: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"DatasetteResetWithCPU\00"
define void @datasette_reset() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @resources_get_int(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (...) @datasette_internal_reset()
br label %8
8: ; preds = %6, %0
ret void
}