xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ clock_t;

/* Variables and functions */
scalar_t__ clock();
void wait() {
  clock_t start;
  int pauseLength = 300;
  start = clock();
  while (clock() < start + pauseLength)
    ;
}


x86 assembly (clang, -O0):
<wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x12c,-0xc(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jge    114a <wait+0x3a>
jmp    112a <wait+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait>:
push   %rbx
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
add    $0x12c,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <clock@plt>
cmp    %rbx,%rax
jl     1130 <wait+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @wait() {
%1 = alloca i64
%2 = alloca i32
store i32 300, i32* %2
%3 = call i64 (...) @clock()
store i64 %3, i64* %1
br label %4
4: ; preds = %11, %0
%5 = call i64 (...) @clock()
%6 = load i64, i64* %1
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = add nsw i64 %6, %8
%10 = icmp slt i64 %5, %9
br i1 %10, label %11, label %12
11: ; preds = %4
br label %4
12: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @wait() {
%1 = tail call i64 (...) @clock()
%2 = add nsw i64 %1, 300
br label %3
3: ; preds = %3, %0
%4 = tail call i64 (...) @clock()
%5 = icmp slt i64 %4, %2
br i1 %5, label %3, label %6
6: ; preds = %3
ret void
}
/* Variables and functions */
int getgid();
int getuid();
int /*<<< orphan*/ printf(char *, int, int, int);
void fn(int i) { printf("hi %x %x %x\n", i, getuid(), getgid()); }


x86 assembly (clang, -O0):
<fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getgid@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    %eax,%ecx
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getuid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <getgid@plt>
lea    0xeb4(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"hi %x %x %x\0A\00"
define void @fn(i32 %0) {
%2 = tail call i32 (...) @getuid()
%3 = tail call i32 (...) @getgid()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2, i32 %3)
ret void
}
struct change *find_change(start)
struct change *start;
{
  return start;
}


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

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

LLVM IR (-O0):
%struct.change = type opaque
define %struct.change* @find_change(%struct.change* %0) {
%2 = alloca %struct.change*
store %struct.change* %0, %struct.change** %2
%3 = load %struct.change*, %struct.change** %2
ret %struct.change* %3
}

LLVM IR (-O2):
%struct.change = type opaque
define %struct.change* @find_change(%struct.change* readnone returned %0) {
ret %struct.change* %0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ killid;
};
typedef TYPE_1__ XStandardColormap;

/* Variables and functions */
unsigned long get_XStandardColormap_killid(void *_p) {
  return (unsigned long)((XStandardColormap *)_p)->killid;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XStandardColormap_killid(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XStandardColormap_killid(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ test_parser_sourcefile(char *, char *);
int /*<<< orphan*/ test_parser_verify_parse(int /*<<< orphan*/, char *, char *,
                                            char *, int /*<<< orphan*/);
void test_lisp_doc_string() {
  test_parser_verify_parse(
      test_parser_sourcefile("lisp", " \"\"\" comment \"\"\""), "lisp", "",
      "\"\"\" comment \"\"\"", 0);
}


x86 assembly (clang, -O0):
<test_lisp_doc_string>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1030 <test_parser_sourcefile@plt>
mov    %eax,%edi
lea    0xec0(%rip),%rsi
lea    0xece(%rip),%rdx
lea    0xeb8(%rip),%rcx
xor    %r8d,%r8d
call   1040 <test_parser_verify_parse@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_lisp_doc_string>:
push   %rbx
lea    0xed8(%rip),%rbx
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test_parser_sourcefile@plt>
lea    0xed7(%rip),%rdx
lea    0xec1(%rip),%rcx
mov    %eax,%edi
mov    %rbx,%rsi
xor    %r8d,%r8d
pop    %rbx
jmp    1040 <test_parser_verify_parse@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"lisp\00"
@.str.1 = [17 x i8] c" \22\22\22 comment \22\22\22\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [16 x i8] c"\22\22\22 comment \22\22\22\00"
define void @test_lisp_doc_string() {
%1 = call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"lisp\00"
@.str.1 = [17 x i8] c" \22\22\22 comment \22\22\22\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [16 x i8] c"\22\22\22 comment \22\22\22\00"
define void @test_lisp_doc_string() {
%1 = tail call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}
void rop3_34_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~S;
  stk1 = *D & stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_34_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @rop3_34_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = xor i32 %10, -1
%12 = trunc i32 %11 to i8
store i8 %12, i8* %8
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = and i32 %15, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %7
%20 = load i8, i8* %7
%21 = zext i8 %20 to i32
%22 = load i8, i8* %5
%23 = zext i8 %22 to i32
%24 = xor i32 %23, -1
%25 = and i32 %21, %24
%26 = load i8, i8* %6
%27 = zext i8 %26 to i32
%28 = xor i32 %27, -1
%29 = and i32 %25, %28
%30 = load i8*, i8** %4
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = load i8, i8* %5
%34 = zext i8 %33 to i32
%35 = and i32 %32, %34
%36 = or i32 %29, %35
%37 = load i8*, i8** %4
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = load i8, i8* %6
%41 = zext i8 %40 to i32
%42 = and i32 %39, %41
%43 = or i32 %36, %42
%44 = trunc i32 %43 to i8
%45 = load i8*, i8** %4
store i8 %44, i8* %45
ret void
}

LLVM IR (-O2):
define void @rop3_34_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
ret void
}
int bar1(int c) {
  if (c < 100)
    c += 10;
  else
    c -= 10;
  return c * c;
}


x86 assembly (clang, -O0):
<bar1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    111f <bar1+0x1f>
mov    -0x4(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1128 <bar1+0x28>
mov    -0x4(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar1>:
lea    -0xa(%rdi),%ecx
lea    0xa(%rdi),%eax
cmp    $0x64,%edi
cmovge %ecx,%eax
imul   %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @bar1(i32 %0) {
%2 = icmp slt i32 %0, 100
%3 = select i1 %2, i32 10, i32 -10
%4 = add nsw i32 %3, %0
%5 = mul nsw i32 %4, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_dvector(double *v, long int nl, long int nh) {
  free((char *)(v + nl - 1));
}


x86 assembly (clang, -O0):
<free_dvector>:
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),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_dvector>:
lea    (%rdi,%rsi,8),%rdi
add    $0xfffffffffffffff8,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_dvector(double* %0, i64 %1, i64 %2) {
%4 = alloca double*
%5 = alloca i64
%6 = alloca i64
store double* %0, double** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load double*, double** %4
%8 = load i64, i64* %5
%9 = getelementptr inbounds double, double* %7, i64 %8
%10 = getelementptr inbounds double, double* %9, i64 -1
%11 = bitcast double* %10 to i8*
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @free_dvector(double* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds double, double* %0, i64 %1
%5 = getelementptr inbounds double, double* %4, i64 -1
%6 = bitcast double* %5 to i8*
%7 = tail call i32 @free(i8* %6)
ret void
}
/* Variables and functions */
int via_vt823x_gpio_set(int, int);
int via_vt823x_gpio15_raise(void) { return via_vt823x_gpio_set(15, 1); }


x86 assembly (clang, -O0):
<via_vt823x_gpio15_raise>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf,%edi
mov    $0x1,%esi
call   1030 <via_vt823x_gpio_set@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<via_vt823x_gpio15_raise>:
mov    $0xf,%edi
mov    $0x1,%esi
jmp    1030 <via_vt823x_gpio_set@plt>

LLVM IR (-O0):
define i32 @via_vt823x_gpio15_raise() {
%1 = call i32 @via_vt823x_gpio_set(i32 15, i32 1)
ret i32 %1
}

LLVM IR (-O2):
define i32 @via_vt823x_gpio15_raise() {
%1 = tail call i32 @via_vt823x_gpio_set(i32 15, i32 1)
ret i32 %1
}
void initL2Cache(void) {}


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

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

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

LLVM IR (-O2):
define void @initL2Cache() {
ret void
}
/* Variables and functions */
int isspace(char);
int matchwhitespace(char c) { return isspace(c); }


x86 assembly (clang, -O0):
<matchwhitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <isspace@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matchwhitespace>:
jmp    1030 <isspace@plt>

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

LLVM IR (-O2):
define i32 @matchwhitespace(i8 signext %0) {
%2 = tail call i32 @isspace(i8 signext %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char *, int /*<<< orphan*/);
int open_devnull(void) {
  static int devnull_fd = -1;
  if (devnull_fd < 0)
    devnull_fd = open("/dev/null", O_RDWR);
  return devnull_fd;
}


x86 assembly (clang, -O0):
<open_devnull>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,0x2f0d(%rip)
jge    113c <open_devnull+0x2c>
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <open@plt>
mov    %eax,0x2eec(%rip)
mov    0x2ee6(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_devnull>:
push   %rax
mov    0x2f11(%rip),%eax
test   %eax,%eax
js     111d <open_devnull+0xd>
pop    %rcx
ret
mov    0x2ec4(%rip),%rax
mov    (%rax),%esi
lea    0xed3(%rip),%rdi
call   1030 <open@plt>
mov    %eax,0x2ef0(%rip)
pop    %rcx
ret

LLVM IR (-O0):
@open_devnull.devnull_fd = internal global i32 -1
@.str = [10 x i8] c"/dev/null\00"
@O_RDWR = global i32 0
define i32 @open_devnull() {
%1 = load i32, i32* @open_devnull.devnull_fd
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = load i32, i32* @O_RDWR
%5 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 %5, i32* @open_devnull.devnull_fd
br label %6
6: ; preds = %3, %0
%7 = load i32, i32* @open_devnull.devnull_fd
ret i32 %7
}

LLVM IR (-O2):
@open_devnull.devnull_fd = internal unnamed_addr global i32 -1
@.str = [10 x i8] c"/dev/null\00"
@O_RDWR = global i32 0
define i32 @open_devnull() {
%1 = load i32, i32* @open_devnull.devnull_fd
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = load i32, i32* @O_RDWR
%5 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 %5, i32* @open_devnull.devnull_fd
br label %6
6: ; preds = %3, %0
%7 = phi i32 [ %5, %3 ], [ %1, %0 ]
ret i32 %7
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t bswap24(uint32_t v) {
  return ((v & 0xff) << 16) | (v & 0x00ff00) | ((v & 0xff0000) >> 16);
}


x86 assembly (clang, -O0):
<bswap24>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x10,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x10,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bswap24>:
movzbl %dil,%eax
shl    $0x10,%eax
mov    %edi,%ecx
and    $0xff00,%ecx
or     %eax,%ecx
shr    $0x10,%edi
movzbl %dil,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @bswap24(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 16
%6 = load i32, i32* %2
%7 = and i32 %6, 65280
%8 = or i32 %5, %7
%9 = load i32, i32* %2
%10 = and i32 %9, 16711680
%11 = ashr i32 %10, 16
%12 = or i32 %8, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @bswap24(i32 %0) {
%2 = shl i32 %0, 16
%3 = and i32 %2, 16711680
%4 = and i32 %0, 65280
%5 = or i32 %3, %4
%6 = lshr i32 %0, 16
%7 = and i32 %6, 255
%8 = or i32 %5, %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ tipo2();
int main(void) {
  tipo2();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <tipo2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <tipo2@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @tipo2()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int sigemptyset(sigset_t *set) {
  (void)set;
  puts("sigemptyset: not implemented");
  return -1;
}


x86 assembly (clang, -O0):
<sigemptyset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [29 x i8] c"sigemptyset: not implemented\00"
define i32 @sigemptyset(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [29 x i8] c"sigemptyset: not implemented\00"
define i32 @sigemptyset(i32* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
void f1(const char *x, char *y) {
  while (*x != 0) {
    *y++ = *x++;
  }
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1143 <f1+0x43>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    110c <f1+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    (%rdi),%al
test   %al,%al
je     1120 <f1+0x20>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    %al,(%rsi,%rcx,1)
movzbl 0x1(%rdi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1110 <f1+0x10>
ret

LLVM IR (-O0):
define void @f1(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %10, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
store i8 %13, i8* %14
br label %5
16: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @f1(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %1, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %6, i8* %7
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret void
}
void displaycon_on(void) { (*((volatile unsigned long *)0x77100000)) |= 0x3; }


x86 assembly (clang, -O0):
<displaycon_on>:
push   %rbp
mov    %rsp,%rbp
mov    $0x77100000,%eax
mov    (%rax),%rcx
or     $0x3,%rcx
mov    $0x77100000,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<displaycon_on>:
orq    $0x3,0x77100000
77 03
ret

LLVM IR (-O0):
define void @displaycon_on() {
%1 = load volatile i64, i64* inttoptr (i64 1997537280 to i64*)
%2 = or i64 %1, 3
store volatile i64 %2, i64* inttoptr (i64 1997537280 to i64*)
ret void
}

LLVM IR (-O2):
define void @displaycon_on() {
%1 = load volatile i64, i64* inttoptr (i64 1997537280 to i64*)
%2 = or i64 %1, 3
store volatile i64 %2, i64* inttoptr (i64 1997537280 to i64*)
ret void
}
char f_mul(double *a, const double *b) {
  *a = (*a) * (*b);
  return (0);
}


x86 assembly (clang, -O0):
<f_mul>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_mul>:
movsd  (%rdi),%xmm0
mulsd  (%rsi),%xmm0
movsd  %xmm0,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define signext i8 @f_mul(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = load double, double* %5
%7 = load double*, double** %4
%8 = load double, double* %7
%9 = fmul double %6, %8
%10 = load double*, double** %3
store double %9, double* %10
ret i8 0
}

LLVM IR (-O2):
define signext i8 @f_mul(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fmul double %3, %4
store double %5, double* %0
ret i8 0
}
short fudgea(short b) {
  if (!b)
    return b;
  b |= 1;
  if (b > 2)
    b -= 2;
  return b;
}


x86 assembly (clang, -O0):
<fudgea>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x4(%rbp)
cmpw   $0x0,-0x4(%rbp)
jne    1123 <fudgea+0x23>
mov    -0x4(%rbp),%ax
mov    %ax,-0x2(%rbp)
jmp    114e <fudgea+0x4e>
movswl -0x4(%rbp),%eax
or     $0x1,%eax
mov    %ax,-0x4(%rbp)
movswl -0x4(%rbp),%eax
cmp    $0x2,%eax
jle    1146 <fudgea+0x46>
movswl -0x4(%rbp),%eax
sub    $0x2,%eax
mov    %ax,-0x4(%rbp)
mov    -0x4(%rbp),%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fudgea>:
mov    %edi,%eax
or     $0x1,%eax
lea    -0x2(%rax),%ecx
cmp    $0x3,%ax
cmovl  %eax,%ecx
xor    %eax,%eax
test   %di,%di
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define signext i16 @fudgea(i16 signext %0) {
%2 = icmp eq i16 %0, 0
%3 = or i16 %0, 1
%4 = icmp sgt i16 %3, 2
%5 = add i16 %3, -2
%6 = select i1 %4, i16 %5, i16 %3
%7 = select i1 %2, i16 0, i16 %6
ret i16 %7
}
int findPeakElement(int *nums, int numsSize) {
  int i;
  for (i = 1; i < numsSize; i++) {
    if (nums[i] < nums[i - 1]) {
      break;
    }
  }
  return i - 1;
}


x86 assembly (clang, -O0):
<findPeakElement>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <findPeakElement+0x57>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1144 <findPeakElement+0x44>
jmp    1157 <findPeakElement+0x57>
jmp    1149 <findPeakElement+0x49>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <findPeakElement+0x12>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<findPeakElement>:
mov    $0x1,%eax
cmp    $0x2,%esi
jl     1134 <findPeakElement+0x34>
mov    %esi,%ecx
mov    (%rdi),%edx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %edx,%esi
mov    (%rdi,%rax,4),%edx
cmp    %esi,%edx
jl     1134 <findPeakElement+0x34>
add    $0x1,%rax
cmp    %rax,%rcx
jne    1120 <findPeakElement+0x20>
mov    %ecx,%eax
add    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @findPeakElement(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = load i32, i32* %0
br label %7
7: ; preds = %4, %13
%8 = phi i32 [ %6, %4 ], [ %11, %13 ]
%9 = phi i64 [ 1, %4 ], [ %14, %13 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = icmp slt i32 %11, %8
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %5
br i1 %15, label %18, label %7
16: ; preds = %7
%17 = trunc i64 %9 to i32
br label %18
18: ; preds = %13, %16, %2
%19 = phi i32 [ 1, %2 ], [ %17, %16 ], [ %1, %13 ]
%20 = add nsw i32 %19, -1
ret i32 %20
}
/* Variables and functions */
short cos(short);
short internal_cos_s(short value) { return cos(value); }


x86 assembly (clang, -O0):
<internal_cos_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
movswl %ax,%edi
call   1030 <cos@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_cos_s>:
jmp    1030 <cos@plt>

LLVM IR (-O0):
define signext i16 @internal_cos_s(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call signext i16 @cos(i16 signext %3)
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @internal_cos_s(i16 signext %0) {
%2 = tail call signext i16 @cos(i16 signext %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char b[10];
  (void)strcpy(b, argv[1]);
  (void)printf("%s\n", b);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = call i32 @strcpy(i8* %4, i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
int main() {
  int *p = 0;
  p++;
  printf("%d", p);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* inttoptr (i64 4 to i32*))
ret i32 0
}
/* Variables and functions */
int sprintf(char *, char *, char *, char const *);
int print_flag(const char *flag, bool *need_or, char *val) {
  int res;
  res = sprintf(val, "%s%s", *need_or ? "|" : "", flag);
  *need_or |= true;
  return res;
}


x86 assembly (clang, -O0):
<print_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
lea    0xecf(%rip),%rdx
lea    0xec9(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    -0x8(%rbp),%rcx
lea    0xeb2(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_flag>:
push   %rbx
mov    %rdx,%rax
mov    %rsi,%rbx
mov    %rdi,%rcx
cmpl   $0x0,(%rsi)
lea    0xee0(%rip),%rsi
lea    0xeda(%rip),%rdx
cmove  %rsi,%rdx
lea    0xeca(%rip),%rsi
mov    %rax,%rdi
call   1030 <sprintf@plt>
orb    $0x1,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [2 x i8] c"|\00"
@.str.2 = [1 x i8] zeroinitializer
define i32 @print_flag(i8* %0, i32* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%14 = load i8*, i8** %4
%15 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
store i32 %15, i32* %7
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = or i32 %17, 1
store i32 %18, i32* %16
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [2 x i8] c"|\00"
@.str.2 = [1 x i8] zeroinitializer
define i32 @print_flag(i8* %0, i32* nocapture %1, i8* nocapture writeonly %2) {
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%7 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %0)
%8 = load i32, i32* %1
%9 = or i32 %8, 1
store i32 %9, i32* %1
ret i32 %7
}
/* Variables and functions */
void *memchr(const void *s, int c, size_t n) {
  const unsigned char *sp = s;
  while (n--) {
    if (*sp == (unsigned char)c)
      return (void *)sp;
    sp++;
  }
  return ((void *)0);
}


x86 assembly (clang, -O0):
<memchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
je     1163 <memchr+0x63>
mov    -0x28(%rbp),%rax
movzbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movzbl %cl,%ecx
cmp    %ecx,%eax
jne    1152 <memchr+0x52>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116b <memchr+0x6b>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1117 <memchr+0x17>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memchr>:
test   %rdx,%rdx
je     1122 <memchr+0x22>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
cmp    %sil,(%rax)
je     1124 <memchr+0x24>
add    $0xffffffffffffffff,%rdx
add    $0x1,%rax
test   %rdx,%rdx
jne    1110 <memchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @memchr(i8* %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = trunc i32 %1 to i8
br label %7
7: ; preds = %5, %13
%8 = phi i64 [ %2, %5 ], [ %10, %13 ]
%9 = phi i8* [ %0, %5 ], [ %14, %13 ]
%10 = add i64 %8, -1
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, %6
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = getelementptr inbounds i8, i8* %9, i64 1
%15 = icmp eq i64 %10, 0
br i1 %15, label %16, label %7
16: ; preds = %7, %13, %3
%17 = phi i8* [ null, %3 ], [ null, %13 ], [ %9, %7 ]
ret i8* %17
}
int console_printf(const char *fmt, ...) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @console_printf(i8* nocapture readnone %0, ...) {
ret i32 0
}
__attribute__((always_)) char *__strcpy(char *dst, const char *src) {
  int d0, d1, d2;
  asm volatile("1: lodsb;"
               "stosb;"
               "testb %%al, %%al;"
               "jne 1b;"
               : "=&S"(d0), "=&D"(d1), "=&a"(d2)
               : "0"(src), "1"(dst)
               : "memory");
  return dst;
}


x86 assembly (clang, -O0):
<__strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdi
lods   %ds:(%rsi),%al
stos   %al,%es:(%rdi)
test   %al,%al
jne    1114 <__strcpy+0x14>
mov    %esi,%ecx
mov    %ecx,-0x14(%rbp)
mov    %edi,%ecx
mov    %ecx,-0x18(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__strcpy>:
mov    %rdi,%rcx
lods   %ds:(%rsi),%al
stos   %al,%es:(%rdi)
test   %al,%al
jne    1103 <__strcpy+0x3>
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i8* @__strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %4
%9 = load i8*, i8** %3
%10 = call { i8*, i8*, i32 } asm sideeffect "1: lodsb;stosb;testb %al, %al;jne 1b;", "=&{si},=&{di},=&{ax},0,1,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %8, i8* %9)
%11 = extractvalue { i8*, i8*, i32 } %10, 0
%12 = extractvalue { i8*, i8*, i32 } %10, 1
%13 = extractvalue { i8*, i8*, i32 } %10, 2
%14 = ptrtoint i8* %11 to i64
%15 = trunc i64 %14 to i32
store i32 %15, i32* %5
%16 = ptrtoint i8* %12 to i64
%17 = trunc i64 %16 to i32
store i32 %17, i32* %6
store i32 %13, i32* %7
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @__strcpy(i8* returned %0, i8* %1) {
%3 = tail call { i8*, i8*, i32 } asm sideeffect "1: lodsb;stosb;testb %al, %al;jne 1b;", "=&{si},=&{di},=&{ax},0,1,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %1, i8* %0)
ret i8* %0
}
indreg0adr1(r0, r1, x0, x1, p0, p1) unsigned short r0, r1;
unsigned short *p0, *p1;
{
  if ((*p0) <= (*((unsigned short *)11111111)))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<indreg0adr1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movzwl (%rax),%eax
mov    $0xa98ac7,%ecx
movzwl (%rcx),%ecx
cmp    %ecx,%eax
jg     1142 <indreg0adr1+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1149 <indreg0adr1+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indreg0adr1>:
movzwl (%r8),%ecx
xor    %eax,%eax
cmp    0xa98ac7,%cx
setbe  %al
ret

LLVM IR (-O0):
define i32 @indreg0adr1(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i16*, i16** %12
%17 = load i16, i16* %16
%18 = zext i16 %17 to i32
%19 = load i16, i16* inttoptr (i64 11111111 to i16*)
%20 = zext i16 %19 to i32
%21 = icmp sle i32 %18, %20
br i1 %21, label %22, label %23
22: ; preds = %6
store i32 1, i32* %7
br label %24
23: ; preds = %6
store i32 0, i32* %7
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %7
ret i32 %25
}

LLVM IR (-O2):
define i32 @indreg0adr1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture %4, i16* nocapture readnone %5) {
%7 = load i16, i16* %4
%8 = load i16, i16* inttoptr (i64 11111111 to i16*)
%9 = icmp ule i16 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
int test_imm_D3uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xD3 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D3uint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x10,%rdx
and    $0xd3,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_D3uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 211
%7 = icmp ne i64 %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_D3uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 13828096
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
void fig09_23() {
  int x;
  int y;
  printf("%s", "Enter a six digit integer: \n");
  scanf("%2d%d", &x, &y);
  printf("The integers input were %d and %d\n", x, y);
}


x86 assembly (clang, -O0):
<fig09_23>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xecd(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [29 x i8] c"Enter a six digit integer: \0A\00"
@.str.2 = [6 x i8] c"%2d%d\00"
@.str.3 = [35 x i8] c"The integers input were %d and %d\0A\00"
define void @fig09_23() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str.2 = [6 x i8] c"%2d%d\00"
@.str.3 = [35 x i8] c"The integers input were %d and %d\0A\00"
@str = [28 x i8] c"Enter a six digit integer: \00"
define void @fig09_23() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %7, i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ memory_remove_entry(void *, char const *, int);
void memory_free(void *ptr, const char *srcname, int line) {
  memory_remove_entry(ptr, srcname, line);
  free(ptr);
}


x86 assembly (clang, -O0):
<memory_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memory_remove_entry@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memory_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <memory_remove_entry@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @memory_free(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
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @memory_remove_entry(i8* %7, i8* %8, i32 %9)
%11 = load i8*, i8** %4
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @memory_free(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @memory_remove_entry(i8* %0, i8* %1, i32 %2)
%5 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_parser_sourcefile(char *, char *);
int /*<<< orphan*/ test_parser_verify_parse(int /*<<< orphan*/, char *, char *,
                                            char *, int /*<<< orphan*/);
void test_dart_empty_comments() {
  test_parser_verify_parse(test_parser_sourcefile("dart", " //\n"), "dart", "",
                           "//\n", 0);
}


x86 assembly (clang, -O0):
<test_dart_empty_comments>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1030 <test_parser_sourcefile@plt>
mov    %eax,%edi
lea    0xec0(%rip),%rsi
lea    0xec2(%rip),%rdx
lea    0xeb8(%rip),%rcx
xor    %r8d,%r8d
call   1040 <test_parser_verify_parse@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_dart_empty_comments>:
push   %rbx
lea    0xed8(%rip),%rbx
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test_parser_sourcefile@plt>
lea    0xecb(%rip),%rdx
lea    0xec1(%rip),%rcx
mov    %eax,%edi
mov    %rbx,%rsi
xor    %r8d,%r8d
pop    %rbx
jmp    1040 <test_parser_verify_parse@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"dart\00"
@.str.1 = [5 x i8] c" //\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [4 x i8] c"//\0A\00"
define void @test_dart_empty_comments() {
%1 = call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"dart\00"
@.str.1 = [5 x i8] c" //\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [4 x i8] c"//\0A\00"
define void @test_dart_empty_comments() {
%1 = tail call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}
/* Variables and functions */
int dice(int, int);
int number_stat(void) { return (dice(5, 11) + 70); }


x86 assembly (clang, -O0):
<number_stat>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
mov    $0xb,%esi
call   1030 <dice@plt>
add    $0x46,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_stat>:
push   %rax
mov    $0x5,%edi
mov    $0xb,%esi
call   1030 <dice@plt>
add    $0x46,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @number_stat() {
%1 = call i32 @dice(i32 5, i32 11)
%2 = add nsw i32 %1, 70
ret i32 %2
}

LLVM IR (-O2):
define i32 @number_stat() {
%1 = tail call i32 @dice(i32 5, i32 11)
%2 = add nsw i32 %1, 70
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ P();
double get_counter();
int /*<<< orphan*/ start_counter();
double time_P_warm() {
  P();
  start_counter();
  P();
  return get_counter();
}


x86 assembly (clang, -O0):
<time_P_warm>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <P@plt>
mov    $0x0,%al
call   1040 <start_counter@plt>
mov    $0x0,%al
call   1030 <P@plt>
mov    $0x0,%al
call   1050 <get_counter@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_P_warm>:
push   %rax
xor    %eax,%eax
call   1030 <P@plt>
xor    %eax,%eax
call   1040 <start_counter@plt>
xor    %eax,%eax
call   1030 <P@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <get_counter@plt>

LLVM IR (-O0):
define double @time_P_warm() {
%1 = call i32 (...) @P()
%2 = call i32 (...) @start_counter()
%3 = call i32 (...) @P()
%4 = call double (...) @get_counter()
ret double %4
}

LLVM IR (-O2):
define double @time_P_warm() {
%1 = tail call i32 (...) @P()
%2 = tail call i32 (...) @start_counter()
%3 = tail call i32 (...) @P()
%4 = tail call double (...) @get_counter()
ret double %4
}