xunge/DecIR huggingface dataset:
/* Variables and functions */
char *strdup(char const *const);
void handle_error(char **errstring, const char *const message) {
  if (errstring) {
    *errstring = strdup(message);
  }
}


x86 assembly (clang, -O0):
<handle_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113e <handle_error+0x2e>
mov    -0x10(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_error>:
test   %rdi,%rdi
je     1125 <handle_error+0x15>
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <strdup@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @handle_error(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%5 = load i8**, i8*** %3
%6 = icmp ne i8** %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i8* @strdup(i8* %8)
%10 = load i8**, i8*** %3
store i8* %9, i8** %10
br label %11
11: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @handle_error(i8** writeonly %0, i8* nocapture %1) {
%3 = icmp eq i8** %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i8* @strdup(i8* %1)
store i8* %5, i8** %0
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
int newerf(char const *, char const *);
int olderf(const char *f1, const char *f2) { return (newerf(f2, f1)); }


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

x86 assembly (clang, -O2):
<olderf>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <newerf@plt>

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

LLVM IR (-O2):
define i32 @olderf(i8* %0, i8* %1) {
%3 = tail call i32 @newerf(i8* %1, i8* %0)
ret i32 %3
}
int main() { *((unsigned char *)58056) = 100; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe2c8,%eax
movb   $0x64,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movb   $0x64,0xe2c8
64
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
store i8 100, i8* inttoptr (i64 58056 to i8*)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
store i8 100, i8* inttoptr (i64 58056 to i8*)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ perror(char const *);
void PError(const char *msg) { perror(msg); }


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

x86 assembly (clang, -O2):
<PError>:
jmp    1030 <perror@plt>

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

LLVM IR (-O2):
define void @PError(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
ret void
}
void CFV2PrefixExtractorDestroy(void *arg) {}


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

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

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

LLVM IR (-O2):
define void @CFV2PrefixExtractorDestroy(i8* nocapture %0) {
ret void
}
/* Variables and functions */
unsigned long CRCdwCrc32(unsigned char *, unsigned int, unsigned long);
unsigned long CRCdwGetCrc32Ex(unsigned char *pbyData, unsigned int cbByte,
                              unsigned long dwPreCRC) {
  return CRCdwCrc32(pbyData, cbByte, dwPreCRC);
}


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

x86 assembly (clang, -O2):
<CRCdwGetCrc32Ex>:
jmp    1030 <CRCdwCrc32@plt>

LLVM IR (-O0):
define i64 @CRCdwGetCrc32Ex(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i64, i64* %6
%10 = call i64 @CRCdwCrc32(i8* %7, i32 %8, i64 %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @CRCdwGetCrc32Ex(i8* %0, i32 %1, i64 %2) {
%4 = tail call i64 @CRCdwCrc32(i8* %0, i32 %1, i64 %2)
ret i64 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int /*<<< orphan*/ handle_fatal_error(char *);
int msgget(int /*<<< orphan*/, int);
int get_msgq_id(key_t key) {
  int msgq_id;
  int msg_flag;
  msg_flag = 0666;
  msgq_id = msgget(key, msg_flag);
  if (msgq_id < 0) {
    handle_fatal_error("Error using msgget()\n");
  }
  return msgq_id;
}


x86 assembly (clang, -O0):
<get_msgq_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1b6,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <msgget@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1156 <get_msgq_id+0x36>
lea    0xeaf(%rip),%rdi
call   1040 <handle_fatal_error@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_msgq_id>:
push   %rbx
mov    $0x1b6,%esi
call   1030 <msgget@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    113d <get_msgq_id+0x1d>
lea    0xec8(%rip),%rdi
call   1040 <handle_fatal_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Error using msgget()\0A\00"
define i32 @get_msgq_id(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 438, i32* %4
%5 = load i32, i32* %2
%6 = load i32, i32* %4
%7 = call i32 @msgget(i32 %5, i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @handle_fatal_error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@.str = [22 x i8] c"Error using msgget()\0A\00"
define i32 @get_msgq_id(i32 %0) {
%2 = tail call i32 @msgget(i32 %0, i32 438)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @handle_fatal_error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i32 %2
}
void ls_costN_nm2_incref(void) {}


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

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

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

LLVM IR (-O2):
define void @ls_costN_nm2_incref() {
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t ReverseBits16(uint16_t val) {
  val = ((val >> 1) & 0x5555) | ((val << 1) & 0xaaaa);
  val = ((val >> 2) & 0x3333) | ((val << 2) & 0xcccc);
  val = ((val >> 4) & 0x0f0f) | ((val << 4) & 0xf0f0);
  val = ((val >> 8) & 0x00ff) | ((val << 8) & 0xff00);
  return val;
}


x86 assembly (clang, -O0):
<ReverseBits16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
and    $0x5555,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
and    $0xaaaa,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
and    $0x3333,%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
and    $0xcccc,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
and    $0xf0f,%eax
mov    -0x4(%rbp),%ecx
shl    $0x4,%ecx
and    $0xf0f0,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReverseBits16>:
rol    $0x8,%di
mov    %edi,%eax
and    $0xf0f,%eax
shl    $0x4,%eax
shr    $0x4,%edi
and    $0xf0f,%edi
or     %eax,%edi
mov    %edi,%eax
and    $0x3333,%eax
shr    $0x2,%edi
and    $0x3333,%edi
lea    (%rdi,%rax,4),%eax
mov    %eax,%ecx
and    $0x5555,%ecx
shr    %eax
and    $0x5555,%eax
lea    (%rax,%rcx,2),%eax
ret

LLVM IR (-O0):
define i32 @ReverseBits16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 1
%5 = and i32 %4, 21845
%6 = load i32, i32* %2
%7 = shl i32 %6, 1
%8 = and i32 %7, 43690
%9 = or i32 %5, %8
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = ashr i32 %10, 2
%12 = and i32 %11, 13107
%13 = load i32, i32* %2
%14 = shl i32 %13, 2
%15 = and i32 %14, 52428
%16 = or i32 %12, %15
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = ashr i32 %17, 4
%19 = and i32 %18, 3855
%20 = load i32, i32* %2
%21 = shl i32 %20, 4
%22 = and i32 %21, 61680
%23 = or i32 %19, %22
store i32 %23, i32* %2
%24 = load i32, i32* %2
%25 = ashr i32 %24, 8
%26 = and i32 %25, 255
%27 = load i32, i32* %2
%28 = shl i32 %27, 8
%29 = and i32 %28, 65280
%30 = or i32 %26, %29
store i32 %30, i32* %2
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @ReverseBits16(i32 %0) {
%2 = trunc i32 %0 to i16
%3 = tail call i16 @llvm.bitreverse.i16(i16 %2)
%4 = zext i16 %3 to i32
ret i32 %4
}
/* Type definitions */
struct event {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void printEnterMsg(void *stateData, struct event *event) {
  printf("Entering %s state\n", (char *)stateData);
}


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

x86 assembly (clang, -O2):
<printEnterMsg>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.event = type { i32 }
@.str = [19 x i8] c"Entering %s state\0A\00"
define void @printEnterMsg(i8* %0, %struct.event* %1) {
%3 = alloca i8*
%4 = alloca %struct.event*
store i8* %0, i8** %3
store %struct.event* %1, %struct.event** %4
%5 = load i8*, i8** %3
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
%struct.event = type { i32 }
@.str = [19 x i8] c"Entering %s state\0A\00"
define void @printEnterMsg(i8* %0, %struct.event* nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int foo(int *p) {
  int y = 0;
  if (p == 0) {
    if ((*((void **)&p)) == (void *)0)
      return 0;
    else
      return 5 / y;
  }
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1142 <foo+0x42>
cmpq   $0x0,-0x10(%rbp)
jne    1131 <foo+0x31>
movl   $0x0,-0x4(%rbp)
jmp    1149 <foo+0x49>
mov    $0x5,%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x4(%rbp)
jmp    1149 <foo+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo(i32* readnone %0) {
ret i32 0
}
int choose_opt(char opt) {}


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

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

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

LLVM IR (-O2):
define i32 @choose_opt(i8 signext %0) {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ pwrite(int, void const *, size_t, int /*<<< orphan*/);
ssize_t txc_libc_pwrite(int fd, const void *buf, size_t count, off_t offset) {
  return pwrite(fd, buf, count, offset);
}


x86 assembly (clang, -O0):
<txc_libc_pwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <pwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<txc_libc_pwrite>:
jmp    1030 <pwrite@plt>

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

LLVM IR (-O2):
define i32 @txc_libc_pwrite(i32 %0, i8* nocapture %1, i64 %2, i32 %3) {
%5 = tail call i32 @pwrite(i32 %0, i8* %1, i64 %2, i32 %3)
ret i32 %5
}
int sinal(double v) {
  if (v >= 0)
    return 1;
  return -1;
}


x86 assembly (clang, -O0):
<sinal>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1127 <sinal+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <sinal+0x2e>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinal>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setae  %al
add    %eax,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @sinal(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @sinal(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = select i1 %2, i32 -1, i32 1
ret i32 %3
}
/* Type definitions */
struct file {
  int dummy;
};

/* Variables and functions */
struct file *HsCreateFile();
struct file *fget(unsigned int fd) {
  struct file *f;
  f = HsCreateFile();
  return f;
}


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

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

LLVM IR (-O0):
%struct.file = type { i32 }
define %struct.file* @fget(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.file*
store i32 %0, i32* %2
%4 = call %struct.file* (...) @HsCreateFile()
store %struct.file* %4, %struct.file** %3
%5 = load %struct.file*, %struct.file** %3
ret %struct.file* %5
}

LLVM IR (-O2):
%struct.file = type { i32 }
define %struct.file* @fget(i32 %0) {
%2 = tail call %struct.file* (...) @HsCreateFile()
ret %struct.file* %2
}
int gcdEuclid(int m, int n) {
  if (n == 0)
    return m;
  else
    gcdEuclid(n, m % n);
}


x86 assembly (clang, -O0):
<gcdEuclid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <gcdEuclid+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <gcdEuclid+0x34>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <gcdEuclid@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcdEuclid>:
test   %esi,%esi
je     111b <gcdEuclid+0x1b>
mov    %esi,%edx
mov    %edi,%eax
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcdEuclid+0x10>
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @gcdEuclid(i32 returned %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret i32 %0
}
/* Variables and functions */
void mic_pull_free(double *data, size_t nelem, int device, int offload) {
#pragma offload_transfer target(mic                                            \
                                : device)                                      \
    out(data                                                                   \
        : length(nelem) alloc_if(0) free_if(1)) if (offload)
}


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

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

LLVM IR (-O0):
define void @mic_pull_free(double* %0, i64 %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store double* %0, double** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
define void @mic_pull_free(double* nocapture %0, i64 %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
char *zlibVersion();
void help(int exitval) {
  printf("untgz version 0.2.1\n"
         "  using zlib version %s\n\n",
         zlibVersion());
  printf("Usage: untgz file.tgz            extract all files\n"
         "       untgz file.tgz fname ...  extract selected files\n"
         "       untgz -l file.tgz         list archive contents\n"
         "       untgz -h                  display this help\n");
  exit(exitval);
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <zlibVersion@plt>
mov    %rax,%rsi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<help>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <zlibVersion@plt>
lea    0xeaf(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"untgz version 0.2.1\0A using zlib version %s\0A\0A\00"
@.str.1 = [214 x i8] c"Usage: untgz file.tgz extract all files\0A untgz file.tgz fname ... extract selected files\0A untgz -l file.tgz list archive contents\0A untgz -h display this help\0A\00"
define void @help(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i8* (...) @zlibVersion()
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([214 x i8], [214 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* %2
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@.str = [46 x i8] c"untgz version 0.2.1\0A using zlib version %s\0A\0A\00"
@str = [213 x i8] c"Usage: untgz file.tgz extract all files\0A untgz file.tgz fname ... extract selected files\0A untgz -l file.tgz list archive contents\0A untgz -h display this help\00"
define void @help(i32 %0) {
%2 = tail call i8* (...) @zlibVersion()
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([213 x i8], [213 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 %0)
unreachable
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int seq_cmp(void *a, void *b) {
  if (((uint32_t)(*(uint32_t *)b) - (uint32_t)(*(uint32_t *)a) < 0x80000000u)) {
    if (*(uint32_t *)a == *(uint32_t *)b)
      return 0;
    return -1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<seq_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
cmp    $0x80000000,%eax
jae    114d <seq_cmp+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jne    1141 <seq_cmp+0x41>
movl   $0x0,-0x4(%rbp)
jmp    1154 <seq_cmp+0x54>
movl   $0xffffffff,-0x4(%rbp)
jmp    1154 <seq_cmp+0x54>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<seq_cmp>:
mov    (%rsi),%eax
mov    (%rdi),%ecx
xor    %edx,%edx
cmp    %eax,%ecx
setne  %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovge %edx,%eax
ret

LLVM IR (-O0):
define i32 @seq_cmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = sub nsw i32 %8, %11
%13 = icmp ult i32 %12, -2147483648
br i1 %13, label %14, label %24
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = bitcast i8* %15 to i32*
%17 = load i32, i32* %16
%18 = load i8*, i8** %5
%19 = bitcast i8* %18 to i32*
%20 = load i32, i32* %19
%21 = icmp eq i32 %17, %20
br i1 %21, label %22, label %23
22: ; preds = %14
store i32 0, i32* %3
br label %25
23: ; preds = %14
store i32 -1, i32* %3
br label %25
24: ; preds = %2
store i32 1, i32* %3
br label %25
25: ; preds = %24, %23, %22
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @seq_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = icmp ne i32 %6, %4
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
void gtk_object_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_object_get_type() {
ret void
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ fork();
int /*<<< orphan*/ printf(char *);
int main() {
  pid_t pid = fork();
  if (pid == 0) {
    printf("child\n");
  } else {
    printf("parent\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <fork@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1156 <main+0x36>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
jmp    1162 <main+0x42>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <fork@plt>
test   %rax,%rax
lea    0xed5(%rip),%rax
lea    0xec7(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"child\0A\00"
@.str.1 = [8 x i8] c"parent\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i64 (...) @fork()
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
ret i32 0
}

LLVM IR (-O2):
@str = [7 x i8] c"parent\00"
@str.2 = [6 x i8] c"child\00"
define i32 @main() {
%1 = tail call i64 (...) @fork()
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ notify_pvcall(char *);
int pvSetWaitTimes(char byBoardNum, double dMasterClock, double dDiskingWait,
                   double dParallelWait, double dAfterExposureWait,
                   double dPixPeriod, double dFlushPixPeriod) {
  notify_pvcall("f");
  return (0);
}


x86 assembly (clang, -O0):
<pvSetWaitTimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <notify_pvcall@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pvSetWaitTimes>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <notify_pvcall@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"f\00"
define i32 @pvSetWaitTimes(i8 signext %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = alloca i8
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store i8 %0, i8* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
store double %6, double* %14
%15 = call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"f\00"
define i32 @pvSetWaitTimes(i8 signext %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = tail call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void function() {
  int stack_var;
  printf("the function's stack_var is at address 0x%08x\n", &stack_var);
}


x86 assembly (clang, -O0):
<function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [47 x i8] c"the function's stack_var is at address 0x%08x\0A\00"
define void @function() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32* %1)
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"the function's stack_var is at address 0x%08x\0A\00"
define void @function() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32* %1)
ret void
}
void X509_get_ext_by_NID(void) {}


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

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

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

LLVM IR (-O2):
define void @X509_get_ext_by_NID() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_cpu_header(char const *, int);
void default_pstate_cpu_header(const char *cpu,
                               __attribute__((unused)) void *report_data) {
  default_cpu_header(cpu, 64);
}


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

x86 assembly (clang, -O2):
<default_pstate_cpu_header>:
mov    $0x40,%esi
jmp    1030 <default_cpu_header@plt>

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

LLVM IR (-O2):
define void @default_pstate_cpu_header(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @default_cpu_header(i8* %0, i32 64)
ret void
}
void MergeUVRow_NEON() {}


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

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

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

LLVM IR (-O2):
define void @MergeUVRow_NEON() {
ret void
}
/* Variables and functions */
double asin(int /*<<< orphan*/);
int /*<<< orphan*/ luaL_check_number(int);
int /*<<< orphan*/ lua_pushnumber(double);
void math_asin(void) {
  lua_pushnumber(
      ((asin(luaL_check_number(1))) / ((3.14159265358979323846) / 180.0)));
}


x86 assembly (clang, -O0):
<math_asin>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <luaL_check_number@plt>
mov    %eax,%edi
call   1050 <asin@plt>
movsd  0xeb3(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <lua_pushnumber@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_asin>:
push   %rax
mov    $0x1,%edi
call   1030 <luaL_check_number@plt>
mov    %eax,%edi
call   1050 <asin@plt>
divsd  0xeb6(%rip),%xmm0
pop    %rax
jmp    1040 <lua_pushnumber@plt>

LLVM IR (-O0):
define void @math_asin() {
%1 = call i32 @luaL_check_number(i32 1)
%2 = call double @asin(i32 %1)
%3 = fdiv double %2, 0x3F91DF46A2529D39
%4 = call i32 @lua_pushnumber(double %3)
ret void
}

LLVM IR (-O2):
define void @math_asin() {
%1 = tail call i32 @luaL_check_number(i32 1)
%2 = tail call double @asin(i32 %1)
%3 = fdiv double %2, 0x3F91DF46A2529D39
%4 = tail call i32 @lua_pushnumber(double %3)
ret void
}
int re_match(bufp, string, size, pos, regs) const
    struct re_pattern_buffer *bufp;
const char *string;
int size, pos;
struct re_registers *regs;
{
  return re_match_2(bufp, 0, 0, string, size, pos, regs, size);
}


x86 assembly (clang, -O0):
<re_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    -0x20(%rbp),%r10
mov    -0x14(%rbp),%eax
xor    %edx,%edx
mov    %edx,%esi
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <re_match_2@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<re_match>:
push   %rax
mov    %r8,%r10
mov    %ecx,%r9d
mov    %edx,%r8d
mov    %rsi,%rcx
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
push   %r8
push   %r10
call   1030 <re_match_2@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
%struct.re_pattern_buffer = type opaque
%struct.re_registers = type opaque
define i32 @re_match(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i32 %3, %struct.re_registers* %4) {
%6 = alloca %struct.re_pattern_buffer*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.re_registers*
store %struct.re_pattern_buffer* %0, %struct.re_pattern_buffer** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store %struct.re_registers* %4, %struct.re_registers** %10
%11 = load %struct.re_pattern_buffer*, %struct.re_pattern_buffer** %6
%12 = load i8*, i8** %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load %struct.re_registers*, %struct.re_registers** %10
%16 = load i32, i32* %8
%17 = call i32 (%struct.re_pattern_buffer*, i32, i32, i8*, i32, i32, %struct.re_registers*, i32, ...) bitcast (i32 (...)* @re_match_2 to i32 (%struct.re_pattern_buffer*, i32, i32, i8*, i32, i32, %struct.re_registers*, i32, ...)*)(%struct.re_pattern_buffer* %11, i32 0, i32 0, i8* %12, i32 %13, i32 %14, %struct.re_registers* %15, i32 %16)
ret i32 %17
}

LLVM IR (-O2):
%struct.re_pattern_buffer = type opaque
%struct.re_registers = type opaque
define i32 @re_match(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i32 %3, %struct.re_registers* %4) {
%6 = tail call i32 (%struct.re_pattern_buffer*, i32, i32, i8*, i32, i32, %struct.re_registers*, i32, ...) bitcast (i32 (...)* @re_match_2 to i32 (%struct.re_pattern_buffer*, i32, i32, i8*, i32, i32, %struct.re_registers*, i32, ...)*)(%struct.re_pattern_buffer* %0, i32 0, i32 0, i8* %1, i32 %2, i32 %3, %struct.re_registers* %4, i32 %2)
ret i32 %6
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ pthread_mutex_t;
typedef int /*<<< orphan*/ pthread_cond_t;

/* Variables and functions */
int pthread_cond_timedwait_relative_np(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *,
                                       struct timespec const *);
int _pthread_cond_timedwait_relative(pthread_cond_t *cond,
                                     pthread_mutex_t *mutex,
                                     const struct timespec *reltime) {
  return pthread_cond_timedwait_relative_np(cond, mutex, reltime);
}


x86 assembly (clang, -O0):
<_pthread_cond_timedwait_relative>:
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 <pthread_cond_timedwait_relative_np@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_pthread_cond_timedwait_relative>:
jmp    1030 <pthread_cond_timedwait_relative_np@plt>

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

LLVM IR (-O2):
%struct.timespec = type { i32 }
define i32 @_pthread_cond_timedwait_relative(i32* %0, i32* %1, %struct.timespec* %2) {
%4 = tail call i32 @pthread_cond_timedwait_relative_np(i32* %0, i32* %1, %struct.timespec* %2)
ret i32 %4
}
cbuf7(f, n) { return (cbuf(f, n, 7)); }


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

x86 assembly (clang, -O2):
<cbuf7>:
mov    $0x7,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf7(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 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %5, i32 %6, i32 7)
ret i32 %7
}

LLVM IR (-O2):
define i32 @cbuf7(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 7)
ret i32 %3
}
/* Variables and functions */
scalar_t__ memmove(char *, char *, scalar_t__);
scalar_t__ strlen(char *);
int strspn(char *, char const *);
char *trim_left_inplace(char *s, const char *delimiters) {
  char *p = s + strspn(s, delimiters);
  return (char *)memmove(s, p, strlen(p) + 1);
}


x86 assembly (clang, -O0):
<trim_left_inplace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strspn@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <memmove@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim_left_inplace>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strspn@plt>
movslq %eax,%rbx
add    %r14,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <memmove@plt>

LLVM IR (-O0):
define i8* @trim_left_inplace(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 @strspn(i8* %7, i8* %8)
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %6, i64 %10
store i8* %11, i8** %5
%12 = load i8*, i8** %3
%13 = load i8*, i8** %5
%14 = load i8*, i8** %5
%15 = call i64 @strlen(i8* %14)
%16 = add nsw i64 %15, 1
%17 = call i64 @memmove(i8* %12, i8* %13, i64 %16)
%18 = inttoptr i64 %17 to i8*
ret i8* %18
}

LLVM IR (-O2):
define i8* @trim_left_inplace(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @strspn(i8* %0, i8* %1)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i64 @strlen(i8* dereferenceable(1) %5)
%7 = add nsw i64 %6, 1
%8 = tail call i64 @memmove(i8* %0, i8* %5, i64 %7)
%9 = inttoptr i64 %8 to i8*
ret i8* %9
}
int rcv_key() {
  int status;
  long retval;
  while (((status = *(volatile unsigned long *)((void *)0xfffc4000 + 0x14)) &
          0x01) == 0) {
  }
  retval = *(volatile unsigned long *)((void *)0xfffc4000 + 0x18);
  if (status & 0x80) {
    retval |= 0x100;
    *(volatile unsigned long *)((void *)0xfffc4000 + 0x00) = 0x100;
  }
  return retval;
}


x86 assembly (clang, -O0):
<rcv_key>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffc4000,%eax
mov    0x14(%rax),%rax
mov    %eax,-0x4(%rbp)
and    $0x1,%eax
cmp    $0x0,%eax
jne    1121 <rcv_key+0x21>
jmp    1104 <rcv_key+0x4>
mov    $0xfffc4000,%eax
mov    0x18(%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1159 <rcv_key+0x59>
mov    -0x10(%rbp),%rax
or     $0x100,%rax
mov    %rax,-0x10(%rbp)
mov    $0xfffc4000,%eax
movq   $0x100,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rcv_key>:
mov    $0xfffc4000,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x14(%rcx),%rdx
test   $0x1,%dl
je     1110 <rcv_key+0x10>
mov    0x18(%rcx),%rax
test   $0x80,%dl
je     112f <rcv_key+0x2f>
or     $0x100,%rax
movq   $0x100,(%rcx)
ret

LLVM IR (-O0):
define i32 @rcv_key() {
%1 = alloca i32
%2 = alloca i64
br label %3
3: ; preds = %8, %0
%4 = load volatile i64, i64* bitcast (i8* getelementptr (i8, i8* inttoptr (i64 4294721536 to i8*), i64 20) to i64*)
%5 = trunc i64 %4 to i32
store i32 %5, i32* %1
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %3
br label %3
9: ; preds = %3
%10 = load volatile i64, i64* bitcast (i8* getelementptr (i8, i8* inttoptr (i64 4294721536 to i8*), i64 24) to i64*)
store i64 %10, i64* %2
%11 = load i32, i32* %1
%12 = and i32 %11, 128
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i64, i64* %2
%16 = or i64 %15, 256
store i64 %16, i64* %2
store volatile i64 256, i64* inttoptr (i64 4294721536 to i64*)
br label %17
17: ; preds = %14, %9
%18 = load i64, i64* %2
%19 = trunc i64 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @rcv_key() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i64, i64* inttoptr (i64 4294721556 to i64*)
%3 = and i64 %2, 1
%4 = icmp eq i64 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
%6 = load volatile i64, i64* inttoptr (i64 4294721560 to i64*)
%7 = and i64 %2, 128
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = or i64 %6, 256
store volatile i64 256, i64* inttoptr (i64 4294721536 to i64*)
br label %11
11: ; preds = %9, %5
%12 = phi i64 [ %10, %9 ], [ %6, %5 ]
%13 = trunc i64 %12 to i32
ret i32 %13
}
int ifelseStatementFunction() {
  auto int n;
  auto int m;
  if (m > n) {
    return n;
  } else {
    return m;
  }
}


x86 assembly (clang, -O0):
<ifelseStatementFunction>:
push   %rbp
mov    %rsp,%rbp
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    111b <ifelseStatementFunction+0x1b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1121 <ifelseStatementFunction+0x21>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @ifelseStatementFunction() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello_(void) { printf("Hello SubWorld 1\n"); }


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

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

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

LLVM IR (-O2):
@str = [17 x i8] c"Hello SubWorld 1\00"
define void @hello_() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret void
}
double round_double_llong(double a) { return (double)(long long)a; }


x86 assembly (clang, -O0):
<round_double_llong>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%rax
cvtsi2sd %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_double_llong>:
cvttsd2si %xmm0,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
ret

LLVM IR (-O0):
define double @round_double_llong(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i64
%5 = sitofp i64 %4 to double
ret double %5
}

LLVM IR (-O2):
define double @round_double_llong(double %0) {
%2 = fptosi double %0 to i64
%3 = sitofp i64 %2 to double
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_89() {
  Assert_real((isqrt(89) == 9),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              450, ("Integer square root of 89 should be 9"));
}


x86 assembly (clang, -O0):
<t_sqrt_89>:
push   %rbp
mov    %rsp,%rbp
mov    $0x59,%edi
call   1030 <isqrt@plt>
cmp    $0x9,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x1c2,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_89>:
push   %rax
mov    $0x59,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0x9,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x1c2,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [38 x i8] c"Integer square root of 89 should be 9\00"
define void @t_sqrt_89() {
%1 = call i32 @isqrt(i32 89)
%2 = icmp eq i32 %1, 9
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 450, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [38 x i8] c"Integer square root of 89 should be 9\00"
define void @t_sqrt_89() {
%1 = tail call i32 @isqrt(i32 89)
%2 = icmp eq i32 %1, 9
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 450, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ execvp(char *, char *, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  execvp("/bin/sh", "/bin/sh", NULL);
  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)
lea    0xed3(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1030 <execvp@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"/bin/sh\00"
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 = call i32 @execvp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @execvp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 0
}
/* Variables and functions */
int read(int, void *, size_t);
int sock_read(int fd, void *buf, size_t size) {
  int ret;
  ret = read(fd, buf, size);
  if (ret == -1) {
    ret = 0;
  }
  return ret;
}


x86 assembly (clang, -O0):
<sock_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1147 <sock_read+0x37>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_read>:
push   %rax
call   1030 <read@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
cmove  %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @sock_read(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i32 %4, -1
%6 = select i1 %5, i32 0, i32 %4
ret i32 %6
}
/* Variables and functions */
char *_y4m_alloc(int);
char *y4m_new_xtag(void) { return _y4m_alloc(32); }


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

x86 assembly (clang, -O2):
<y4m_new_xtag>:
mov    $0x20,%edi
jmp    1030 <_y4m_alloc@plt>

LLVM IR (-O0):
define i8* @y4m_new_xtag() {
%1 = call i8* @_y4m_alloc(i32 32)
ret i8* %1
}

LLVM IR (-O2):
define i8* @y4m_new_xtag() {
%1 = tail call i8* @_y4m_alloc(i32 32)
ret i8* %1
}