xunge/DecIR huggingface dataset:
int st_ptrcmp(x, y)
char *x;
char *y;
{ return ((int)(x) - (int)(y)); }


x86 assembly (clang, -O0):
<st_ptrcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_ptrcmp>:
mov    %rdi,%rax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @st_ptrcmp(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 = ptrtoint i8* %5 to i32
%7 = load i8*, i8** %4
%8 = ptrtoint i8* %7 to i32
%9 = sub nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @st_ptrcmp(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = trunc i64 %3 to i32
%5 = ptrtoint i8* %1 to i64
%6 = trunc i64 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ display_cursor(int);
void cursoron(void) { display_cursor(true); }


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

x86 assembly (clang, -O2):
<cursoron>:
mov    $0x1,%edi
jmp    1030 <display_cursor@plt>

LLVM IR (-O0):
define void @cursoron() {
%1 = call i32 @display_cursor(i32 1)
ret void
}

LLVM IR (-O2):
define void @cursoron() {
%1 = tail call i32 @display_cursor(i32 1)
ret void
}
void _s2_free2darr(float **cdat, int nx) {
  int i;
  for (i = 0; i < nx; i++) {
    free(cdat[i]);
  }
  free(cdat);
}


x86 assembly (clang, -O0):
<_s2_free2darr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <_s2_free2darr+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <_s2_free2darr+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_s2_free2darr>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <_s2_free2darr+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <_s2_free2darr+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @_s2_free2darr(float** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds float*, float** %0, i64 %7
%9 = bitcast float** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast float** %0 to i8*
tail call void @free(i8* %14)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ *strstr(char *, char *);
int AT_EXP_TCPSND(const unsigned char *RESP) {
  if (RESP == NULL) {
    return (0);
  }
  if (strstr((char *)RESP, "$MYNETWRITE:") != NULL) {
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<AT_EXP_TCPSND>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <AT_EXP_TCPSND+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1160 <AT_EXP_TCPSND+0x50>
mov    -0x10(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     1159 <AT_EXP_TCPSND+0x49>
movl   $0x1,-0x4(%rbp)
jmp    1160 <AT_EXP_TCPSND+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AT_EXP_TCPSND>:
test   %rdi,%rdi
je     1132 <AT_EXP_TCPSND+0x22>
push   %rax
lea    0xee3(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"$MYNETWRITE:\00"
define i32 @AT_EXP_TCPSND(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32* @strstr(i8* %0, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}
const char *rp_app_desc() {
  return "Red Pitaya SDR transceiver compatible with HPSDR.\n";
}


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

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

LLVM IR (-O0):
@.str = [51 x i8] c"Red Pitaya SDR transceiver compatible with HPSDR.\0A\00"
define i8* @rp_app_desc() {
ret i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [51 x i8] c"Red Pitaya SDR transceiver compatible with HPSDR.\0A\00"
define i8* @rp_app_desc() {
ret i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0)
}
char *strchr(sp, c)
register const char *sp;
register int c;
{
  do {
    if (*sp == c)
      return (char *)sp;
  } while (*sp++);
  return 0;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1128 <strchr+0x28>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114d <strchr+0x4d>
jmp    112d <strchr+0x2d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
jne    110b <strchr+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rax),%ecx
cmp    %esi,%ecx
je     1121 <strchr+0x21>
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, %1
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = icmp eq i8 %5, 0
br i1 %10, label %11, label %3
11: ; preds = %8, %3
%12 = phi i8* [ %4, %3 ], [ null, %8 ]
ret i8* %12
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
void set16be(uint8_t *bytes, uint16_t x) {
  bytes[0] = (uint8_t)(x >> 8);
  bytes[1] = (uint8_t)x;
}


x86 assembly (clang, -O0):
<set16be>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
movslq -0xc(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set16be>:
movslq %esi,%rax
sar    $0x8,%esi
movslq %esi,%rcx
mov    %rcx,(%rdi)
mov    %rax,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @set16be(i64* nocapture writeonly %0, i32 %1) {
%3 = ashr i32 %1, 8
%4 = sext i32 %3 to i64
store i64 %4, i64* %0
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i64, i64* %0, i64 1
store i64 %5, i64* %6
ret void
}
int nls_op_div(int a, int b) { return a / b; }


x86 assembly (clang, -O0):
<nls_op_div>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nls_op_div>:
mov    %edi,%eax
cltd
idiv   %esi
ret

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

LLVM IR (-O2):
define i32 @nls_op_div(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}
void mtarch_yield(void) {}


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

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

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

LLVM IR (-O2):
define void @mtarch_yield() {
ret void
}
/* Variables and functions */
long lcm(long, int);
long smallestMultipleInRange(int min, int max) {
  if (max == min)
    return min;
  else
    return lcm(smallestMultipleInRange(min, max - 1), max);
}


x86 assembly (clang, -O0):
<smallestMultipleInRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1147 <smallestMultipleInRange+0x27>
movslq -0xc(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1164 <smallestMultipleInRange+0x44>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
sub    $0x1,%esi
call   1040 <smallestMultipleInRange@plt>
mov    %rax,%rdi
mov    -0x10(%rbp),%esi
call   1030 <lcm@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smallestMultipleInRange>:
push   %rbx
mov    %esi,%ebx
cmp    %edi,%esi
jne    112c <smallestMultipleInRange+0xc>
movslq %ebx,%rax
pop    %rbx
ret
lea    -0x1(%rbx),%esi
call   1040 <smallestMultipleInRange@plt>
mov    %rax,%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <lcm@plt>

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

LLVM IR (-O2):
define i64 @smallestMultipleInRange(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, %0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = sext i32 %1 to i64
br label %6
6: ; preds = %4, %8
%7 = phi i64 [ %11, %8 ], [ %5, %4 ]
ret i64 %7
8: ; preds = %2
%9 = add nsw i32 %1, -1
%10 = tail call i64 @smallestMultipleInRange(i32 %0, i32 %9)
%11 = tail call i64 @lcm(i64 %10, i32 %1)
br label %6
}
void *int_shift(void *p) { return p + sizeof(int); }


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

x86 assembly (clang, -O2):
<int_shift>:
lea    0x4(%rdi),%rax
ret

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

LLVM IR (-O2):
define i8* @int_shift(i8* readnone %0) {
%2 = getelementptr i8, i8* %0, i64 4
ret i8* %2
}
unsigned int volt_reg_to_value(unsigned int value) {
  return ((value * 1000) / 512) + 2500;
}


x86 assembly (clang, -O0):
<volt_reg_to_value>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x3e8,-0x4(%rbp),%eax
shr    $0x9,%eax
add    $0x9c4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<volt_reg_to_value>:
imul   $0x3e8,%edi,%eax
shr    $0x9,%eax
add    $0x9c4,%eax
ret

LLVM IR (-O0):
define i32 @volt_reg_to_value(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul i32 %3, 1000
%5 = udiv i32 %4, 512
%6 = add i32 %5, 2500
ret i32 %6
}

LLVM IR (-O2):
define i32 @volt_reg_to_value(i32 %0) {
%2 = mul i32 %0, 1000
%3 = lshr i32 %2, 9
%4 = add nuw nsw i32 %3, 2500
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ _SC_NPROCESSORS_CONF;
int /*<<< orphan*/ _SC_NPROCESSORS_ONLN;
int /*<<< orphan*/ printf(char *, int);
int sysconf(int /*<<< orphan*/);
int main(void) {
  int cpu_num = 0;
  cpu_num = sysconf(_SC_NPROCESSORS_CONF);
  printf("_SC_NPROCESSORS_CONF: %d\n", cpu_num);
  cpu_num = sysconf(_SC_NPROCESSORS_ONLN);
  printf("_SC_NPROCESSORS_ONLN: %d\n", cpu_num);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
lea    0xeca(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
lea    0xec8(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@_SC_NPROCESSORS_CONF = global i32 0
@.str = [26 x i8] c"_SC_NPROCESSORS_CONF: %d\0A\00"
@_SC_NPROCESSORS_ONLN = global i32 0
@.str.1 = [26 x i8] c"_SC_NPROCESSORS_ONLN: %d\0A\00"
define i32 @main() {
%1 = load i32, i32* @_SC_NPROCESSORS_CONF
%2 = tail call i32 @sysconf(i32 %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @_SC_NPROCESSORS_ONLN
%5 = tail call i32 @sysconf(i32 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_debug(char *);
int /*<<< orphan*/ print_debug_char(char);
int /*<<< orphan*/ print_debug_hex8(unsigned int);
void print_debug_pci_dev(unsigned dev) {
  print_debug("PCI: ");
  print_debug_hex8((dev >> 20) & 0xff);
  print_debug_char(':');
  print_debug_hex8((dev >> 15) & 0x1f);
  print_debug_char('.');
  print_debug_hex8((dev >> 12) & 0x07);
}


x86 assembly (clang, -O0):
<print_debug_pci_dev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1040 <print_debug@plt>
mov    -0x4(%rbp),%edi
shr    $0x14,%edi
and    $0xff,%edi
call   1030 <print_debug_hex8@plt>
mov    $0x3a,%edi
call   1050 <print_debug_char@plt>
mov    -0x4(%rbp),%edi
shr    $0xf,%edi
and    $0x1f,%edi
call   1030 <print_debug_hex8@plt>
mov    $0x2e,%edi
call   1050 <print_debug_char@plt>
mov    -0x4(%rbp),%edi
shr    $0xc,%edi
and    $0x7,%edi
call   1030 <print_debug_hex8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_debug_pci_dev>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
call   1040 <print_debug@plt>
mov    %ebx,%eax
shr    $0x14,%eax
movzbl %al,%edi
call   1030 <print_debug_hex8@plt>
mov    $0x3a,%edi
call   1050 <print_debug_char@plt>
mov    %ebx,%edi
shr    $0xf,%edi
and    $0x1f,%edi
call   1030 <print_debug_hex8@plt>
mov    $0x2e,%edi
call   1050 <print_debug_char@plt>
shr    $0xc,%ebx
and    $0x7,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <print_debug_hex8@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"PCI: \00"
define void @print_debug_pci_dev(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @print_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = lshr i32 %4, 20
%6 = and i32 %5, 255
%7 = call i32 @print_debug_hex8(i32 %6)
%8 = call i32 @print_debug_char(i8 signext 58)
%9 = load i32, i32* %2
%10 = lshr i32 %9, 15
%11 = and i32 %10, 31
%12 = call i32 @print_debug_hex8(i32 %11)
%13 = call i32 @print_debug_char(i8 signext 46)
%14 = load i32, i32* %2
%15 = lshr i32 %14, 12
%16 = and i32 %15, 7
%17 = call i32 @print_debug_hex8(i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"PCI: \00"
define void @print_debug_pci_dev(i32 %0) {
%2 = tail call i32 @print_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = lshr i32 %0, 20
%4 = and i32 %3, 255
%5 = tail call i32 @print_debug_hex8(i32 %4)
%6 = tail call i32 @print_debug_char(i8 signext 58)
%7 = lshr i32 %0, 15
%8 = and i32 %7, 31
%9 = tail call i32 @print_debug_hex8(i32 %8)
%10 = tail call i32 @print_debug_char(i8 signext 46)
%11 = lshr i32 %0, 12
%12 = and i32 %11, 7
%13 = tail call i32 @print_debug_hex8(i32 %12)
ret void
}
/* Variables and functions */
unsigned long long __bextri_u64(unsigned long long, int);
unsigned long long func_bextri64(unsigned long long X) {
  return __bextri_u64(X, 0x101);
}


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

x86 assembly (clang, -O2):
<func_bextri64>:
mov    $0x101,%esi
jmp    1030 <__bextri_u64@plt>

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

LLVM IR (-O2):
define i64 @func_bextri64(i64 %0) {
%2 = tail call i64 @__bextri_u64(i64 %0, i32 257)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int x[10];
  x[0] = 100;
  x[1] = 200;
  x[2] = 300;
  printf("value of first index: %d\n", x[0]);
  printf("value of second index: %d\n", x[1]);
  printf("value of third index: %d\n", x[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x30(%rbp)
movl   $0xc8,-0x2c(%rbp)
movl   $0x12c,-0x28(%rbp)
mov    -0x30(%rbp),%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [26 x i8] c"value of first index: %d\0A\00"
@.str.1 = [27 x i8] c"value of second index: %d\0A\00"
@.str.2 = [26 x i8] c"value of third index: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32 100, i32* %3
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
store i32 200, i32* %4
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
store i32 300, i32* %5
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"value of first index: %d\0A\00"
@.str.1 = [27 x i8] c"value of second index: %d\0A\00"
@.str.2 = [26 x i8] c"value of third index: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 100)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 200)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 300)
ret i32 0
}
int is_upper_case(char c) { return c <= 'Z' && 'Z' - c < 26; }


x86 assembly (clang, -O0):
<is_upper_case>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x5a,%ecx
mov    %al,-0x2(%rbp)
jg     1130 <is_upper_case+0x30>
movsbl -0x1(%rbp),%ecx
mov    $0x5a,%eax
sub    %ecx,%eax
cmp    $0x1a,%eax
setl   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_upper_case>:
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @is_upper_case(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sle i32 %4, 90
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = sub nsw i32 90, %8
%10 = icmp slt i32 %9, 26
br label %11
11: ; preds = %6, %1
%12 = phi i1 [ false, %1 ], [ %10, %6 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @is_upper_case(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
unsigned long long fibonacci(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned int *);
void fig05_19() {
  unsigned long long int result;
  unsigned int number;
  printf("%s", "Enter an integer: \n");
  scanf("%u", &number);
  result = fibonacci(number);
  printf("Fibonacci( %u ) = %I64u\n", number, result);
}


x86 assembly (clang, -O0):
<fig05_19>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1040 <fibonacci@plt>
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fig05_19>:
push   %rax
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
call   1050 <fibonacci@plt>
mov    0x4(%rsp),%esi
lea    0xe91(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [20 x i8] c"Enter an integer: \0A\00"
@.str.2 = [3 x i8] c"%u\00"
@.str.3 = [25 x i8] c"Fibonacci( %u ) = %I64u\0A\00"
define void @fig05_19() {
%1 = alloca i64
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i64 @fibonacci(i32 %5)
store i64 %6, i64* %1
%7 = load i32, i32* %2
%8 = load i64, i64* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %7, i64 %8)
ret void
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%u\00"
@.str.3 = [25 x i8] c"Fibonacci( %u ) = %I64u\0A\00"
@str = [19 x i8] c"Enter an integer: \00"
define void @fig05_19() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i64 @fibonacci(i32 %5)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %7, i64 %6)
ret void
}
void nseel_asm_stack_peek(void) {
  __asm__("movl $0xfefefefe, %edi\n"
          "fistpl (%esi)\n"
          "movl (%edi), %eax\n"
          "movl (%esi), %edx\n"
          "shll $3, %edx\n"
          "subl %edx, %eax\n"
          "andl $0xfefefefe, %eax\n"
          "orl $0xfefefefe, %eax\n");
}


x86 assembly (clang, -O0):
<nseel_asm_stack_peek>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfefefefe,%edi
fistpl (%esi)
mov    (%edi),%eax
mov    (%esi),%edx
shl    $0x3,%edx
sub    %edx,%eax
and    $0xfefefefe,%eax
or     $0xfefefefe,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nseel_asm_stack_peek>:
mov    $0xfefefefe,%edi
fistpl (%esi)
mov    (%edi),%eax
mov    (%esi),%edx
shl    $0x3,%edx
sub    %edx,%eax
and    $0xfefefefe,%eax
or     $0xfefefefe,%eax
ret

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

LLVM IR (-O2):
define void @nseel_asm_stack_peek() {
tail call void asm sideeffect "movl $$0xfefefefe, %edi\0Afistpl (%esi)\0Amovl (%edi), %eax\0Amovl (%esi), %edx\0Ashll $$3, %edx\0Asubl %edx, %eax\0Aandl $$0xfefefefe, %eax\0Aorl $$0xfefefefe, %eax\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int inter_maxi(int i, int j) { return j; }


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

x86 assembly (clang, -O2):
<inter_maxi>:
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @inter_maxi(i32 %0, i32 returned %1) {
ret i32 %1
}
/* Variables and functions */
int errno;
int fetch_errno() { return errno; }


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

x86 assembly (clang, -O2):
<fetch_errno>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @fetch_errno() {
%1 = load i32, i32* @errno
ret i32 %1
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @fetch_errno() {
%1 = load i32, i32* @errno
ret i32 %1
}
int d_bun_rc2(double a1) { return !(__builtin_isunordered(a1, 100)); }


x86 assembly (clang, -O0):
<d_bun_rc2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
setp   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_bun_rc2>:
xor    %eax,%eax
ucomisd %xmm0,%xmm0
setnp  %al
ret

LLVM IR (-O0):
define i32 @d_bun_rc2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp uno double %3, 1.000000e+02
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @d_bun_rc2(double %0) {
%2 = fcmp ord double %0, 0.000000e+00
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ bym(int /*<<< orphan*/);
void xor_bym(uint32_t x) {
  bym(x);
  xor();
}


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

x86 assembly (clang, -O2):
<xor_bym>:
push   %rax
call   1040 <bym@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <xor@plt>

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

LLVM IR (-O2):
define void @xor_bym(i32 %0) {
%2 = tail call i32 @bym(i32 %0)
%3 = tail call i32 (...) @xor()
ret void
}
int extract_packed_decimal_sign(unsigned long dword1, unsigned long dword0) {
  return (dword1 & 0xf);
}


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

x86 assembly (clang, -O2):
<extract_packed_decimal_sign>:
mov    %rdi,%rax
and    $0xf,%eax
ret

LLVM IR (-O0):
define i32 @extract_packed_decimal_sign(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 = and i64 %5, 15
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @extract_packed_decimal_sign(i64 %0, i64 %1) {
%3 = trunc i64 %0 to i32
%4 = and i32 %3, 15
ret i32 %4
}
const char *foo() { return "foo"; }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
define i8* @foo() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ _delay_ms(int);
int wait_one_second(void) {
  _delay_ms(1000);
  return 1;
}


x86 assembly (clang, -O0):
<wait_one_second>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3e8,%edi
call   1030 <_delay_ms@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_one_second>:
push   %rax
mov    $0x3e8,%edi
call   1030 <_delay_ms@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @wait_one_second() {
%1 = call i32 @_delay_ms(i32 1000)
ret i32 1
}

LLVM IR (-O2):
define i32 @wait_one_second() {
%1 = tail call i32 @_delay_ms(i32 1000)
ret i32 1
}
unsigned int is_prime(int number) {
  for (unsigned int i = 2; (i * i) <= number; i++) {
    if (number % i == 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     114e <is_prime+0x4e>
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
cmp    $0x0,%edx
jne    113b <is_prime+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    1155 <is_prime+0x55>
jmp    1140 <is_prime+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <is_prime+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
mov    $0x1,%eax
cmp    $0x4,%edi
jb     112d <is_prime+0x2d>
mov    $0x2,%ecx
nop
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
test   %edx,%edx
je     1126 <is_prime+0x26>
add    $0x1,%ecx
mov    %ecx,%eax
imul   %ecx,%eax
cmp    %edi,%eax
jbe    1110 <is_prime+0x10>
xor    %eax,%eax
test   %edx,%edx
setne  %al
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp ult i32 %0, 4
br i1 %2, label %14, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 2, %1 ]
%5 = urem i32 %0, %4
%6 = icmp eq i32 %5, 0
%7 = add i32 %4, 1
%8 = mul i32 %7, %7
%9 = icmp ugt i32 %8, %0
%10 = select i1 %6, i1 true, i1 %9
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = xor i1 %6, true
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %11, %1
%15 = phi i32 [ 1, %1 ], [ %13, %11 ]
ret i32 %15
}
int psp_setup_callbacks(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @psp_setup_callbacks() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
scalar_t__ validate(int);
int main() {
  int ctr;
  int have = 0;
  for (ctr = 11111111; ctr < 100000000; ctr++) {
    if (validate(ctr))
      have++;
  }
  printf("Hello world! %d\n", have);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0xa98ac7,-0x8(%rbp)
cmpl   $0x5f5e100,-0x8(%rbp)
jge    1178 <main+0x58>
mov    -0x8(%rbp),%edi
call   1040 <validate@plt>
cmp    $0x0,%rax
je     1165 <main+0x45>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116a <main+0x4a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0xa98ac7,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1040 <validate@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
add    $0x1,%ebp
cmp    $0x5f5e100,%ebp
jne    1130 <main+0x10>
lea    0xeb0(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Hello world! %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 11111111, i32* %2
br label %4
4: ; preds = %15, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 100000000
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i64 @validate(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %7
br label %15
15: ; preds = %14
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %4
18: ; preds = %4
%19 = load i32, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Hello world! %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %7, %1 ]
%3 = phi i32 [ 11111111, %0 ], [ %8, %1 ]
%4 = tail call i64 @validate(i32 %3)
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
%7 = add nuw nsw i32 %2, %6
%8 = add nuw nsw i32 %3, 1
%9 = icmp eq i32 %8, 100000000
br i1 %9, label %10, label %1
10: ; preds = %1
%11 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main() { fflush(stdout); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = call i32 @fflush(i32 %1)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fflush(i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  const char str[7] = "string";
  const char *str1 = str;
  if (str == str1)
    printf("Endereços de memória iguais");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xed5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xecd(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xb(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xb(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    115e <main+0x4e>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.str = [7 x i8] c"string\00"
@.str = [30 x i8] c"Endere\C3\A7os de mem\C3\B3ria iguais\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = bitcast [7 x i8]* %2 to i8*
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
store i8* %5, i8** %3
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = icmp eq i8* %6, %7
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [30 x i8] c"Endere\C3\A7os de mem\C3\B3ria iguais\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ i2c_data_write(unsigned char);
int i2c_not_rcv_ack();
int /*<<< orphan*/ i2c_trx_pend();
int /*<<< orphan*/ i2c_trx_resume();
int i2c_send_addr(unsigned char addr) {
  i2c_data_write(addr);
  i2c_trx_resume();
  while (!i2c_trx_pend())
    ;
  return i2c_not_rcv_ack();
}


x86 assembly (clang, -O0):
<i2c_send_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1060 <i2c_data_write@plt>
mov    $0x0,%al
call   1040 <i2c_trx_resume@plt>
mov    $0x0,%al
call   1030 <i2c_trx_pend@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    117a <i2c_send_addr+0x3a>
jmp    117f <i2c_send_addr+0x3f>
jmp    115e <i2c_send_addr+0x1e>
mov    $0x0,%al
call   1050 <i2c_not_rcv_ack@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_send_addr>:
push   %rax
call   1060 <i2c_data_write@plt>
xor    %eax,%eax
call   1040 <i2c_trx_resume@plt>
nopl   (%rax)
xor    %eax,%eax
call   1030 <i2c_trx_pend@plt>
test   %eax,%eax
je     1150 <i2c_send_addr+0x10>
xor    %eax,%eax
pop    %rcx
jmp    1050 <i2c_not_rcv_ack@plt>

LLVM IR (-O0):
define i32 @i2c_send_addr(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @i2c_data_write(i8 zeroext %3)
%5 = call i32 (...) @i2c_trx_resume()
br label %6
6: ; preds = %10, %1
%7 = call i32 (...) @i2c_trx_pend()
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %11
10: ; preds = %6
br label %6
11: ; preds = %6
%12 = call i32 (...) @i2c_not_rcv_ack()
ret i32 %12
}

LLVM IR (-O2):
define i32 @i2c_send_addr(i8 zeroext %0) {
%2 = tail call i32 @i2c_data_write(i8 zeroext %0)
%3 = tail call i32 (...) @i2c_trx_resume()
br label %4
4: ; preds = %4, %1
%5 = tail call i32 (...) @i2c_trx_pend()
%6 = icmp eq i32 %5, 0
br i1 %6, label %4, label %7
7: ; preds = %4
%8 = tail call i32 (...) @i2c_not_rcv_ack()
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ squeeze(char *, char *);
int main() {
  char s1[20];
  char s2[20];
  puts("\nInput String 1:");
  gets(s1);
  puts("Input String 2:");
  gets(s2);
  squeeze(s1, s2);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
call   1050 <gets@plt>
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <squeeze@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0AInput String 1:\00"
@.str.1 = [16 x i8] c"Input String 2:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
store i32 0, i32* %1
%4 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%9 = call i32 @gets(i8* %8)
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%12 = call i32 @squeeze(i8* %10, i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"\0AInput String 1:\00"
@.str.1 = [16 x i8] c"Input String 2:\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @gets(i8* %4)
%9 = call i32 @squeeze(i8* %3, i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *strrchr(char *, char);
int main(int argc, char *argv[]) {
  char *tmp = strrchr(argv[0], '/');
  if (tmp == NULL)
    tmp = argv[0];
  else
    tmp++;
  (void)printf("#\n"
               "# benchmark %s not compiled/supported on this platform\n"
               "#\n",
               tmp);
  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)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1166 <main+0x46>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1172 <main+0x52>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    (%rsi),%rbx
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
lea    0x1(%rax),%rsi
test   %rax,%rax
cmove  %rbx,%rsi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [60 x i8] c"#\0A# benchmark %s not compiled/supported on this platform\0A#\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i8* @strrchr(i8* %9, i8 signext 47)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
store i8* %16, i8** %6
br label %20
17: ; preds = %2
%18 = load i8*, i8** %6
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %6
br label %20
20: ; preds = %17, %13
%21 = load i8*, i8** %6
%22 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [60 x i8] c"#\0A# benchmark %s not compiled/supported on this platform\0A#\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i8* @strrchr(i8* dereferenceable(1) %3, i8 signext 47)
%5 = icmp eq i8* %4, null
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = select i1 %5, i8* %3, i8* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}
void ev3rt_console_activate() {}


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

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

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

LLVM IR (-O2):
define void @ev3rt_console_activate() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ terminal_putchar(char const);
void putchar(const char data) { terminal_putchar(data); }


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

x86 assembly (clang, -O2):
<putchar>:
jmp    1030 <terminal_putchar@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 @terminal_putchar(i8 signext %3)
ret void
}

LLVM IR (-O2):
define void @putchar(i8 signext %0) {
%2 = tail call i32 @terminal_putchar(i8 signext %0)
ret void
}