xunge/DecIR huggingface dataset:
/* Variables and functions */
char *dirname(int /*<<< orphan*/);
int /*<<< orphan*/ mkdir(char *, int);
scalar_t__ strchr(char *, char);
int /*<<< orphan*/ strdup(char const *);
void mkdir_p(const char *path) {
  char *dir;
  dir = dirname(strdup(path));
  if (strchr(dir, '/'))
    mkdir_p(dir);
  mkdir(dir, 0755);
}


x86 assembly (clang, -O0):
<mkdir_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <strdup@plt>
mov    %eax,%edi
call   1050 <dirname@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     1191 <mkdir_p+0x41>
mov    -0x10(%rbp),%rdi
call   1060 <mkdir_p@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkdir_p>:
push   %rbx
call   1070 <strdup@plt>
mov    %eax,%edi
call   1050 <dirname@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     117a <mkdir_p+0x2a>
mov    %rbx,%rdi
call   1060 <mkdir_p@plt>
mov    %rbx,%rdi
mov    $0x1ed,%esi
pop    %rbx
jmp    1030 <mkdir@plt>

LLVM IR (-O0):
define void @mkdir_p(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strdup(i8* %4)
%6 = call i8* @dirname(i32 %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i64 @strchr(i8* %7, i8 signext 47)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i8*, i8** %3
br label %12
12: ; preds = %10, %1
%13 = load i8*, i8** %3
%14 = call i32 @mkdir(i8* %13, i32 493)
ret void
}

LLVM IR (-O2):
define void @mkdir_p(i8* %0) {
%2 = tail call i32 @strdup(i8* %0)
%3 = tail call i8* @dirname(i32 %2)
%4 = tail call i64 @strchr(i8* %3, i8 signext 47)
%5 = icmp eq i64 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
tail call void @mkdir_p(i8* %3)
br label %7
7: ; preds = %6, %1
%8 = tail call i32 @mkdir(i8* %3, i32 493)
ret void
}
/* Variables and functions */
scalar_t__ close(int);
int /*<<< orphan*/ die(int);
void xclose(int fd) {
  if (close(fd) != 0)
    die(70);
}


x86 assembly (clang, -O0):
<xclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
cmp    $0x0,%rax
je     1147 <xclose+0x27>
mov    $0x46,%edi
call   1040 <die@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xclose>:
push   %rax
call   1030 <close@plt>
test   %rax,%rax
je     1136 <xclose+0x16>
mov    $0x46,%edi
pop    %rax
jmp    1040 <die@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @xclose(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @close(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @die(i32 70)
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @xclose(i32 %0) {
%2 = tail call i64 @close(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @die(i32 70)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int *malloc(int);
void *alloc(int a) {
  int *l = malloc(sizeof(int));
  *l = a;
  return (void *)l;
}


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

x86 assembly (clang, -O2):
<alloc>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %ebx,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i8* @alloc(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i32* @malloc(i32 4)
store i32* %4, i32** %3
%5 = load i32, i32* %2
%6 = load i32*, i32** %3
store i32 %5, i32* %6
%7 = load i32*, i32** %3
%8 = bitcast i32* %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define noalias i8* @alloc(i32 %0) {
%2 = tail call i32* @malloc(i32 4)
store i32 %0, i32* %2
%3 = bitcast i32* %2 to i8*
ret i8* %3
}
/* Variables and functions */
int SV_FindIndex(char *, int, int, int);
int SV_SoundIndex(char *name) { return SV_FindIndex(name, (32 + 256), 256, 1); }


x86 assembly (clang, -O0):
<SV_SoundIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x120,%esi
mov    $0x100,%edx
mov    $0x1,%ecx
call   1030 <SV_FindIndex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SV_SoundIndex>:
mov    $0x120,%esi
mov    $0x100,%edx
mov    $0x1,%ecx
jmp    1030 <SV_FindIndex@plt>

LLVM IR (-O0):
define i32 @SV_SoundIndex(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @SV_FindIndex(i8* %3, i32 288, i32 256, i32 1)
ret i32 %4
}

LLVM IR (-O2):
define i32 @SV_SoundIndex(i8* %0) {
%2 = tail call i32 @SV_FindIndex(i8* %0, i32 288, i32 256, i32 1)
ret i32 %2
}
double pathconN_nm8_twice(double x) { return x + x; }


x86 assembly (clang, -O0):
<pathconN_nm8_twice>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathconN_nm8_twice>:
addsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @pathconN_nm8_twice(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fadd double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @pathconN_nm8_twice(double %0) {
%2 = fadd double %0, %0
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ gen_square_wave(int, int, int, double);
int main(int argc, char *argv[]) {
  gen_square_wave(44100, 440, 1000, 0.3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xac44,%edi
mov    $0x1b8,%esi
mov    $0x3e8,%edx
movsd  0xec3(%rip),%xmm0
call   1030 <gen_square_wave@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xee7(%rip),%xmm0
mov    $0xac44,%edi
mov    $0x1b8,%esi
mov    $0x3e8,%edx
call   1030 <gen_square_wave@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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 @gen_square_wave(i32 44100, i32 440, i32 1000, double 3.000000e-01)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @gen_square_wave(i32 44100, i32 440, i32 1000, double 3.000000e-01)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int sum = 0;
  int sum_of_square = 0;
  int i, answer;
  for (i = 1; i <= 100; i++) {
    sum += i;
    sum_of_square += i * i;
  }
  answer = (sum * sum) - sum_of_square;
  printf("%i\n", answer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jg     1169 <main+0x59>
mov    -0x1c(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113b <main+0x2b>
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe80(%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    $0x17ff976,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 1, i32* %8
br label %10
10: ; preds = %22, %2
%11 = load i32, i32* %8
%12 = icmp sle i32 %11, 100
br i1 %12, label %13, label %25
13: ; preds = %10
%14 = load i32, i32* %8
%15 = load i32, i32* %6
%16 = add nsw i32 %15, %14
store i32 %16, i32* %6
%17 = load i32, i32* %8
%18 = load i32, i32* %8
%19 = mul nsw i32 %17, %18
%20 = load i32, i32* %7
%21 = add nsw i32 %20, %19
store i32 %21, i32* %7
br label %22
22: ; preds = %13
%23 = load i32, i32* %8
%24 = add nsw i32 %23, 1
store i32 %24, i32* %8
br label %10
25: ; preds = %10
%26 = load i32, i32* %6
%27 = load i32, i32* %6
%28 = mul nsw i32 %26, %27
%29 = load i32, i32* %7
%30 = sub nsw i32 %28, %29
store i32 %30, i32* %9
%31 = load i32, i32* %9
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
ret i32 0
}

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

/* Variables and functions */
#define GL_LINES 137
#define GL_LINE_LOOP 136
#define GL_LINE_STRIP 135
#define GL_POINTS 134
#define GL_POLYGON 133
#define GL_QUADS 132
#define GL_QUAD_STRIP 131
#define GL_TRIANGLES 130
#define GL_TRIANGLE_FAN 129
#define GL_TRIANGLE_STRIP 128
const bool gl_valid_mode(GLenum mode) {
  switch (mode) {
  case GL_POINTS:
  case GL_LINES:
  case GL_LINE_STRIP:
  case GL_LINE_LOOP:
  case GL_TRIANGLES:
  case GL_TRIANGLE_STRIP:
  case GL_TRIANGLE_FAN:
  case GL_QUADS:
  case GL_QUAD_STRIP:
  case GL_POLYGON:
    return true;
  default:
    return false;
  }
}


x86 assembly (clang, -O0):
<gl_valid_mode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
sub    $0x9,%eax
ja     1127 <gl_valid_mode+0x27>
jmp    111b <gl_valid_mode+0x1b>
movl   $0x1,-0x4(%rbp)
jmp    112e <gl_valid_mode+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gl_valid_mode(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 134, label %5
i32 137, label %5
i32 135, label %5
i32 136, label %5
i32 130, label %5
i32 128, label %5
i32 129, label %5
i32 132, label %5
i32 131, label %5
i32 133, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @gl_valid_mode(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int bridge_sendToDomain(char const *, void *, int);
int bridge_cross(const char *receiver_name, void *stream, int length) {
  int stat = -1;
  stat = bridge_sendToDomain(receiver_name, stream, length);
  return stat;
}


x86 assembly (clang, -O0):
<bridge_cross>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <bridge_sendToDomain@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bridge_cross>:
jmp    1030 <bridge_sendToDomain@plt>

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

LLVM IR (-O2):
define i32 @bridge_cross(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @bridge_sendToDomain(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
double calc_percent(double amt, double total) {
  if (total <= 0.0)
    return 0.0;
  return (amt / total) * 100.0;
}


x86 assembly (clang, -O0):
<calc_percent>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1129 <calc_percent+0x29>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1144 <calc_percent+0x44>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  0xec5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_percent>:
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jae    111a <calc_percent+0x1a>
divsd  %xmm1,%xmm0
mulsd  0xeea(%rip),%xmm0
movapd %xmm0,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @calc_percent(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %5
%7 = fcmp ole double %6, 0.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %2
store double 0.000000e+00, double* %3
br label %14
9: ; preds = %2
%10 = load double, double* %4
%11 = load double, double* %5
%12 = fdiv double %10, %11
%13 = fmul double %12, 1.000000e+02
store double %13, double* %3
br label %14
14: ; preds = %9, %8
%15 = load double, double* %3
ret double %15
}

LLVM IR (-O2):
define double @calc_percent(double %0, double %1) {
%3 = fcmp ugt double %1, 0.000000e+00
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = fdiv double %0, %1
%6 = fmul double %5, 1.000000e+02
br label %7
7: ; preds = %2, %4
%8 = phi double [ %6, %4 ], [ 0.000000e+00, %2 ]
ret double %8
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int get_mask_from_state(uint32_t state, uint32_t mask) {
  return state & mask ? 1 : 0;
}


x86 assembly (clang, -O0):
<get_mask_from_state>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
and    -0x8(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mask_from_state>:
xor    %eax,%eax
test   %edi,%esi
setne  %al
ret

LLVM IR (-O0):
define i32 @get_mask_from_state(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 = and i32 %5, %6
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 1, i32 0
ret i32 %10
}

LLVM IR (-O2):
define i32 @get_mask_from_state(i32 %0, i32 %1) {
%3 = and i32 %1, %0
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
scalar_t__ little_endianess();
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
uint32_t ntohl_util(uint32_t input) {
  if (little_endianess()) {
    return ntohl(input);
  } else {
    return input;
  }
}


x86 assembly (clang, -O0):
<ntohl_util>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <little_endianess@plt>
cmp    $0x0,%rax
je     114c <ntohl_util+0x2c>
mov    -0x8(%rbp),%edi
call   1040 <ntohl@plt>
mov    %eax,-0x4(%rbp)
jmp    1152 <ntohl_util+0x32>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntohl_util>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <little_endianess@plt>
test   %rax,%rax
je     1137 <ntohl_util+0x17>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <ntohl@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ntohl_util(i32 %0) {
%2 = tail call i64 (...) @little_endianess()
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @ntohl(i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ BG_TempFree(int);
void B_TempFree(int size) { BG_TempFree(size); }


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

x86 assembly (clang, -O2):
<B_TempFree>:
jmp    1030 <BG_TempFree@plt>

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

LLVM IR (-O2):
define void @B_TempFree(i32 %0) {
%2 = tail call i32 @BG_TempFree(i32 %0)
ret void
}
int main() {
  int x;
  if (0)
    goto inner;
  else
    goto outer;
  {
    __label__ loop;
  loop : {
    __label__ loop;
  inner : {
    x = 20;
    goto loop;
  }
  loop:
    x = 15;
  }
    goto loop;
  }
outer:
  x = 30;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
br label %5
2: ; preds = %4
br label %3
3: ; preds = %2
store i32 20, i32* %1
br label %4
4: ; preds = %3
store i32 15, i32* %1
br label %2
5: ; preds = %0
store i32 30, i32* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int do_707() { return 707; }


x86 assembly (clang, -O0):
<do_707>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2c3,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @do_707() {
ret i32 707
}

LLVM IR (-O2):
define i32 @do_707() {
ret i32 707
}
/* Variables and functions */
int /*<<< orphan*/ iothub_messaging_ll_sample_run();
int main(void) {
  iothub_messaging_ll_sample_run();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @iothub_messaging_ll_sample_run()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ console_tx_hex32(unsigned int);
void print_info_hex32(unsigned int value) { console_tx_hex32(value); }


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

x86 assembly (clang, -O2):
<print_info_hex32>:
jmp    1030 <console_tx_hex32@plt>

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

LLVM IR (-O2):
define void @print_info_hex32(i32 %0) {
%2 = tail call i32 @console_tx_hex32(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MFRC522_HAL_init();
int MFRC522_Setup(char);
int MFRC522_Init(char Type) {
  MFRC522_HAL_init();
  return MFRC522_Setup(Type);
}


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

x86 assembly (clang, -O2):
<MFRC522_Init>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <MFRC522_HAL_init@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <MFRC522_Setup@plt>

LLVM IR (-O0):
define i32 @MFRC522_Init(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 (...) @MFRC522_HAL_init()
%4 = load i8, i8* %2
%5 = call i32 @MFRC522_Setup(i8 signext %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @MFRC522_Init(i8 signext %0) {
%2 = tail call i32 (...) @MFRC522_HAL_init()
%3 = tail call i32 @MFRC522_Setup(i8 signext %0)
ret i32 %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t AONBatMonBatteryVoltageGet(void) {
  uint32_t ui32CurrentBattery;
  ui32CurrentBattery = (*((volatile unsigned long *)(0x40095000 + 0x00000028)));
  return (ui32CurrentBattery >> 0);
}


x86 assembly (clang, -O0):
<AONBatMonBatteryVoltageGet>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40095028,%eax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AONBatMonBatteryVoltageGet>:
mov    0x40095028,%rax
40
ret

LLVM IR (-O0):
define i32 @AONBatMonBatteryVoltageGet() {
%1 = alloca i32
%2 = load volatile i64, i64* inttoptr (i64 1074352168 to i64*)
%3 = trunc i64 %2 to i32
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = ashr i32 %4, 0
ret i32 %5
}

LLVM IR (-O2):
define i32 @AONBatMonBatteryVoltageGet() {
%1 = load volatile i64, i64* inttoptr (i64 1074352168 to i64*)
%2 = trunc i64 %1 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fsort();
int main() { fsort(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @fsort()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @fsort()
ret i32 0
}
int instr_character(char delimiter, char *string) {
  int x;
  for (x = 0; *string; x++)
    if (*string++ == delimiter)
      return x;
  return -1;
}


x86 assembly (clang, -O0):
<instr_character>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115e <instr_character+0x5e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
movsbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jne    114b <instr_character+0x4b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1165 <instr_character+0x65>
jmp    1150 <instr_character+0x50>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <instr_character+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<instr_character>:
mov    (%rsi),%dl
mov    $0xffffffff,%eax
test   %dl,%dl
je     1122 <instr_character+0x22>
xor    %ecx,%ecx
nopl   (%rax)
cmp    %dil,%dl
je     1123 <instr_character+0x23>
movzbl 0x1(%rsi,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <instr_character+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @instr_character(i8 signext %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %13, %10 ], [ %3, %2 ]
%7 = phi i32 [ %12, %10 ], [ 0, %2 ]
%8 = phi i8* [ %11, %10 ], [ %1, %2 ]
%9 = icmp eq i8 %6, %0
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = add nuw nsw i32 %7, 1
%13 = load i8, i8* %11
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %10, %2
%16 = phi i32 [ -1, %2 ], [ -1, %10 ], [ %7, %5 ]
ret i32 %16
}
void foo618(int p) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char check(char A[]) {
  FILE *istream;
  if ((istream = fopen(A, "a+")) == NULL) {
    fclose(istream);
    return 'n';
  } else {
    fclose(istream);
    return 'y';
  }
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    115c <check+0x3c>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movb   $0x6e,-0x1(%rbp)
jmp    1169 <check+0x49>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movb   $0x79,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     113e <check+0x1e>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x79,%al
pop    %rcx
ret
xor    %edi,%edi
call   1030 <fclose@plt>
mov    $0x6e,%al
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"a+\00"
define signext i8 @check(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @fclose(i32* null)
br label %8
6: ; preds = %1
%7 = tail call i32 @fclose(i32* %2)
br label %8
8: ; preds = %6, %4
%9 = phi i8 [ 110, %4 ], [ 121, %6 ]
ret i8 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_common_help(void) {
  printf("Considerations for common errors:\n");
  printf("- Ensure that the intel_rapl kernel module is loaded\n");
  printf("- Some files may simply not exist\n");
  printf("- On some systems, the kernel always returns an error when reading "
         "constraint max power (-U/--c-max-power)\n");
}


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

x86 assembly (clang, -O2):
<print_common_help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xf27(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3d(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"Considerations for common errors:\0A\00"
@.str.1 = [54 x i8] c"- Ensure that the intel_rapl kernel module is loaded\0A\00"
@.str.2 = [35 x i8] c"- Some files may simply not exist\0A\00"
@.str.3 = [108 x i8] c"- On some systems, the kernel always returns an error when reading constraint max power (-U/--c-max-power)\0A\00"
define void @print_common_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [34 x i8] c"Considerations for common errors:\00"
@str.4 = [53 x i8] c"- Ensure that the intel_rapl kernel module is loaded\00"
@str.5 = [34 x i8] c"- Some files may simply not exist\00"
@str.6 = [107 x i8] c"- On some systems, the kernel always returns an error when reading constraint max power (-U/--c-max-power)\00"
define void @print_common_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([107 x i8], [107 x i8]* @str.6, i64 0, i64 0))
ret void
}
/* Variables and functions */
int sys_time();
int time(int *t) {
  int our_time;
  our_time = sys_time();
  if (t != NULL)
    *t = our_time;
  return our_time;
}


x86 assembly (clang, -O0):
<time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <sys_time@plt>
mov    %eax,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113a <time+0x2a>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <sys_time@plt>
test   %rbx,%rbx
je     1122 <time+0x12>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @time(i32* writeonly %0) {
%2 = tail call i32 (...) @sys_time()
%3 = icmp eq i32* %0, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i32 %2, i32* %0
br label %5
5: ; preds = %4, %1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ find_regno(char const *);
int /*<<< orphan*/ supply_register(int /*<<< orphan*/, void const *);
void supply_register_by_name(const char *name, const void *buf) {
  supply_register(find_regno(name), buf);
}


x86 assembly (clang, -O0):
<supply_register_by_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <find_regno@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1040 <supply_register@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<supply_register_by_name>:
push   %rbx
mov    %rsi,%rbx
call   1030 <find_regno@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <supply_register@plt>

LLVM IR (-O0):
define void @supply_register_by_name(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 @find_regno(i8* %5)
%7 = load i8*, i8** %4
%8 = call i32 @supply_register(i32 %6, i8* %7)
ret void
}

LLVM IR (-O2):
define void @supply_register_by_name(i8* %0, i8* %1) {
%3 = tail call i32 @find_regno(i8* %0)
%4 = tail call i32 @supply_register(i32 %3, i8* %1)
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t next_term(uint64_t num) {
  uint64_t retval = (num % 2) ? num + num + num + 1 : num >> 1;
  return retval;
}


x86 assembly (clang, -O0):
<next_term>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     112f <next_term+0x2f>
mov    -0x4(%rbp),%eax
add    -0x4(%rbp),%eax
add    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1138 <next_term+0x38>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_term>:
mov    %edi,%ecx
sar    %ecx
test   $0x1,%dil
lea    0x1(%rdi,%rdi,2),%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @next_term(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
%4 = mul nsw i32 %0, 3
%5 = add nsw i32 %4, 1
%6 = ashr i32 %0, 1
%7 = select i1 %3, i32 %6, i32 %5
ret i32 %7
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
void tsnorm(struct timespec *ts) {
  while (ts->tv_nsec >= (1000000000)) {
    ts->tv_nsec -= (1000000000);
    ts->tv_sec++;
  }
}


x86 assembly (clang, -O0):
<tsnorm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x3b9aca00,(%rax)
jl     1138 <tsnorm+0x38>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
sub    $0x3b9aca00,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    %ecx,0x4(%rax)
jmp    1108 <tsnorm+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tsnorm>:
mov    (%rdi),%eax
cmp    $0x3b9aca00,%eax
jl     1148 <tsnorm+0x48>
mov    0x4(%rdi),%ecx
cmp    $0x773593ff,%eax
mov    $0x773593ff,%edx
cmovl  %eax,%edx
neg    %edx
add    %eax,%edx
add    $0x3b9ac9ff,%edx
shr    $0x9,%edx
imul   $0x44b83,%rdx,%rdx
shr    $0x27,%rdx
imul   $0xc4653600,%edx,%esi
add    %esi,%eax
add    $0xc4653600,%eax
add    %edx,%ecx
add    $0x1,%ecx
mov    %eax,(%rdi)
mov    %ecx,0x4(%rdi)
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define void @tsnorm(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
br label %3
3: ; preds = %8, %1
%4 = load %struct.timespec*, %struct.timespec** %2
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
%6 = load i32, i32* %5
%7 = icmp sge i32 %6, 1000000000
br i1 %7, label %8, label %17
8: ; preds = %3
%9 = load %struct.timespec*, %struct.timespec** %2
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = sub nsw i32 %11, 1000000000
store i32 %12, i32* %10
%13 = load %struct.timespec*, %struct.timespec** %2
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i32 0, i32 1
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %14
br label %3
17: ; preds = %3
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
define void @tsnorm(%struct.timespec* nocapture %0) {
%2 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 999999999
br i1 %4, label %5, label %17
5: ; preds = %1
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%7 = load i32, i32* %6
%8 = add nuw i32 %3, 999999999
%9 = call i32 @llvm.smin.i32(i32 %3, i32 1999999999)
%10 = sub nuw i32 %8, %9
%11 = udiv i32 %10, 1000000000
%12 = mul nsw i32 %11, -1000000000
%13 = add i32 %7, %11
%14 = add nsw i32 %3, -1000000000
%15 = add nsw i32 %12, %14
%16 = add i32 %13, 1
store i32 %15, i32* %2
store i32 %16, i32* %6
br label %17
17: ; preds = %5, %1
ret void
}
gen(o, n) {
  xwrite(o);
  xwrite(' ');
  number(n);
  xwrite('\n');
}


x86 assembly (clang, -O0):
<gen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <xwrite@plt>
mov    $0x20,%edi
mov    $0x0,%al
call   1030 <xwrite@plt>
mov    -0xc(%rbp),%edi
mov    $0x0,%al
call   1040 <number@plt>
mov    $0xa,%edi
mov    $0x0,%al
call   1030 <xwrite@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen>:
push   %rbx
mov    %esi,%ebx
xor    %eax,%eax
call   1030 <xwrite@plt>
mov    $0x20,%edi
xor    %eax,%eax
call   1030 <xwrite@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <number@plt>
mov    $0xa,%edi
xor    %eax,%eax
pop    %rbx
jmp    1030 <xwrite@plt>

LLVM IR (-O0):
define i32 @gen(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 = call i32 (i32, ...) bitcast (i32 (...)* @xwrite to i32 (i32, ...)*)(i32 %6)
%8 = call i32 (i32, ...) bitcast (i32 (...)* @xwrite to i32 (i32, ...)*)(i32 32)
%9 = load i32, i32* %5
%10 = call i32 (i32, ...) bitcast (i32 (...)* @number to i32 (i32, ...)*)(i32 %9)
%11 = call i32 (i32, ...) bitcast (i32 (...)* @xwrite to i32 (i32, ...)*)(i32 10)
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @gen(i32 %0, i32 %1) {
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @xwrite to i32 (i32, ...)*)(i32 %0)
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @xwrite to i32 (i32, ...)*)(i32 32)
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @number to i32 (i32, ...)*)(i32 %1)
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @xwrite to i32 (i32, ...)*)(i32 10)
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ copro_opc7_read_mem(int /*<<< orphan*/);
uint32_t dbg_memread(uint32_t addr) { return copro_opc7_read_mem(addr); }


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

x86 assembly (clang, -O2):
<dbg_memread>:
jmp    1030 <copro_opc7_read_mem@plt>

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

LLVM IR (-O2):
define i32 @dbg_memread(i32 %0) {
%2 = tail call i32 @copro_opc7_read_mem(i32 %0)
ret i32 %2
}
double poly4(double x, double c) {
  return x * (1 - x * (0.5 - x * (c + x * 0.25)));
}


x86 assembly (clang, -O0):
<poly4>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm4
movsd  -0x8(%rbp),%xmm3
movsd  0xee1(%rip),%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
movsd  0xeae(%rip),%xmm3
addsd  %xmm3,%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe7f(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<poly4>:
movsd  0xef8(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movsd  0xeec(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xee4(%rip),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @poly4(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = load double, double* %3
%8 = load double, double* %4
%9 = load double, double* %3
%10 = call double @llvm.fmuladd.f64(double %9, double 2.500000e-01, double %8)
%11 = fneg double %7
%12 = call double @llvm.fmuladd.f64(double %11, double %10, double 5.000000e-01)
%13 = fneg double %6
%14 = call double @llvm.fmuladd.f64(double %13, double %12, double 1.000000e+00)
%15 = fmul double %5, %14
ret double %15
}

LLVM IR (-O2):
define double @poly4(double %0, double %1) {
%3 = tail call double @llvm.fmuladd.f64(double %0, double 2.500000e-01, double %1)
%4 = fneg double %0
%5 = tail call double @llvm.fmuladd.f64(double %4, double %3, double 5.000000e-01)
%6 = tail call double @llvm.fmuladd.f64(double %4, double %5, double 1.000000e+00)
%7 = fmul double %6, %0
ret double %7
}
int test_imm_B2uint16_mem(unsigned short *val) {
  return ((*val) & (-0xB2 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_B2uint16_mem>:
movzwl (%rdi),%eax
test   $0xff4e,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_B2uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -178
%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_B2uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -178
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
void *test_enable(void *arg) {
  intptr_t ret = 0;
  for (int i = 0; i < 10000; i++) {
  }
  return (void *)ret;
}


x86 assembly (clang, -O0):
<test_enable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2710,-0x14(%rbp)
jge    1137 <test_enable+0x37>
jmp    1129 <test_enable+0x29>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <test_enable+0x17>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define noalias i8* @test_enable(i8* nocapture readnone %0) {
ret i8* null
}
long function_n(long p, long q) { return p * q; }


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

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

LLVM IR (-O0):
define i64 @function_n(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = mul nsw i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @function_n(i64 %0, i64 %1) {
%3 = mul nsw i64 %1, %0
ret i64 %3
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
bool is_mouse_position_changed(int32_t current_mouse_x, int32_t current_mouse_y,
                               int32_t *p_prev_mouse_x,
                               int32_t *p_prev_mouse_y) {
  if (current_mouse_x != *p_prev_mouse_x ||
      current_mouse_y != *p_prev_mouse_y) {
    *p_prev_mouse_x = current_mouse_x;
    *p_prev_mouse_y = current_mouse_y;
    return true;
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<is_mouse_position_changed>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%rax
jne    1136 <is_mouse_position_changed+0x36>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%rax
je     1158 <is_mouse_position_changed+0x58>
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    115f <is_mouse_position_changed+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_mouse_position_changed>:
cmp    %rdi,(%rdx)
jne    110c <is_mouse_position_changed+0xc>
xor    %eax,%eax
cmp    %rsi,(%rcx)
je     1117 <is_mouse_position_changed+0x17>
mov    %rdi,(%rdx)
mov    %rsi,(%rcx)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_mouse_position_changed(i64 %0, i64 %1, i64* nocapture %2, i64* nocapture %3) {
%5 = load i64, i64* %2
%6 = icmp eq i64 %5, %0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i64, i64* %3
%9 = icmp eq i64 %8, %1
br i1 %9, label %11, label %10
10: ; preds = %7, %4
store i64 %0, i64* %2
store i64 %1, i64* %3
br label %11
11: ; preds = %7, %10
%12 = phi i32 [ 1, %10 ], [ 0, %7 ]
ret i32 %12
}
const char *skip(const char *in) {
  while (in && *in && (unsigned char)*in <= 32)
    in++;
  return in;
}


x86 assembly (clang, -O0):
<skip>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     113d <skip+0x3d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     113d <skip+0x3d>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x20,%eax
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    114d <skip+0x4d>
jmp    115e <skip+0x5e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <skip+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip>:
test   %rdi,%rdi
je     1121 <skip+0x21>
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopl   0x0(%rax)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
add    $0xff,%cl
cmp    $0x20,%cl
jb     1110 <skip+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @skip(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %8, %3 ], [ %0, %1 ]
%5 = load i8, i8* %4
%6 = add i8 %5, -1
%7 = icmp ult i8 %6, 32
%8 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %7, label %3, label %9
9: ; preds = %3, %1
%10 = phi i8* [ null, %1 ], [ %4, %3 ]
ret i8* %10
}