xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void usage(void) {
  fputs("usage: head [-count | -n count] [file ...]\n", stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"usage: head [-count | -n count] [file ...]\0A\00"
@stderr = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [44 x i8] c"usage: head [-count | -n count] [file ...]\0A\00"
@stderr = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @exit(i32 1)
unreachable
}
double Sum_S(int i, double **delta) { return (delta[i][i]); }


x86 assembly (clang, -O0):
<Sum_S>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sum_S>:
movslq %edi,%rax
mov    (%rsi,%rax,8),%rcx
movsd  (%rcx,%rax,8),%xmm0
ret

LLVM IR (-O0):
define double @Sum_S(i32 %0, double** %1) {
%3 = alloca i32
%4 = alloca double**
store i32 %0, i32* %3
store double** %1, double*** %4
%5 = load double**, double*** %4
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds double*, double** %5, i64 %7
%9 = load double*, double** %8
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds double, double* %9, i64 %11
%13 = load double, double* %12
ret double %13
}

LLVM IR (-O2):
define double @Sum_S(i32 %0, double** nocapture %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds double*, double** %1, i64 %3
%5 = load double*, double** %4
%6 = getelementptr inbounds double, double* %5, i64 %3
%7 = load double, double* %6
ret double %7
}
int b6b_offload(struct b6b_interp *interp, void (*fn)(void *), void *arg) {
  fn(arg);
  return 1;
}


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

x86 assembly (clang, -O2):
<b6b_offload>:
push   %rax
mov    %rdx,%rdi
call   *%rsi
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.b6b_interp = type opaque
define i32 @b6b_offload(%struct.b6b_interp* %0, void (i8*)* %1, i8* %2) {
%4 = alloca %struct.b6b_interp*
%5 = alloca void (i8*)*
%6 = alloca i8*
store %struct.b6b_interp* %0, %struct.b6b_interp** %4
store void (i8*)* %1, void (i8*)** %5
store i8* %2, i8** %6
%7 = load void (i8*)*, void (i8*)** %5
%8 = load i8*, i8** %6
ret i32 1
}

LLVM IR (-O2):
%struct.b6b_interp = type opaque
define i32 @b6b_offload(%struct.b6b_interp* nocapture readnone %0, void (i8*)* nocapture %1, i8* %2) {
tail call void %1(i8* %2)
ret i32 1
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC_COARSE;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
void gethrestime(struct timespec *ts) {
  clock_gettime(CLOCK_MONOTONIC_COARSE, ts);
}


x86 assembly (clang, -O0):
<gethrestime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gethrestime>:
mov    %rdi,%rsi
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
jmp    1030 <clock_gettime@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC_COARSE = global i32 0
define void @gethrestime(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load i32, i32* @CLOCK_MONOTONIC_COARSE
%4 = load %struct.timespec*, %struct.timespec** %2
%5 = call i32 @clock_gettime(i32 %3, %struct.timespec* %4)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC_COARSE = global i32 0
define void @gethrestime(%struct.timespec* %0) {
%2 = load i32, i32* @CLOCK_MONOTONIC_COARSE
%3 = tail call i32 @clock_gettime(i32 %2, %struct.timespec* %0)
ret void
}
int op_shr(int a, int b) { return a >> b; }


x86 assembly (clang, -O0):
<op_shr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_shr>:
mov    %esi,%ecx
mov    %edi,%eax
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @op_shr(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 = ashr i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @op_shr(i32 %0, i32 %1) {
%3 = ashr i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void blk_begin(void) { printf("{"); }


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

x86 assembly (clang, -O2):
<blk_begin>:
mov    $0x7b,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @blk_begin() {
%1 = tail call i32 @putchar(i32 123)
ret void
}
regx0reg1(r0, r1, x0, x1, p0, p1) double r0, r1;
double *p0, *p1;
{
  if ((p0[x0]) <= r1)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<regx0reg1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1144 <regx0reg1+0x44>
movl   $0x1,-0x4(%rbp)
jmp    114b <regx0reg1+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<regx0reg1>:
movslq %edi,%rcx
xor    %eax,%eax
ucomisd (%rdx,%rcx,8),%xmm1
setae  %al
ret

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

LLVM IR (-O2):
define i32 @regx0reg1(double %0, double %1, i32 %2, i32 %3, double* nocapture %4, double* nocapture readnone %5) {
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds double, double* %4, i64 %7
%9 = load double, double* %8
%10 = fcmp ole double %9, %1
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
unsigned char tolower(unsigned char);
unsigned char HX_tolower(unsigned char c) { return tolower(c); }


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

x86 assembly (clang, -O2):
<HX_tolower>:
jmp    1030 <tolower@plt>

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

LLVM IR (-O2):
define zeroext i8 @HX_tolower(i8 zeroext %0) {
%2 = tail call zeroext i8 @tolower(i8 zeroext %0)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ cc3_timer_wait_ms(int);
void _cc3_camera_reset() {
  (*(volatile unsigned long *)((0x3FFFC01C))) = 0x2000;
  cc3_timer_wait_ms(1);
  (*(volatile unsigned long *)((0x3FFFC018))) = 0x2000;
  cc3_timer_wait_ms(1);
}


x86 assembly (clang, -O0):
<_cc3_camera_reset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3fffc01c,%eax
movq   $0x2000,(%rax)
mov    $0x1,%edi
call   1030 <cc3_timer_wait_ms@plt>
mov    $0x3fffc018,%eax
movq   $0x2000,(%rax)
mov    $0x1,%edi
call   1030 <cc3_timer_wait_ms@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cc3_camera_reset>:
push   %rax
movq   $0x2000,0x3fffc01c
mov    $0x1,%edi
call   1030 <cc3_timer_wait_ms@plt>
movq   $0x2000,0x3fffc018
mov    $0x1,%edi
pop    %rax
jmp    1030 <cc3_timer_wait_ms@plt>

LLVM IR (-O0):
define void @_cc3_camera_reset() {
store volatile i64 8192, i64* inttoptr (i64 1073725468 to i64*)
%1 = call i32 @cc3_timer_wait_ms(i32 1)
store volatile i64 8192, i64* inttoptr (i64 1073725464 to i64*)
%2 = call i32 @cc3_timer_wait_ms(i32 1)
ret void
}

LLVM IR (-O2):
define void @_cc3_camera_reset() {
store volatile i64 8192, i64* inttoptr (i64 1073725468 to i64*)
%1 = tail call i32 @cc3_timer_wait_ms(i32 1)
store volatile i64 8192, i64* inttoptr (i64 1073725464 to i64*)
%2 = tail call i32 @cc3_timer_wait_ms(i32 1)
ret void
}
unsigned char *emit_sse_get_sign_mask() {
  static unsigned char bufx[32];
  unsigned char *buf = bufx + 1;
  while ((long)buf % 16)
    buf++;
  unsigned long long *bit_mask = (unsigned long long *)buf;
  *bit_mask = (unsigned long long)1 << 63;
  return buf;
}


x86 assembly (clang, -O0):
<emit_sse_get_sign_mask>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f25(%rip),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x10,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
je     113c <emit_sse_get_sign_mask+0x3c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <emit_sse_get_sign_mask+0x13>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movabs $0x8000000000000000,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_sse_get_sign_mask>:
movabs $0x8000000000000000,%rax
mov    %rax,0x2f2f(%rip)
lea    0x2f28(%rip),%rax
ret

LLVM IR (-O0):
@emit_sse_get_sign_mask.bufx = internal global [32 x i8] zeroinitializer
define i8* @emit_sse_get_sign_mask() {
%1 = alloca i8*
%2 = alloca i64*
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @emit_sse_get_sign_mask.bufx, i64 0, i64 1), i8** %1
br label %3
3: ; preds = %8, %0
%4 = load i8*, i8** %1
%5 = ptrtoint i8* %4 to i64
%6 = srem i64 %5, 16
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i8*, i8** %1
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %1
br label %3
11: ; preds = %3
%12 = load i8*, i8** %1
%13 = bitcast i8* %12 to i64*
store i64* %13, i64** %2
%14 = load i64*, i64** %2
store i64 -9223372036854775808, i64* %14
%15 = load i8*, i8** %1
ret i8* %15
}

LLVM IR (-O2):
@emit_sse_get_sign_mask.bufx = internal global [32 x i8] zeroinitializer
define i8* @emit_sse_get_sign_mask() {
store i64 -9223372036854775808, i64* bitcast (i8* getelementptr inbounds ([32 x i8], [32 x i8]* @emit_sse_get_sign_mask.bufx, i64 0, i64 16) to i64*)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @emit_sse_get_sign_mask.bufx, i64 0, i64 16)
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ replacement(int /*<<< orphan*/ *);
int main(void) {
  FILE *fp = fopen("db", "rb");
  replacement(fp);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xeb6(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <replacement@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xec4(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <replacement@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"db\00"
@.str.1 = [3 x i8] c"rb\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @replacement(i32* %1)
%3 = tail call i32 @fclose(i32* %1)
ret i32 0
}
void ap94_pci_enable_quirk_wndr3700(void) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @ap94_pci_enable_quirk_wndr3700() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fat();
void fat_command(void) { fat(); }


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

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

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

LLVM IR (-O2):
define void @fat_command() {
%1 = tail call i32 (...) @fat()
ret void
}
char Ints2Char(const char *src) { return (src[0] - '0') * 10 + (src[1] - '0'); }


x86 assembly (clang, -O0):
<Ints2Char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
imul   $0xa,%eax,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ints2Char>:
movzbl (%rdi),%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
add    0x1(%rdi),%al
add    $0xf0,%al
ret

LLVM IR (-O0):
define signext i8 @Ints2Char(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %6, 48
%8 = mul nsw i32 %7, 10
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = sub nsw i32 %12, 48
%14 = add nsw i32 %8, %13
%15 = trunc i32 %14 to i8
ret i8 %15
}

LLVM IR (-O2):
define signext i8 @Ints2Char(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = mul i8 %2, 10
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = add i8 %5, -16
%7 = add i8 %6, %3
ret i8 %7
}
/* Type definitions */
struct rq_money {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct rq_money *);
int /*<<< orphan*/ rq_money_clear(struct rq_money *);
void rq_money_free(struct rq_money *p) {
  rq_money_clear(p);
  free(p);
}


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

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

LLVM IR (-O0):
%struct.rq_money = type { i32 }
define void @rq_money_free(%struct.rq_money* %0) {
%2 = alloca %struct.rq_money*
store %struct.rq_money* %0, %struct.rq_money** %2
%3 = load %struct.rq_money*, %struct.rq_money** %2
%4 = call i32 @rq_money_clear(%struct.rq_money* %3)
%5 = load %struct.rq_money*, %struct.rq_money** %2
%6 = call i32 @free(%struct.rq_money* %5)
ret void
}

LLVM IR (-O2):
%struct.rq_money = type { i32 }
define void @rq_money_free(%struct.rq_money* %0) {
%2 = tail call i32 @rq_money_clear(%struct.rq_money* %0)
%3 = tail call i32 @free(%struct.rq_money* %0)
ret void
}
/* Variables and functions */
scalar_t__ malloc(size_t);
void *sdtools_malloc(size_t size) {
  if (!size)
    return (void *)0;
  return (void *)malloc(size);
}


x86 assembly (clang, -O0):
<sdtools_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <sdtools_malloc+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1141 <sdtools_malloc+0x31>
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdtools_malloc>:
test   %rdi,%rdi
je     1120 <sdtools_malloc+0x10>
push   %rax
call   1030 <malloc@plt>
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @sdtools_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i64 @malloc(i64 %0)
%5 = inttoptr i64 %4 to i8*
br label %6
6: ; preds = %1, %3
%7 = phi i8* [ %5, %3 ], [ null, %1 ]
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main() {
  int a, b, i, z;
  a = 20;
  b = 30;
  i = (a++, b + 4);
  z = a--, b + 20;
  printf("%d %d %d %d\n", a, b, i, z);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
movl   $0x1e,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"%d %d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 20, i32* %2
store i32 30, i32* %3
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 4
store i32 %9, i32* %4
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
store i32 %10, i32* %5
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 20
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15, i32 %16, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"%d %d %d %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 20, i32 30, i32 34, i32 21)
ret i32 0
}
int foo(int i) {
  int a[32];
  a[1] = 3;
  a[0] = 1;
  a[i] = 2;
  return a[0];
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x3,-0x8c(%rbp)
movl   $0x1,-0x90(%rbp)
movslq -0x4(%rbp),%rax
movl   $0x2,-0x90(%rbp,%rax,4)
mov    -0x90(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
movl   $0x1,-0x80(%rsp)
movslq %edi,%rax
movl   $0x2,-0x80(%rsp,%rax,4)
mov    -0x80(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca [32 x i32]
store i32 %0, i32* %2
%4 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 1
store i32 3, i32* %4
%5 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
store i32 1, i32* %5
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 %7
store i32 2, i32* %8
%9 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
%10 = load i32, i32* %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = alloca [32 x i32]
%3 = bitcast [32 x i32]* %2 to i8*
%4 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
store i32 1, i32* %4
%5 = sext i32 %0 to i64
%6 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 %5
store i32 2, i32* %6
%7 = load i32, i32* %4
ret i32 %7
}
int isEmptyCQ(int *front, int *rear) {
  if (*front == -1)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isEmptyCQ>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    1125 <isEmptyCQ+0x25>
movl   $0x1,-0x4(%rbp)
jmp    112c <isEmptyCQ+0x2c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isEmptyCQ>:
xor    %eax,%eax
cmpl   $0xffffffff,(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @isEmptyCQ(i32* nocapture %0, i32* nocapture readnone %1) {
%3 = load i32, i32* %0
%4 = icmp eq i32 %3, -1
%5 = zext i1 %4 to i32
ret i32 %5
}
void gtk_window_new() {}


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

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

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

LLVM IR (-O2):
define void @gtk_window_new() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ int80(int, int, int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/);
void setTimeZone(int tz) { int80(5, tz, 0, 0, 0, 0, 0); }


x86 assembly (clang, -O0):
<setTimeZone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x5,%edi
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
call   1030 <int80@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setTimeZone>:
push   %rax
mov    %edi,%esi
movl   $0x0,(%rsp)
mov    $0x5,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <int80@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @setTimeZone(i32 %0) {
%2 = tail call i32 @int80(i32 5, i32 %0, i32 0, i32 0, i32 0, i32 0, i32 0)
ret void
}
int ubi_debugfs_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ubi_debugfs_init() {
ret i32 0
}
int ti_tema_start(double const *options) {
  const int period = (int)options[0];
  return (period - 1) * 3;
}


x86 assembly (clang, -O0):
<ti_tema_start>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cvttsd2si (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
imul   $0x3,%eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ti_tema_start>:
cvttsd2si (%rdi),%eax
lea    (%rax,%rax,2),%eax
add    $0xfffffffd,%eax
ret

LLVM IR (-O0):
define i32 @ti_tema_start(double* %0) {
%2 = alloca double*
%3 = alloca i32
store double* %0, double** %2
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 0
%6 = load double, double* %5
%7 = fptosi double %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 1
%10 = mul nsw i32 %9, 3
ret i32 %10
}

LLVM IR (-O2):
define i32 @ti_tema_start(double* nocapture %0) {
%2 = load double, double* %0
%3 = fptosi double %2 to i32
%4 = mul i32 %3, 3
%5 = add i32 %4, -3
ret i32 %5
}
/* Variables and functions */
int dcloadsyscall(int, char const *, char *);
int utime(const char *path, char *times) {
  if (*(unsigned int *)0x8c004004 == 0xdeadbeef)
    return dcloadsyscall(13, path, times);
  else
    return -1;
}


x86 assembly (clang, -O0):
<utime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x8c004004,%eax
cmpl   $0xdeadbeef,(%rax)
jne    114b <utime+0x3b>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0xd,%edi
call   1030 <dcloadsyscall@plt>
mov    %eax,-0x4(%rbp)
jmp    1152 <utime+0x42>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utime>:
mov    $0x8c004004,%eax
cmpl   $0xdeadbeef,(%rax)
jne    112d <utime+0x1d>
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0xd,%edi
jmp    1030 <dcloadsyscall@plt>
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @utime(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 i32, i32* inttoptr (i64 2348826628 to i32*)
%7 = icmp eq i32 %6, -559038737
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i32 @dcloadsyscall(i32 13, i8* %9, i8* %10)
store i32 %11, i32* %3
br label %13
12: ; preds = %2
store i32 -1, i32* %3
br label %13
13: ; preds = %12, %8
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @utime(i8* %0, i8* %1) {
%3 = load i32, i32* inttoptr (i64 2348826628 to i32*)
%4 = icmp eq i32 %3, -559038737
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @dcloadsyscall(i32 13, i8* %0, i8* %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ -1, %2 ]
ret i32 %8
}
int toascii(int c) { return c & 0177; }


x86 assembly (clang, -O0):
<toascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toascii>:
mov    %edi,%eax
and    $0x7f,%eax
ret

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

LLVM IR (-O2):
define i32 @toascii(i32 %0) {
%2 = and i32 %0, 127
ret i32 %2
}
int cmdcmp(int *a, int *b, int size) {
  int i;
  for (i = 0; i < size; i++) {
    if (a[i] != b[i])
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<cmdcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    115d <cmdcmp+0x5d>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     114a <cmdcmp+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1164 <cmdcmp+0x64>
jmp    114f <cmdcmp+0x4f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <cmdcmp+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdcmp>:
test   %edx,%edx
jle    1121 <cmdcmp+0x21>
mov    %edx,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    (%rdi,%rcx,4),%edx
cmp    (%rsi,%rcx,4),%edx
jne    1124 <cmdcmp+0x24>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <cmdcmp+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @cmdcmp(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %1, i64 %10
%14 = load i32, i32* %13
%15 = icmp eq i32 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9, %7, %3
%18 = phi i32 [ 0, %3 ], [ 0, %7 ], [ 1, %9 ]
ret i32 %18
}
char *strcpy(register char *s, register const char *t) {
  char *dest = s;
  while ((*dest++ = *t++))
    ;
  return s;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int /*<<< orphan*/ printf(char *, int (*)());
int main() {
  int d = 99;
  foo();
  printf("the addrss of main() is %p\n", main);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x63,-0x8(%rbp)
mov    $0x0,%al
call   1040 <foo@plt>
lea    0xebc(%rip),%rdi
mov    0x2e9d(%rip),%rsi
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 <foo@plt>
lea    0xed1(%rip),%rdi
mov    0x2eb2(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"the addrss of main() is %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 99, i32* %2
%3 = call i32 (...) @foo()
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 (...)* bitcast (i32 ()* @main to i32 (...)*))
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"the addrss of main() is %p\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 (...)* bitcast (i32 ()* @main to i32 (...)*))
ret i32 0
}
/* Variables and functions */
double log(int);
double lg(double N) { return log(N) / log(2); }


x86 assembly (clang, -O0):
<lg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x2,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lg>:
push   %rax
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  %xmm0,(%rsp)
mov    $0x2,%edi
call   1030 <log@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @lg(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
%5 = call double @log(i32 %4)
%6 = call double @log(i32 2)
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @lg(double %0) {
%2 = fptosi double %0 to i32
%3 = tail call double @log(i32 %2)
%4 = tail call double @log(i32 2)
%5 = fdiv double %3, %4
ret double %5
}
/* Type definitions */
struct parser {
  int dummy;
};

/* Variables and functions */
scalar_t__ could_read_(struct parser *, char const *, int);
int /*<<< orphan*/ skip(struct parser *, int);
int can_read_(struct parser *p, const char *s, int len) {
  if (could_read_(p, s, len)) {
    skip(p, len);
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<can_read_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <could_read_@plt>
cmp    $0x0,%rax
je     1165 <can_read_+0x45>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <skip@plt>
movl   $0x1,-0x4(%rbp)
jmp    116c <can_read_+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<can_read_>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
call   1040 <could_read_@plt>
test   %rax,%rax
je     1143 <can_read_+0x23>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <skip@plt>
mov    $0x1,%eax
jmp    1145 <can_read_+0x25>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.parser = type { i32 }
define i32 @can_read_(%struct.parser* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.parser*
%6 = alloca i8*
%7 = alloca i32
store %struct.parser* %0, %struct.parser** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load %struct.parser*, %struct.parser** %5
%9 = load i8*, i8** %6
%10 = load i32, i32* %7
%11 = call i64 @could_read_(%struct.parser* %8, i8* %9, i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load %struct.parser*, %struct.parser** %5
%15 = load i32, i32* %7
%16 = call i32 @skip(%struct.parser* %14, i32 %15)
store i32 1, i32* %4
br label %18
17: ; preds = %3
store i32 0, i32* %4
br label %18
18: ; preds = %17, %13
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
%struct.parser = type { i32 }
define i32 @can_read_(%struct.parser* %0, i8* %1, i32 %2) {
%4 = tail call i64 @could_read_(%struct.parser* %0, i8* %1, i32 %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @skip(%struct.parser* %0, i32 %2)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ 1, %6 ], [ 0, %3 ]
ret i32 %9
}
/* Variables and functions */
unsigned long simple_strtol(char const *, char **, int);
unsigned long int strtoul(const char *nptr, char **endptr, int base) {
  return simple_strtol(nptr, endptr, base);
}


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

x86 assembly (clang, -O2):
<strtoul>:
jmp    1030 <simple_strtol@plt>

LLVM IR (-O0):
define i64 @strtoul(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 i64 @simple_strtol(i8* %7, i8** %8, i32 %9)
ret i64 %10
}

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

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XPointerMovedEvent(void) {
  XPointerMovedEvent *_p =
      (XPointerMovedEvent *)malloc(sizeof(XPointerMovedEvent));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XPointerMovedEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XPointerMovedEvent+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XPointerMovedEvent>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XPointerMovedEvent+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XPointerMovedEvent() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XPointerMovedEvent() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ PrintF(char *);
int Main() { PrintF("Hello World\n"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World\0A\00"
define i32 @Main() {
%1 = alloca i32
%2 = call i32 @PrintF(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello World\0A\00"
define i32 @Main() {
%1 = tail call i32 @PrintF(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int ft_isdigit(int c) { return (c <= '9' && c >= '0'); }


x86 assembly (clang, -O0):
<ft_isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x39,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jg     1120 <ft_isdigit+0x20>
cmpl   $0x30,-0x4(%rbp)
setge  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isdigit>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isdigit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 57
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 48
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @ft_isdigit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, char);
void putchar(char c) { outb(0xe9, c); }


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

x86 assembly (clang, -O2):
<putchar>:
mov    %edi,%esi
mov    $0xe9,%edi
jmp    1030 <outb@plt>

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

LLVM IR (-O2):
define void @putchar(i8 signext %0) {
%2 = tail call i32 @outb(i32 233, i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void version(void) {
  fprintf(stderr, "%s (written by W. Celes)\n", "tolua 4.0a - angband");
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
lea    0xeef(%rip),%rdx
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<version>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
lea    0xef3(%rip),%rdx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"%s (written by W. Celes)\0A\00"
@.str.1 = [21 x i8] c"tolua 4.0a - angband\00"
define void @version() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"%s (written by W. Celes)\0A\00"
@.str.1 = [21 x i8] c"tolua 4.0a - angband\00"
define void @version() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int foo(int arg) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
ret i32 0
}
/* Variables and functions */
void printf(char *format, ...) {}


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

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

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

LLVM IR (-O2):
define void @printf(i8* nocapture %0, ...) {
ret void
}
char *envp(void) {
  static char *result = "\0";
  return result;
}


x86 assembly (clang, -O0):
<envp>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f15(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<envp>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@envp.result = internal global i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0)
@.str = [2 x i8] zeroinitializer
define i8* @envp() {
%1 = load i8*, i8** @envp.result
ret i8* %1
}

LLVM IR (-O2):
@.str = [2 x i8] zeroinitializer
define i8* @envp() {
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
}
void readVACEPROM(void) {
  unsigned long i;
  i = *((unsigned long *)(((unsigned long)0xff000000 >> 2) | 0xb0000000));
}


x86 assembly (clang, -O0):
<readVACEPROM>:
push   %rbp
mov    %rsp,%rbp
mov    $0xbfc00000,%eax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @readVACEPROM() {
%1 = alloca i64
%2 = load i64, i64* inttoptr (i64 3217031168 to i64*)
store i64 %2, i64* %1
ret void
}

LLVM IR (-O2):
define void @readVACEPROM() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gethostid();
int /*<<< orphan*/ sprintf(char *, char *, int /*<<< orphan*/);
int strlen(char *);
int ec_gethostid(char *buf, int len) {
  (void)sprintf(buf, "H#%ld", gethostid());
  return strlen(buf);
}


x86 assembly (clang, -O0):
<ec_gethostid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <gethostid@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
lea    0xea5(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ec_gethostid>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <gethostid@plt>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   1050 <sprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <strlen@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"H#%ld\00"
define i32 @ec_gethostid(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 (...) @gethostid()
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
ret i32 %9
}

LLVM IR (-O2):
@.str = [6 x i8] c"H#%ld\00"
define i32 @ec_gethostid(i8* %0, i32 %1) {
%3 = tail call i32 (...) @gethostid()
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @strlen(i8* %0)
ret i32 %5
}
int test_imm_4Fuint8_mem(unsigned char *val) {
  return ((*val) & (-0x4F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_4Fuint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -79
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_4Fuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -79
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
unsigned int termattrs();
unsigned int wrap_termattrs(void) { return termattrs(); }


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

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

LLVM IR (-O0):
define i32 @wrap_termattrs() {
%1 = call i32 (...) @termattrs()
ret i32 %1
}

LLVM IR (-O2):
define i32 @wrap_termattrs() {
%1 = tail call i32 (...) @termattrs()
ret i32 %1
}
const char *str_expr_op() { return "operator"; }


x86 assembly (clang, -O0):
<str_expr_op>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_expr_op>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"operator\00"
define i8* @str_expr_op() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [9 x i8] c"operator\00"
define i8* @str_expr_op() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}