xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *do_little(void *unused) {
  int i;
  i = 0;
  i = i + 2;
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<do_little>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_little>:
xor    %edi,%edi
jmp    1030 <pthread_exit@plt>

LLVM IR (-O0):
define i8* @do_little(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
%5 = load i32, i32* %4
%6 = add nsw i32 %5, 2
store i32 %6, i32* %4
%7 = call i32 @pthread_exit(i32* null)
%8 = load i8*, i8** %2
ret i8* %8
}

LLVM IR (-O2):
define noalias i8* @do_little(i8* nocapture readnone %0) {
%2 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
double poleO(double a, double b, double fa, double fb, double fc) {
  return (b - a) * (fa + 4.0 * fc + fb) / 6.0;
}


x86 assembly (clang, -O0):
<poleO>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
movsd  0xecf(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
addsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeae(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<poleO>:
subsd  %xmm0,%xmm1
mulsd  0xef4(%rip),%xmm4
addsd  %xmm2,%xmm4
addsd  %xmm3,%xmm4
mulsd  %xmm1,%xmm4
divsd  0xee8(%rip),%xmm4
movapd %xmm4,%xmm0
ret

LLVM IR (-O0):
define double @poleO(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%11 = load double, double* %7
%12 = load double, double* %6
%13 = fsub double %11, %12
%14 = load double, double* %8
%15 = load double, double* %10
%16 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %15, double %14)
%17 = load double, double* %9
%18 = fadd double %16, %17
%19 = fmul double %13, %18
%20 = fdiv double %19, 6.000000e+00
ret double %20
}

LLVM IR (-O2):
define double @poleO(double %0, double %1, double %2, double %3, double %4) {
%6 = fsub double %1, %0
%7 = tail call double @llvm.fmuladd.f64(double %4, double 4.000000e+00, double %2)
%8 = fadd double %7, %3
%9 = fmul double %6, %8
%10 = fdiv double %9, 6.000000e+00
ret double %10
}
int test_function1(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @test_function1() {
ret i32 1
}

LLVM IR (-O2):
define i32 @test_function1() {
ret i32 1
}
unsigned char fcn3(unsigned char toRot, unsigned char numToRot) {
  unsigned char toRet;
  if (numToRot > 8) {
    toRet = toRot;
  } else
    toRot = toRot >> numToRot | toRot << (8 - numToRot);
  return toRot;
}


x86 assembly (clang, -O0):
<fcn3>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0x8,%eax
jle    1128 <fcn3+0x28>
mov    -0x1(%rbp),%al
mov    %al,-0x3(%rbp)
jmp    114a <fcn3+0x4a>
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
sar    %cl,%eax
movzbl -0x1(%rbp),%edx
movzbl -0x2(%rbp),%esi
mov    $0x8,%ecx
sub    %esi,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcn3>:
mov    %esi,%ecx
mov    %edi,%eax
ror    %cl,%al
cmp    $0x9,%cl
movzbl %al,%eax
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define zeroext i8 @fcn3(i8 zeroext %0, i8 zeroext %1) {
%3 = icmp ugt i8 %1, 8
%4 = tail call i8 @llvm.fshr.i8(i8 %0, i8 %0, i8 %1)
%5 = select i1 %3, i8 %0, i8 %4
ret i8 %5
}
void partial_memory_test(void) {}


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

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

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

LLVM IR (-O2):
define void @partial_memory_test() {
ret void
}
/* Variables and functions */
int mipster_switch(int);
int hypster_switch(int toID) { return mipster_switch(toID); }


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

x86 assembly (clang, -O2):
<hypster_switch>:
jmp    1030 <mipster_switch@plt>

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

LLVM IR (-O2):
define i32 @hypster_switch(i32 %0) {
%2 = tail call i32 @mipster_switch(i32 %0)
ret i32 %2
}
int isEvenNumber(int num) {
  if ((num % 2) == 0) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<isEvenNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1127 <isEvenNumber+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <isEvenNumber+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isEvenNumber>:
mov    %edi,%eax
not    %eax
and    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @isEvenNumber(i32 %0) {
%2 = and i32 %0, 1
%3 = xor i32 %2, 1
ret i32 %3
}
int maxof(int a, int b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<maxof>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <maxof+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <maxof+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxof>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define i32 @maxof(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 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @maxof(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct matlab_buffer {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ *ensure_buffer(struct matlab_buffer *, int);
uint32_t *ensure_buffer_uint32(struct matlab_buffer *buffer) {
  return ensure_buffer(buffer, sizeof(int32_t));
}


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

x86 assembly (clang, -O2):
<ensure_buffer_uint32>:
mov    $0x4,%esi
jmp    1030 <ensure_buffer@plt>

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

LLVM IR (-O2):
%struct.matlab_buffer = type { i32 }
define i32* @ensure_buffer_uint32(%struct.matlab_buffer* %0) {
%2 = tail call i32* @ensure_buffer(%struct.matlab_buffer* %0, i32 4)
ret i32* %2
}
void cust_init_key(unsigned char *rsa_n, unsigned int n_len,
                   unsigned char *rsa_d, unsigned int d_len,
                   unsigned char *rsa_e, unsigned int e_len) {
  return;
}


x86 assembly (clang, -O0):
<cust_init_key>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @cust_init_key(i8* %0, i32 %1, i8* %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32 %5, i32* %12
ret void
}

LLVM IR (-O2):
define void @cust_init_key(i8* nocapture %0, i32 %1, i8* nocapture %2, i32 %3, i8* nocapture %4, i32 %5) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ configureIeeePatch();
int /*<<< orphan*/ enterIeeeCpePatch();
void refreshIeeePatch(void) {
  enterIeeeCpePatch();
  configureIeeePatch();
}


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

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

LLVM IR (-O0):
define void @refreshIeeePatch() {
%1 = call i32 (...) @enterIeeeCpePatch()
%2 = call i32 (...) @configureIeeePatch()
ret void
}

LLVM IR (-O2):
define void @refreshIeeePatch() {
%1 = tail call i32 (...) @enterIeeeCpePatch()
%2 = tail call i32 (...) @configureIeeePatch()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dosleep(int);
void wait_for_vsync(void) { dosleep(10000); }


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

x86 assembly (clang, -O2):
<wait_for_vsync>:
mov    $0x2710,%edi
jmp    1030 <dosleep@plt>

LLVM IR (-O0):
define void @wait_for_vsync() {
%1 = call i32 @dosleep(i32 10000)
ret void
}

LLVM IR (-O2):
define void @wait_for_vsync() {
%1 = tail call i32 @dosleep(i32 10000)
ret void
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ stat(char const *, struct stat *);
int isdir(const char *path) {
  struct stat stats;
  return stat(path, &stats) == 0 && S_ISDIR(stats.st_mode);
}


x86 assembly (clang, -O0):
<isdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    115d <isdir+0x3d>
mov    -0x10(%rbp),%edi
call   1030 <S_ISDIR@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isdir>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1135 <isdir+0x15>
pop    %rcx
ret
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @isdir(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @stat(i8* %4, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i64 @S_ISDIR(i32 %9)
%11 = icmp ne i64 %10, 0
br label %12
12: ; preds = %7, %1
%13 = phi i1 [ false, %1 ], [ %11, %7 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @isdir(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i64 @S_ISDIR(i32 %8)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %1
%13 = phi i32 [ 0, %1 ], [ %11, %6 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ OCSP_CERTSTATUS;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
int /*<<< orphan*/ OCSP_CERTSTATUS_it;
OCSP_CERTSTATUS *d2i_OCSP_CERTSTATUS(OCSP_CERTSTATUS **a,
                                     const unsigned char **in, long len) {
  return (OCSP_CERTSTATUS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
                                          &OCSP_CERTSTATUS_it);
}


x86 assembly (clang, -O0):
<d2i_OCSP_CERTSTATUS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2ea9(%rip),%rcx
call   1030 <ASN1_item_d2i@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2i_OCSP_CERTSTATUS>:
mov    0x2ec9(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@OCSP_CERTSTATUS_it = global i32 0
define i32* @d2i_OCSP_CERTSTATUS(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @OCSP_CERTSTATUS_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@OCSP_CERTSTATUS_it = global i32 0
define i32* @d2i_OCSP_CERTSTATUS(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @OCSP_CERTSTATUS_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
/* Type definitions */
typedef int int64_t;
typedef int int32_t;

/* Variables and functions */
int64_t mul32(int32_t x, int32_t y) { return ((int64_t)x * y); }


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

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

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

LLVM IR (-O2):
define i32 @mul32(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
unsigned long long getL() { return 0xafafafafc5c5b8a3ull; }


x86 assembly (clang, -O0):
<getL>:
push   %rbp
mov    %rsp,%rbp
movabs $0xafafafafc5c5b8a3,%rax
af af af
pop    %rbp
ret

x86 assembly (clang, -O2):
<getL>:
movabs $0xafafafafc5c5b8a3,%rax
af af af
ret

LLVM IR (-O0):
define i64 @getL() {
ret i64 -5787213826675591005
}

LLVM IR (-O2):
define i64 @getL() {
ret i64 -5787213826675591005
}
/* Variables and functions */
double archimedes(int const);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  const int N = 25;
  double pi = archimedes(N);
  printf("%.15e\n", pi);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x19,%edi
call   1040 <archimedes@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%.15e\0A\00"
define i32 @main() {
%1 = tail call double @archimedes(i32 25)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %1)
ret i32 0
}
int ns(char c) {
  if (c < 0x21 || (c > 0x2f && c < 0x3a) || (c > 0x40 && c < 0x5b) ||
      (c > 0x60 && c < 0x7b)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ns>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x21,%eax
jl     1165 <ns+0x65>
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
jle    1131 <ns+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0x3a,%eax
jl     1165 <ns+0x65>
movsbl -0x5(%rbp),%eax
cmp    $0x40,%eax
jle    114b <ns+0x4b>
movsbl -0x5(%rbp),%eax
cmp    $0x5b,%eax
jl     1165 <ns+0x65>
movsbl -0x5(%rbp),%eax
cmp    $0x60,%eax
jle    1171 <ns+0x71>
movsbl -0x5(%rbp),%eax
cmp    $0x7b,%eax
jge    1171 <ns+0x71>
movl   $0x1,-0x4(%rbp)
jmp    1178 <ns+0x78>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ns>:
cmp    $0x21,%dil
setl   %al
lea    -0x30(%rdi),%ecx
cmp    $0xa,%cl
setb   %cl
or     %al,%cl
and    $0xdf,%dil
add    $0xbf,%dil
cmp    $0x1a,%dil
setb   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @ns(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp slt i32 %5, 33
br i1 %6, label %31, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sgt i32 %9, 47
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp slt i32 %13, 58
br i1 %14, label %31, label %15
15: ; preds = %11, %7
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp sgt i32 %17, 64
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp slt i32 %21, 91
br i1 %22, label %31, label %23
23: ; preds = %19, %15
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp sgt i32 %25, 96
br i1 %26, label %27, label %32
27: ; preds = %23
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = icmp slt i32 %29, 123
br i1 %30, label %31, label %32
31: ; preds = %27, %19, %11, %1
store i32 1, i32* %2
br label %33
32: ; preds = %27, %23
store i32 0, i32* %2
br label %33
33: ; preds = %32, %31
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @ns(i8 signext %0) {
%2 = icmp slt i8 %0, 33
%3 = add i8 %0, -48
%4 = icmp ult i8 %3, 10
%5 = or i1 %2, %4
%6 = and i8 %0, -33
%7 = add i8 %6, -65
%8 = icmp ult i8 %7, 26
%9 = or i1 %8, %5
%10 = zext i1 %9 to i32
ret i32 %10
}
void swap(int *j, int *k) {
  int tmp = *j;
  *j = *k;
  *k = tmp;
}


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

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @swap(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
int test_imm_2Dint8_mem(signed char *val) {
  return ((*val) & (-0x2D << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_2Dint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -45
%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_2Dint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -45
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int add(int x, int y) {
  int carry, sum;
  do {
    carry = x & y;
    sum = x ^ y;
    x = carry << 1;
    y = sum;
  } while (carry);
  return sum;
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    110a <add+0xa>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
mov    %esi,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
mov    %edi,%eax
mov    %edi,%edx
and    %ecx,%edx
xor    %ecx,%eax
lea    (%rdx,%rdx,1),%edi
test   %edx,%edx
jne    1110 <add+0x10>
ret

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

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %1, %2 ], [ %7, %3 ]
%5 = phi i32 [ %0, %2 ], [ %8, %3 ]
%6 = and i32 %5, %4
%7 = xor i32 %5, %4
%8 = shl i32 %6, 1
%9 = icmp eq i32 %6, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ slgr_equal();
int /*<<< orphan*/ slgr_greater();
int /*<<< orphan*/ slgr_less();
int main() {
  slgr_equal();
  slgr_less();
  slgr_greater();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @slgr_equal()
%2 = tail call i32 (...) @slgr_less()
%3 = tail call i32 (...) @slgr_greater()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ op_write1(int);
void op_enc_inc_hl(void) { op_write1(0x23); }


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

x86 assembly (clang, -O2):
<op_enc_inc_hl>:
mov    $0x23,%edi
jmp    1030 <op_write1@plt>

LLVM IR (-O0):
define void @op_enc_inc_hl() {
%1 = call i32 @op_write1(i32 35)
ret void
}

LLVM IR (-O2):
define void @op_enc_inc_hl() {
%1 = tail call i32 @op_write1(i32 35)
ret void
}
int _tst_bit(volatile void *addr, unsigned long nr) {
  int val;
  __asm__ __volatile__("bt %2,%1\n"
                       "sbb %0,%0"
                       : "=r"(val)
                       : "m"(*(unsigned long *)addr), "Ir"(nr));
  return val;
}


x86 assembly (clang, -O0):
<_tst_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
bt     %rcx,(%rax)
sbb    %eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_tst_bit>:
bt     %rsi,(%rdi)
sbb    %eax,%eax
ret

LLVM IR (-O0):
define i32 @_tst_bit(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i64*
%8 = load i64, i64* %4
%9 = call i32 asm sideeffect "bt $2,$1\0Asbb $0,$0", "=r,*m,Ir,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %7, i64 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
define i32 @_tst_bit(i8* %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
%4 = tail call i32 asm sideeffect "bt $2,$1\0Asbb $0,$0", "=r,*m,Ir,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %3, i64 %1)
ret i32 %4
}
void _mesa_get_cpu_features(void) {}


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

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

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

LLVM IR (-O2):
define void @_mesa_get_cpu_features() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main() {
  int *p = 0;
  fprintf(stdout, "output\n");
  fprintf(stderr, "errput\n");
  *p = 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xed2(%rip),%rsi
call   1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [8 x i8] c"output\0A\00"
@stderr = global i32 0
@.str.1 = [8 x i8] c"errput\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
store i32* null, i32** %2
%3 = load i32, i32* @stdout
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32*, i32** %2
store i32 1, i32* %7
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [8 x i8] c"output\0A\00"
@stderr = global i32 0
@.str.1 = [8 x i8] c"errput\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ ConvertString(char *);
int /*<<< orphan*/ diagnostics(int, char *, char *);
int /*<<< orphan*/ fprintRTF(char *);
char *getBraceParam();
int /*<<< orphan*/ safe_free(char *);
void CmdNumberLine(int code) {
  char *number;
  number = getBraceParam();
  diagnostics(4, "Entering CmdNumberLine [%s]", number);
  ConvertString(number);
  fprintRTF("\\tab\n");
  safe_free(number);
}


x86 assembly (clang, -O0):
<CmdNumberLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getBraceParam@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    $0x4,%edi
lea    0xe8a(%rip),%rsi
call   1050 <diagnostics@plt>
mov    -0x10(%rbp),%rdi
call   1040 <ConvertString@plt>
lea    0xe91(%rip),%rdi
call   1070 <fprintRTF@plt>
mov    -0x10(%rbp),%rdi
call   1060 <safe_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmdNumberLine>:
push   %rbx
xor    %eax,%eax
call   1030 <getBraceParam@plt>
mov    %rax,%rbx
lea    0xe9e(%rip),%rsi
mov    $0x4,%edi
mov    %rax,%rdx
call   1050 <diagnostics@plt>
mov    %rbx,%rdi
call   1040 <ConvertString@plt>
lea    0xe9e(%rip),%rdi
call   1070 <fprintRTF@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1060 <safe_free@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Entering CmdNumberLine [%s]\00"
@.str.1 = [6 x i8] c"\\tab\0A\00"
define void @CmdNumberLine(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i8* (...) @getBraceParam()
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @diagnostics(i32 4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %3
%8 = call i32 @ConvertString(i8* %7)
%9 = call i32 @fprintRTF(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%10 = load i8*, i8** %3
%11 = call i32 @safe_free(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Entering CmdNumberLine [%s]\00"
@.str.1 = [6 x i8] c"\\tab\0A\00"
define void @CmdNumberLine(i32 %0) {
%2 = tail call i8* (...) @getBraceParam()
%3 = tail call i32 @diagnostics(i32 4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @ConvertString(i8* %2)
%5 = tail call i32 @fprintRTF(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @safe_free(i8* %2)
ret void
}
long test_lround(double x) { return __builtin_lround(x); }


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

x86 assembly (clang, -O2):
<test_lround>:
jmp    1030 <lround@plt>

LLVM IR (-O0):
define i64 @test_lround(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @lround(double %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @test_lround(double %0) {
%2 = tail call i64 @lround(double %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ kmp_search(char *, char *);
int main() {
  char *txt = "ABABDABACDABABCABAB";
  char *pat = "ABABCABAB";
  kmp_search(pat, txt);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [20 x i8] c"ABABDABACDABABCABAB\00"
@.str.1 = [10 x i8] c"ABABCABAB\00"
define i32 @main() {
%1 = tail call i32 @kmp_search(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
scalar_t__ reallocf(char *, int);
void reallocfRadar6337483_3() {
  char *buf = malloc(100);
  char *tmp;
  tmp = (char *)reallocf(buf, 0x1000000);
  if (!tmp) {
    free(buf);
    return;
  }
  buf = tmp;
  free(buf);
}


x86 assembly (clang, -O0):
<reallocfRadar6337483_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1000000,%esi
call   1050 <reallocf@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1171 <reallocfRadar6337483_3+0x41>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
jmp    1182 <reallocfRadar6337483_3+0x52>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocfRadar6337483_3>:
push   %rbx
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x1000000,%esi
call   1050 <reallocf@plt>
test   %rax,%rax
je     1159 <reallocfRadar6337483_3+0x29>
mov    %rax,%rdi
pop    %rbx
jmp    1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @reallocfRadar6337483_3() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* @malloc(i32 100)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i64 @reallocf(i8* %4, i32 16777216)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %2
%7 = load i8*, i8** %2
%8 = icmp ne i8* %7, null
br i1 %8, label %12, label %9
9: ; preds = %0
%10 = load i8*, i8** %1
%11 = call i32 @free(i8* %10)
br label %16
12: ; preds = %0
%13 = load i8*, i8** %2
store i8* %13, i8** %1
%14 = load i8*, i8** %1
%15 = call i32 @free(i8* %14)
br label %16
16: ; preds = %12, %9
ret void
}

LLVM IR (-O2):
define void @reallocfRadar6337483_3() {
%1 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%2 = tail call i64 @reallocf(i8* %1, i32 16777216)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @free(i8* %1)
br label %9
6: ; preds = %0
%7 = inttoptr i64 %2 to i8*
%8 = tail call i32 @free(i8* %7)
br label %9
9: ; preds = %6, %4
ret void
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
uint32_t ror(uint32_t val, unsigned num) {
  return ((val >> num) | (val << (32 - num)));
}


x86 assembly (clang, -O0):
<ror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ror(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 = lshr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub i32 32, %9
%11 = shl i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @ror(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = sub i32 32, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int int1(unsigned char *);
unsigned char *
minutes_of_observational_data_cutoff_after_reference_time_location(
    unsigned char **);
int minutes_of_observational_data_cutoff_after_reference_time(
    unsigned char **sec) {
  unsigned char *p;
  p = minutes_of_observational_data_cutoff_after_reference_time_location(sec);
  if (p)
    return int1(p);
  return -1;
}


x86 assembly (clang, -O0):
<minutes_of_observational_data_cutoff_after_reference_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <minutes_of_observational_data_cutoff_after_reference_time_location@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1155 <minutes_of_observational_data_cutoff_after_reference_time+0x35>
mov    -0x18(%rbp),%rdi
call   1040 <int1@plt>
mov    %eax,-0x4(%rbp)
jmp    115c <minutes_of_observational_data_cutoff_after_reference_time+0x3c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minutes_of_observational_data_cutoff_after_reference_time>:
push   %rax
call   1030 <minutes_of_observational_data_cutoff_after_reference_time_location@plt>
test   %rax,%rax
je     1134 <minutes_of_observational_data_cutoff_after_reference_time+0x14>
mov    %rax,%rdi
pop    %rax
jmp    1040 <int1@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @minutes_of_observational_data_cutoff_after_reference_time(i8** %0) {
%2 = tail call i8* @minutes_of_observational_data_cutoff_after_reference_time_location(i8** %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @int1(i8* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ -1, %1 ]
ret i32 %7
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void configureGenfskPatch(void) {
  uint8_t *pPatchTab = (uint8_t *)(0x21000000 + 0x033C);
  uint32_t *pIrqPatch = (uint32_t *)(0x21000000 + 0x03AC);
  pPatchTab[103] = 0;
  pPatchTab[60] = 1;
  pIrqPatch[1] = 0x2100040d;
  pIrqPatch[9] = 0x2100044d;
}


x86 assembly (clang, -O0):
<configureGenfskPatch>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2100033c,%eax
mov    %rax,-0x8(%rbp)
mov    $0x210003ac,%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,0x19c(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1,0xf0(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2100040d,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2100044d,0x24(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<configureGenfskPatch>:
movl   $0x0,0x210004d8
movl   $0x1,0x2100042c
movl   $0x2100040d,0x210003b0
movl   $0x2100044d,0x210003d0
ret

LLVM IR (-O0):
define void @configureGenfskPatch() {
%1 = alloca i32*
%2 = alloca i32*
store i32* inttoptr (i64 553648956 to i32*), i32** %1
store i32* inttoptr (i64 553649068 to i32*), i32** %2
%3 = load i32*, i32** %1
%4 = getelementptr inbounds i32, i32* %3, i64 103
store i32 0, i32* %4
%5 = load i32*, i32** %1
%6 = getelementptr inbounds i32, i32* %5, i64 60
store i32 1, i32* %6
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
store i32 553649165, i32* %8
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 9
store i32 553649229, i32* %10
ret void
}

LLVM IR (-O2):
define void @configureGenfskPatch() {
store i32 0, i32* inttoptr (i64 553649368 to i32*)
store i32 1, i32* inttoptr (i64 553649196 to i32*)
store i32 553649165, i32* inttoptr (i64 553649072 to i32*)
store i32 553649229, i32* inttoptr (i64 553649104 to i32*)
ret void
}
int f(int a) {
  if (a < 12) {
    if (a > -15) {
      a = a > 0 ? a : -a;
      if (a == 2)
        return 0;
      return 1;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xc,-0x8(%rbp)
jge    1165 <f+0x65>
cmpl   $0xfffffff1,-0x8(%rbp)
jle    1160 <f+0x60>
cmpl   $0x0,-0x8(%rbp)
jle    1130 <f+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1138 <f+0x38>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1154 <f+0x54>
movl   $0x0,-0x4(%rbp)
jmp    116c <f+0x6c>
movl   $0x1,-0x4(%rbp)
jmp    116c <f+0x6c>
jmp    1165 <f+0x65>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    -0xc(%rdi),%eax
cmp    $0xffffffe6,%eax
setb   %al
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
cmp    $0x2,%ecx
setne  %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = add i32 %0, -12
%3 = icmp ult i32 %2, -26
%4 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%5 = icmp ne i32 %4, 2
%6 = select i1 %3, i1 true, i1 %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ state_change_fire(int, int *, int);
void state_change_fire2(int event_type, int data0, int data1) {
  int data[2];
  data[0] = data0;
  data[1] = data1;
  state_change_fire(event_type, data, 2);
}


x86 assembly (clang, -O0):
<state_change_fire2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x2,%edx
call   1030 <state_change_fire@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<state_change_fire2>:
push   %rax
mov    %esi,(%rsp)
mov    %edx,0x4(%rsp)
mov    %rsp,%rsi
mov    $0x2,%edx
call   1030 <state_change_fire@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @state_change_fire2(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i32]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %8, i32* %9
%10 = load i32, i32* %6
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %10, i32* %11
%12 = load i32, i32* %4
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%14 = call i32 @state_change_fire(i32 %12, i32* %13, i32 2)
ret void
}

LLVM IR (-O2):
define void @state_change_fire2(i32 %0, i32 %1, i32 %2) {
%4 = alloca [2 x i32]
%5 = bitcast [2 x i32]* %4 to i8*
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 %1, i32* %6
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 %2, i32* %7
%8 = call i32 @state_change_fire(i32 %0, i32* %6, i32 2)
ret void
}
void set_n_cpus(void) {
  asm volatile("cpuid;\n" ::"a"(0xc5b1fffc), "b"(get_nprocs()) : "ecx", "edx");
}


x86 assembly (clang, -O0):
<set_n_cpus>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    $0x0,%al
call   1030 <get_nprocs@plt>
mov    %eax,%ebx
mov    $0xc5b1fffc,%eax
cpuid
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_n_cpus>:
push   %rbx
xor    %eax,%eax
call   1030 <get_nprocs@plt>
mov    %eax,%ebx
mov    $0xc5b1fffc,%eax
cpuid
pop    %rbx
ret

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

LLVM IR (-O2):
define void @set_n_cpus() {
%1 = tail call i32 (...) @get_nprocs()
tail call void asm sideeffect "cpuid;\0A", "{ax},{bx},~{ecx},~{edx},~{dirflag},~{fpsr},~{flags}"(i32 -978190340, i32 %1)
ret void
}
void RandomFunc(unsigned long input[1], unsigned long output[1]) {
  unsigned long state[1];
  unsigned long local2;
  unsigned long local1;
  {
    state[0UL] = input[0UL] + 0xffffffffff660b45UL;
    local1 = 0UL;
    while (local1 < input[1UL]) {
      local2 = 0UL;
      while (local2 < input[1UL]) {
        local2 += 2UL;
      }
      local1 += 2UL;
    }
    output[0UL] = (state[0UL] + 146565199UL) + 2631654602UL;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    $0xffffffffff660b45,%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x8(%rbp),%rcx
cmp    0x8(%rcx),%rax
jae    1173 <RandomFunc+0x73>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x8(%rbp),%rcx
cmp    0x8(%rcx),%rax
jae    1162 <RandomFunc+0x62>
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
jmp    113f <RandomFunc+0x3f>
mov    -0x28(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
jmp    1125 <RandomFunc+0x25>
mov    -0x18(%rbp),%rcx
add    $0x8bc684f,%rcx
movabs $0x9cdbdcca,%rax
add    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
mov    $0xa4fe505e,%eax
add    (%rdi),%rax
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca [1 x i64]
%6 = alloca i64
%7 = alloca i64
store i64* %0, i64** %3
store i64* %1, i64** %4
%8 = load i64*, i64** %3
%9 = getelementptr inbounds i64, i64* %8, i64 0
%10 = load i64, i64* %9
%11 = add i64 %10, -10089659
%12 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
store i64 %11, i64* %12
store i64 0, i64* %7
br label %13
13: ; preds = %29, %2
%14 = load i64, i64* %7
%15 = load i64*, i64** %3
%16 = getelementptr inbounds i64, i64* %15, i64 1
%17 = load i64, i64* %16
%18 = icmp ult i64 %14, %17
br i1 %18, label %19, label %32
19: ; preds = %13
store i64 0, i64* %6
br label %20
20: ; preds = %26, %19
%21 = load i64, i64* %6
%22 = load i64*, i64** %3
%23 = getelementptr inbounds i64, i64* %22, i64 1
%24 = load i64, i64* %23
%25 = icmp ult i64 %21, %24
br i1 %25, label %26, label %29
26: ; preds = %20
%27 = load i64, i64* %6
%28 = add i64 %27, 2
store i64 %28, i64* %6
br label %20
29: ; preds = %20
%30 = load i64, i64* %7
%31 = add i64 %30, 2
store i64 %31, i64* %7
br label %13
32: ; preds = %13
%33 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%34 = load i64, i64* %33
%35 = add i64 %34, 146565199
%36 = add i64 %35, 2631654602
%37 = load i64*, i64** %4
%38 = getelementptr inbounds i64, i64* %37, i64 0
store i64 %36, i64* %38
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i64* nocapture %0, i64* nocapture writeonly %1) {
%3 = load i64, i64* %0
%4 = add i64 %3, 2768130142
store i64 %4, i64* %1
ret void
}
const char *deviceTofGetName(void) { return "tof"; }


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

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

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

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