xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ UINT_MAX;
double urand();
double drand(void) { return urand() * (1.0 / ((double)UINT_MAX + 1.0)); }


x86 assembly (clang, -O0):
<drand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <urand@plt>
mov    0x2ec6(%rip),%rax
cvtsi2sdq (%rax),%xmm2
movsd  0xed1(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  0xec5(%rip),%xmm1
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drand>:
push   %rax
xor    %eax,%eax
call   1030 <urand@plt>
mov    0x2ec9(%rip),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xed4(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@UINT_MAX = global i64 0
define double @drand() {
%1 = call double (...) @urand()
%2 = load i64, i64* @UINT_MAX
%3 = sitofp i64 %2 to double
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double 1.000000e+00, %4
%6 = fmul double %1, %5
ret double %6
}

LLVM IR (-O2):
@UINT_MAX = global i64 0
define double @drand() {
%1 = tail call double (...) @urand()
%2 = load i64, i64* @UINT_MAX
%3 = sitofp i64 %2 to double
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double 1.000000e+00, %4
%6 = fmul double %1, %5
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ SonarAltitudeHandle();
int /*<<< orphan*/ UAVObjLogging(int /*<<< orphan*/);
void SonarAltitudeLogging() { UAVObjLogging(SonarAltitudeHandle()); }


x86 assembly (clang, -O0):
<SonarAltitudeLogging>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <SonarAltitudeHandle@plt>
mov    %eax,%edi
call   1030 <UAVObjLogging@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SonarAltitudeLogging>:
push   %rax
xor    %eax,%eax
call   1040 <SonarAltitudeHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <UAVObjLogging@plt>

LLVM IR (-O0):
define void @SonarAltitudeLogging() {
%1 = call i32 (...) @SonarAltitudeHandle()
%2 = call i32 @UAVObjLogging(i32 %1)
ret void
}

LLVM IR (-O2):
define void @SonarAltitudeLogging() {
%1 = tail call i32 (...) @SonarAltitudeHandle()
%2 = tail call i32 @UAVObjLogging(i32 %1)
ret void
}
void foo609(int p) {}


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

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

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

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

/* Variables and functions */
uint16_t peek16(const uint16_t *address) { return (*address); }


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

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

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

LLVM IR (-O2):
define i32 @peek16(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
/* Variables and functions */
void glmSub3fs(float out[3], const float x[3], float y) {
  for (size_t i = 0; i < 3; ++i)
    out[i] = x[i] - y;
}


x86 assembly (clang, -O0):
<glmSub3fs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x3,-0x20(%rbp)
jae    1154 <glmSub3fs+0x54>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
subss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1119 <glmSub3fs+0x19>
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmSub3fs>:
movss  (%rsi),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,(%rdi)
movss  0x4(%rsi),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x4(%rdi)
movss  0x8(%rsi),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @glmSub3fs(float* nocapture writeonly %0, float* nocapture %1, float %2) {
%4 = load float, float* %1
%5 = fsub float %4, %2
store float %5, float* %0
%6 = getelementptr inbounds float, float* %1, i64 1
%7 = load float, float* %6
%8 = fsub float %7, %2
%9 = getelementptr inbounds float, float* %0, i64 1
store float %8, float* %9
%10 = getelementptr inbounds float, float* %1, i64 2
%11 = load float, float* %10
%12 = fsub float %11, %2
%13 = getelementptr inbounds float, float* %0, i64 2
store float %12, float* %13
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
void print_res(const char *pass) {
  printf("-------------\nPass - %s\n-------------\n", pass);
  exit(0);
}


x86 assembly (clang, -O0):
<print_res>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_res>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"-------------\0APass - %s\0A-------------\0A\00"
define void @print_res(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [39 x i8] c"-------------\0APass - %s\0A-------------\0A\00"
define void @print_res(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ acc_device_t;

/* Variables and functions */
int /*<<< orphan*/ acc_device_host;
int /*<<< orphan*/ acc_init(int /*<<< orphan*/);
int main(int argc, char **argv) {
  acc_device_t devtype = acc_device_host;
  acc_init(devtype);
  acc_init(devtype);
  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    0x2eb3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <acc_init@plt>
mov    -0x14(%rbp),%edi
call   1030 <acc_init@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@acc_device_host = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @acc_device_host
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = call i32 @acc_init(i32 %8)
%10 = load i32, i32* %6
%11 = call i32 @acc_init(i32 %10)
ret i32 0
}

LLVM IR (-O2):
@acc_device_host = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @acc_device_host
%4 = tail call i32 @acc_init(i32 %3)
%5 = tail call i32 @acc_init(i32 %3)
ret i32 0
}
double f(double x) {
  double ret;
  ret = 4.0 / (x * x + 1.0);
  return ret;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xee9(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xed5(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mulsd  %xmm0,%xmm0
addsd  0xef4(%rip),%xmm0
movsd  0xef4(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = load double, double* %2
%6 = call double @llvm.fmuladd.f64(double %4, double %5, double 1.000000e+00)
%7 = fdiv double 4.000000e+00, %6
store double %7, double* %3
%8 = load double, double* %3
ret double %8
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double %0, double 1.000000e+00)
%3 = fdiv double 4.000000e+00, %2
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int chown(char const *, int /*<<< orphan*/, int /*<<< orphan*/);
int __chown(const char *file, uid_t owner, gid_t group) {
  return chown(file, owner, group);
}


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

x86 assembly (clang, -O2):
<__chown>:
jmp    1030 <chown@plt>

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

LLVM IR (-O2):
define i32 @__chown(i8* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @chown(i8* %0, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void printTriangleArea(double area) { printf("%.2lf", area); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"%.2lf\00"
define void @printTriangleArea(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %3)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.2lf\00"
define void @printTriangleArea(double %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %0)
ret void
}
void sti(void) { __asm volatile("sti"); }


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

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

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

LLVM IR (-O2):
define void @sti() {
tail call void asm sideeffect "sti", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
struct ncprange {
  int dummy;
};
struct ncpaddr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ncprange_sethost(struct ncprange *, struct ncpaddr const *);
int /*<<< orphan*/ ncprange_setwidth(struct ncprange *, int);
void ncprange_set(struct ncprange *range, const struct ncpaddr *addr,
                  int width) {
  ncprange_sethost(range, addr);
  ncprange_setwidth(range, width);
}


x86 assembly (clang, -O0):
<ncprange_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ncprange_sethost@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <ncprange_setwidth@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncprange_set>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
call   1030 <ncprange_sethost@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <ncprange_setwidth@plt>

LLVM IR (-O0):
%struct.ncprange = type { i32 }
%struct.ncpaddr = type { i32 }
define void @ncprange_set(%struct.ncprange* %0, %struct.ncpaddr* %1, i32 %2) {
%4 = alloca %struct.ncprange*
%5 = alloca %struct.ncpaddr*
%6 = alloca i32
store %struct.ncprange* %0, %struct.ncprange** %4
store %struct.ncpaddr* %1, %struct.ncpaddr** %5
store i32 %2, i32* %6
%7 = load %struct.ncprange*, %struct.ncprange** %4
%8 = load %struct.ncpaddr*, %struct.ncpaddr** %5
%9 = call i32 @ncprange_sethost(%struct.ncprange* %7, %struct.ncpaddr* %8)
%10 = load %struct.ncprange*, %struct.ncprange** %4
%11 = load i32, i32* %6
%12 = call i32 @ncprange_setwidth(%struct.ncprange* %10, i32 %11)
ret void
}

LLVM IR (-O2):
%struct.ncprange = type { i32 }
%struct.ncpaddr = type { i32 }
define void @ncprange_set(%struct.ncprange* %0, %struct.ncpaddr* %1, i32 %2) {
%4 = tail call i32 @ncprange_sethost(%struct.ncprange* %0, %struct.ncpaddr* %1)
%5 = tail call i32 @ncprange_setwidth(%struct.ncprange* %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ perror(char *);
void *realloc(void *, size_t);
void *utils_realloc(void *ptr, size_t size) {
  assert(ptr != NULL);
  assert(size > 0);
  if (!(ptr = realloc(ptr, size))) {
    perror("realloc()");
    abort();
  }
  return ptr;
}


x86 assembly (clang, -O0):
<utils_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    11a2 <utils_realloc+0x62>
lea    0xe6a(%rip),%rdi
call   1060 <perror@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utils_realloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <realloc@plt>
test   %rax,%rax
je     117e <utils_realloc+0x3e>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe7b(%rip),%rdi
call   1060 <perror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"realloc()\00"
define i8* @utils_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i64, i64* %4
%10 = icmp ugt i64 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i8*, i8** %3
%14 = load i64, i64* %4
%15 = call i8* @realloc(i8* %13, i64 %14)
store i8* %15, i8** %3
%16 = icmp ne i8* %15, null
br i1 %16, label %20, label %17
17: ; preds = %2
%18 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%19 = call i32 (...) @abort()
unreachable
20: ; preds = %2
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
@.str = [10 x i8] c"realloc()\00"
define noalias i8* @utils_realloc(i8* %0, i64 %1) {
%3 = icmp ne i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ne i64 %1, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i8* @realloc(i8* %0, i64 %1)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 (...) @abort()
unreachable
14: ; preds = %2
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, float);
int main() {
  int fahr;
  float celsius;
  fahr = 0;
  while (fahr <= 300) {
    celsius = 5.0 * (fahr - 32) / 9.0;
    printf("%d\t%5.1f\n", fahr, celsius);
    fahr = fahr + 20;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x12c,-0x8(%rbp)
jg     1180 <main+0x70>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
cvtsi2sd %eax,%xmm1
movsd  0xec3(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeaf(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm0
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x14,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0xffffffe0,%ebx
lea    0xef0(%rip),%r14
lea    0x20(%rbx),%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xece(%rip),%xmm0
divsd  0xece(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x14,%ebx
cmp    $0x119,%ebp
jb     1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%d\09%5.1f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 300
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 32
%10 = sitofp i32 %9 to double
%11 = fmul double 5.000000e+00, %10
%12 = fdiv double %11, 9.000000e+00
%13 = fptrunc double %12 to float
store float %13, float* %3
%14 = load i32, i32* %2
%15 = load float, float* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %14, float %15)
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 20
store i32 %18, i32* %2
br label %4
19: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d\09%5.1f\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %9, %1 ]
%3 = add nsw i32 %2, -32
%4 = sitofp i32 %3 to double
%5 = fmul double %4, 5.000000e+00
%6 = fdiv double %5, 9.000000e+00
%7 = fptrunc double %6 to float
%8 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2, float %7)
%9 = add nuw nsw i32 %2, 20
%10 = icmp ult i32 %2, 281
br i1 %10, label %1, label %11
11: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printHelp() {
  printf("Help for ledc250:\n");
  printf("this programm lets the led blink with a default freq of 250Hz \n");
}


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"Help for ledc250:\0A\00"
@.str.1 = [64 x i8] c"this programm lets the led blink with a default freq of 250Hz \0A\00"
define void @printHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [18 x i8] c"Help for ledc250:\00"
@str.2 = [63 x i8] c"this programm lets the led blink with a default freq of 250Hz \00"
define void @printHelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int func(int);
int main(int argc, char *argv[]) {
  int i = 0;
  for (i = 0; i < 100; i++) {
    int ret = func(i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    1157 <main+0x47>
mov    -0x14(%rbp),%edi
call   1030 <func@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <func@plt>
add    $0x1,%ebx
cmp    $0x64,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %6, %3 ]
%5 = tail call i32 @func(i32 %4)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, 100
br i1 %7, label %8, label %3
8: ; preds = %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char var1;
  printf("Enter character: \n");
  scanf("%c", &var1);
  printf("You entered %c.\n", var1);
  printf("ASCII value is %d.\n", var1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x5(%rbp),%esi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%esi
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x7(%rsp),%esi
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter character: \0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [17 x i8] c"You entered %c.\0A\00"
@.str.3 = [20 x i8] c"ASCII value is %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* 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.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [17 x i8] c"You entered %c.\0A\00"
@.str.3 = [20 x i8] c"ASCII value is %d.\0A\00"
@str = [18 x i8] c"Enter character: \00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Type definitions */
typedef unsigned long long uint64_t;
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
unsigned long long gettime_us(int /*<<< orphan*/);
uint64_t gettime_ms(clockid_t clk_id) { return gettime_us(clk_id) / 1000ULL; }


x86 assembly (clang, -O0):
<gettime_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <gettime_us@plt>
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettime_ms>:
push   %rax
call   1030 <gettime_us@plt>
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
mov    %rdx,%rax
shr    $0x4,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @gettime_ms(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @gettime_us(i32 %3)
%5 = udiv i64 %4, 1000
ret i64 %5
}

LLVM IR (-O2):
define i64 @gettime_ms(i32 %0) {
%2 = tail call i64 @gettime_us(i32 %0)
%3 = udiv i64 %2, 1000
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ isblank(char);
int main() {
  assert(isblank(' '));
  assert(isblank('    '));
  assert(isblank('    '));
  assert(isblank('\t'));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20,%edi
call   1030 <isblank@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    $0x20,%edi
call   1030 <isblank@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    $0x20,%edi
call   1030 <isblank@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    $0x9,%edi
call   1030 <isblank@plt>
mov    %eax,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x20,%edi
call   1030 <isblank@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    $0x20,%edi
call   1030 <isblank@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    $0x20,%edi
call   1030 <isblank@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    $0x9,%edi
call   1030 <isblank@plt>
mov    %eax,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @isblank(i8 signext 32)
%2 = call i32 @assert(i32 %1)
%3 = call i32 @isblank(i8 signext 32)
%4 = call i32 @assert(i32 %3)
%5 = call i32 @isblank(i8 signext 32)
%6 = call i32 @assert(i32 %5)
%7 = call i32 @isblank(i8 signext 9)
%8 = call i32 @assert(i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @isblank(i8 signext 32)
%2 = tail call i32 @assert(i32 %1)
%3 = tail call i32 @isblank(i8 signext 32)
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @isblank(i8 signext 32)
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @isblank(i8 signext 9)
%8 = tail call i32 @assert(i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void welcome() {
  printf("This is free software with ABSOLUTELY NO WARRANTY.\n");
  printf("For details type `warranty'. \n");
}


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

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

LLVM IR (-O0):
@.str = [52 x i8] c"This is free software with ABSOLUTELY NO WARRANTY.\0A\00"
@.str.1 = [31 x i8] c"For details type `warranty'. \0A\00"
define void @welcome() {
%1 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [51 x i8] c"This is free software with ABSOLUTELY NO WARRANTY.\00"
@str.2 = [30 x i8] c"For details type `warranty'. \00"
define void @welcome() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ wrap_array_export(int **, int **, int **, int **, int **,
                                     char **);
void export_fold_arrays(int **f5_p, int **c_p, int **fML_p, int **fM1_p,
                        int **indx_p, char **ptype_p) {
  wrap_array_export(f5_p, c_p, fML_p, fM1_p, indx_p, ptype_p);
}


x86 assembly (clang, -O0):
<export_fold_arrays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <wrap_array_export@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<export_fold_arrays>:
jmp    1030 <wrap_array_export@plt>

LLVM IR (-O0):
define void @export_fold_arrays(i32** %0, i32** %1, i32** %2, i32** %3, i32** %4, i8** %5) {
%7 = alloca i32**
%8 = alloca i32**
%9 = alloca i32**
%10 = alloca i32**
%11 = alloca i32**
%12 = alloca i8**
store i32** %0, i32*** %7
store i32** %1, i32*** %8
store i32** %2, i32*** %9
store i32** %3, i32*** %10
store i32** %4, i32*** %11
store i8** %5, i8*** %12
%13 = load i32**, i32*** %7
%14 = load i32**, i32*** %8
%15 = load i32**, i32*** %9
%16 = load i32**, i32*** %10
%17 = load i32**, i32*** %11
%18 = load i8**, i8*** %12
%19 = call i32 @wrap_array_export(i32** %13, i32** %14, i32** %15, i32** %16, i32** %17, i8** %18)
ret void
}

LLVM IR (-O2):
define void @export_fold_arrays(i32** %0, i32** %1, i32** %2, i32** %3, i32** %4, i8** %5) {
%7 = tail call i32 @wrap_array_export(i32** %0, i32** %1, i32** %2, i32** %3, i32** %4, i8** %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ devide_merge(int *, int /*<<< orphan*/, int);
void merge_sort(int array[], int size) { devide_merge(array, 0, size - 1); }


x86 assembly (clang, -O0):
<merge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <devide_merge@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_sort>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <devide_merge@plt>

LLVM IR (-O0):
define void @merge_sort(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 = sub nsw i32 %6, 1
%8 = call i32 @devide_merge(i32* %5, i32 0, i32 %7)
ret void
}

LLVM IR (-O2):
define void @merge_sort(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @devide_merge(i32* %0, i32 0, i32 %3)
ret void
}
/* Variables and functions */
int strlen(unsigned char *);
int checkInitForChar(unsigned char *str) {
  int i = 0;
  int result = 0;
  for (i = 0; i < strlen(str); i++) {
    result += str[i];
  }
  return result;
}


x86 assembly (clang, -O0):
<checkInitForChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    116d <checkInitForChar+0x5d>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <checkInitForChar+0x21>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkInitForChar>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    114c <checkInitForChar+0x3c>
xor    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%r14,%rbx,1),%eax
add    %eax,%ebp
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1130 <checkInitForChar+0x20>
jmp    114e <checkInitForChar+0x3e>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @checkInitForChar(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %15
4: ; preds = %1, %4
%5 = phi i64 [ %11, %4 ], [ 0, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %5
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = add nuw nsw i32 %6, %9
%11 = add nuw nsw i64 %5, 1
%12 = tail call i32 @strlen(i8* %0)
%13 = sext i32 %12 to i64
%14 = icmp slt i64 %11, %13
br i1 %14, label %4, label %15
15: ; preds = %4, %1
%16 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %16
}
int XGetWMName() {}


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

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

LLVM IR (-O0):
define i32 @XGetWMName() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @XGetWMName() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
char *strdup(char *);
__attribute__((no, noclone)) char *bar(int r) {
  char buf[10] = {};
  strcat(buf, r ? "r" : "w");
  strcat(buf, "b");
  return strdup(buf);
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <memset@plt>
lea    -0xe(%rbp),%rdi
mov    -0x4(%rbp),%ecx
lea    0xea9(%rip),%rsi
lea    0xea0(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
call   1040 <strcat@plt>
lea    -0xe(%rbp),%rdi
lea    0xe8d(%rip),%rsi
call   1040 <strcat@plt>
lea    -0xe(%rbp),%rdi
call   1050 <strdup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rbx
sub    $0x10,%rsp
movw   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
test   %edi,%edi
lea    0xec5(%rip),%rax
lea    0xebc(%rip),%rsi
cmove  %rax,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcat@plt>
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcat@plt>
mov    %rbx,%rdi
call   1040 <strdup@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"b\00"
define i8* @bar(i32 %0) {
%2 = alloca i32
%3 = alloca [10 x i8]
store i32 %0, i32* %2
%4 = bitcast [10 x i8]* %3 to i8*
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%10 = call i32 @strcat(i8* %5, i8* %9)
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%12 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%14 = call i8* @strdup(i8* %13)
ret i8* %14
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"b\00"
define noalias i8* @bar(i32 %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
%6 = call i32 @strcat(i8* %3, i8* %5)
%7 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = call i8* @strdup(i8* %3)
ret i8* %8
}
void fn1(int p) { (void)p; }


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

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

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

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


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @fn0()
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int pte_type(uint64_t *pte) { return *pte & (3 << 0); }


x86 assembly (clang, -O0):
<pte_type>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pte_type>:
mov    (%rdi),%eax
and    $0x3,%eax
ret

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

LLVM IR (-O2):
define i32 @pte_type(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 3
ret i32 %3
}
int gfx_set_tv_output(int output) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @gfx_set_tv_output(i32 %0) {
ret i32 0
}
char *grecs_meta1_stpcpy(char *grecs_meta1_dest, const char *grecs_meta1_src) {
  char *grecs_meta1_d = grecs_meta1_dest;
  const char *grecs_meta1_s = grecs_meta1_src;
  while ((*grecs_meta1_d++ = *grecs_meta1_s++) != '\0')
    continue;
  return grecs_meta1_d - 1;
}


x86 assembly (clang, -O0):
<grecs_meta1_stpcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     114f <grecs_meta1_stpcpy+0x4f>
jmp    111c <grecs_meta1_stpcpy+0x1c>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<grecs_meta1_stpcpy>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl (%rsi),%ecx
add    $0x1,%rsi
mov    %cl,0x1(%rax)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <grecs_meta1_stpcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @grecs_meta1_stpcpy(i8* writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %4
}
int x0_teardown() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @x0_teardown() {
ret i32 0
}
void _ZN9__gnu_cxx13new_allocatorIPiED2Ev(
    struct l_class_OC_DummyStream *llvm_cbe_this) {
  unsigned char *llvm_cbe__rethrow;
  struct l_class_OC_DummyStream *llvm_cbe_this_2e_addr;
  struct l_class_OC_DummyStream *llvm_cbe_this1;
  *(&llvm_cbe_this_2e_addr) = llvm_cbe_this;
  llvm_cbe_this1 = *(&llvm_cbe_this_2e_addr);
  return;
}


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

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

LLVM IR (-O0):
%struct.l_class_OC_DummyStream = type opaque
define void @_ZN9__gnu_cxx13new_allocatorIPiED2Ev(%struct.l_class_OC_DummyStream* %0) {
%2 = alloca %struct.l_class_OC_DummyStream*
%3 = alloca i8*
%4 = alloca %struct.l_class_OC_DummyStream*
%5 = alloca %struct.l_class_OC_DummyStream*
store %struct.l_class_OC_DummyStream* %0, %struct.l_class_OC_DummyStream** %2
%6 = load %struct.l_class_OC_DummyStream*, %struct.l_class_OC_DummyStream** %2
store %struct.l_class_OC_DummyStream* %6, %struct.l_class_OC_DummyStream** %4
%7 = load %struct.l_class_OC_DummyStream*, %struct.l_class_OC_DummyStream** %4
store %struct.l_class_OC_DummyStream* %7, %struct.l_class_OC_DummyStream** %5
ret void
}

LLVM IR (-O2):
%struct.l_class_OC_DummyStream = type opaque
define void @_ZN9__gnu_cxx13new_allocatorIPiED2Ev(%struct.l_class_OC_DummyStream* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ test_limit();
int main(int argc, char **argv) {
  int ret = 0;
  ret += test_limit();
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <test_limit@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = call i64 (...) @test_limit()
%8 = load i32, i32* %6
%9 = sext i32 %8 to i64
%10 = add nsw i64 %9, %7
%11 = trunc i64 %10 to i32
store i32 %11, i32* %6
%12 = load i32, i32* %6
ret i32 %12
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @test_limit()
%4 = trunc i64 %3 to i32
ret i32 %4
}
int FiveTimes(int a) { return a << 2 + a; }


x86 assembly (clang, -O0):
<FiveTimes>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x2,%ecx
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FiveTimes>:
mov    %edi,%eax
lea    0x2(%rax),%ecx
shl    %cl,%eax
ret

LLVM IR (-O0):
define i32 @FiveTimes(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 2, %4
%6 = shl i32 %3, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @FiveTimes(i32 %0) {
%2 = add nsw i32 %0, 2
%3 = shl i32 %0, %2
ret i32 %3
}
number(str) char *str;
{
  register n;
  register char *s;
  n = 0;
  for (s = str; *s; s++)
    if (*s >= '0' && *s <= '9')
      n = n * 10 + *s - '0';
  return (n);
}


x86 assembly (clang, -O0):
<number>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     116d <number+0x6d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1157 <number+0x57>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     1157 <number+0x57>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
jmp    115c <number+0x5c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <number+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<number>:
mov    (%rdi),%dl
test   %dl,%dl
je     1131 <number+0x31>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
movsbl %dl,%eax
lea    -0x30(%rax),%edx
cmp    $0xa,%dl
lea    (%rcx,%rcx,4),%edx
lea    -0x30(%rax,%rdx,2),%eax
cmovae %ecx,%eax
movzbl (%rdi),%edx
add    $0x1,%rdi
mov    %eax,%ecx
test   %dl,%dl
jne    1110 <number+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @number(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %18, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %16, %4 ], [ %2, %1 ]
%6 = phi i8* [ %15, %4 ], [ %0, %1 ]
%7 = phi i32 [ %14, %4 ], [ 0, %1 ]
%8 = sext i8 %5 to i32
%9 = add i8 %5, -48
%10 = icmp ult i8 %9, 10
%11 = mul nsw i32 %7, 10
%12 = add i32 %11, -48
%13 = add i32 %12, %8
%14 = select i1 %10, i32 %13, i32 %7
%15 = getelementptr inbounds i8, i8* %6, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %4
18: ; preds = %4, %1
%19 = phi i32 [ 0, %1 ], [ %14, %4 ]
ret i32 %19
}