#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int pow(int, int);
void distance_and_velocity(int t, float v_ini_1, float a, float v_ini_2,
                           float t1, float *dptr, float *vptr) {
  float d1_final;
  if (t <= t1) {
    *dptr = v_ini_1 * t + (1 / 2) * a * pow(t, 2);
    *vptr = v_ini_1 + a * t;
  } else {
    d1_final = v_ini_1 * t + (1 / 2) * a * pow(t, 2);
    *dptr = d1_final + (v_ini_2 * (t - t1) - (1 / 2) * a * pow((t - t1), 2));
    *vptr = v_ini_2 - a * (t - t1);
  }
}


x86 assembly (clang, -O0):
<distance_and_velocity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11c3 <distance_and_velocity+0xb3>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
movss  -0x38(%rbp),%xmm1
movss  -0x34(%rbp),%xmm0
movss  -0x30(%rbp),%xmm2
cvtsi2ss %eax,%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x4(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
jmp    12cb <distance_and_velocity+0x1bb>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x50(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
xorps  %xmm0,%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
movss  -0x54(%rbp),%xmm1
movss  -0x50(%rbp),%xmm0
movss  -0x4c(%rbp),%xmm2
cvtsi2ss %eax,%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
cvttss2si %xmm0,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
movss  -0x48(%rbp),%xmm2
movss  -0x44(%rbp),%xmm1
movss  -0x40(%rbp),%xmm3
movss  -0x3c(%rbp),%xmm0
cvtsi2ss %eax,%xmm4
mulss  %xmm4,%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
addss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x4(%rbp),%xmm2
subss  -0x14(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance_and_velocity>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
movss  %xmm3,0x8(%rsp)
movss  %xmm2,0x14(%rsp)
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %edi,%xmm0
movss  %xmm0,0xc(%rsp)
mov    $0x2,%esi
call   1030 <pow@plt>
movss  0x8(%rsp),%xmm5
movss  0x4(%rsp),%xmm4
movss  0xc(%rsp),%xmm2
movss  0x10(%rsp),%xmm1
ucomiss %xmm2,%xmm5
xorps  %xmm3,%xmm3
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm1,%xmm3
mulss  %xmm3,%xmm0
movaps %xmm4,%xmm6
mulss  %xmm2,%xmm6
addss  %xmm0,%xmm6
jae    11f0 <distance_and_velocity+0xe0>
subss  %xmm5,%xmm2
movss  %xmm2,0xc(%rsp)
cvttss2si %xmm2,%edi
mov    $0x2,%esi
movss  %xmm3,0x4(%rsp)
movss  %xmm6,0x8(%rsp)
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0x4(%rsp),%xmm3
mulss  %xmm0,%xmm3
movss  0x14(%rsp),%xmm1
movaps %xmm1,%xmm0
movss  0xc(%rsp),%xmm2
mulss  %xmm2,%xmm0
subss  %xmm3,%xmm0
movss  0x8(%rsp),%xmm3
addss  %xmm0,%xmm3
movss  %xmm3,(%rbx)
movss  0x10(%rsp),%xmm0
mulss  %xmm2,%xmm0
subss  %xmm0,%xmm1
jmp    11fc <distance_and_velocity+0xec>
movss  %xmm6,(%rbx)
mulss  %xmm2,%xmm1
addss  %xmm4,%xmm1
movss  %xmm1,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @distance_and_velocity(i32 %0, float %1, float %2, float %3, float %4, float* %5, float* %6) {
%8 = alloca i32
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float*
%14 = alloca float*
%15 = alloca float
store i32 %0, i32* %8
store float %1, float* %9
store float %2, float* %10
store float %3, float* %11
store float %4, float* %12
store float* %5, float** %13
store float* %6, float** %14
%16 = load i32, i32* %8
%17 = sitofp i32 %16 to float
%18 = load float, float* %12
%19 = fcmp ole float %17, %18
br i1 %19, label %20, label %38
20: ; preds = %7
%21 = load float, float* %9
%22 = load i32, i32* %8
%23 = sitofp i32 %22 to float
%24 = load float, float* %10
%25 = fmul float 0.000000e+00, %24
%26 = load i32, i32* %8
%27 = call i32 @pow(i32 %26, i32 2)
%28 = sitofp i32 %27 to float
%29 = fmul float %25, %28
%30 = call float @llvm.fmuladd.f32(float %21, float %23, float %29)
%31 = load float*, float** %13
store float %30, float* %31
%32 = load float, float* %9
%33 = load float, float* %10
%34 = load i32, i32* %8
%35 = sitofp i32 %34 to float
%36 = call float @llvm.fmuladd.f32(float %33, float %35, float %32)
%37 = load float*, float** %14
store float %36, float* %37
br label %78
38: ; preds = %7
%39 = load float, float* %9
%40 = load i32, i32* %8
%41 = sitofp i32 %40 to float
%42 = load float, float* %10
%43 = fmul float 0.000000e+00, %42
%44 = load i32, i32* %8
%45 = call i32 @pow(i32 %44, i32 2)
%46 = sitofp i32 %45 to float
%47 = fmul float %43, %46
%48 = call float @llvm.fmuladd.f32(float %39, float %41, float %47)
store float %48, float* %15
%49 = load float, float* %15
%50 = load float, float* %11
%51 = load i32, i32* %8
%52 = sitofp i32 %51 to float
%53 = load float, float* %12
%54 = fsub float %52, %53
%55 = load float, float* %10
%56 = fmul float 0.000000e+00, %55
%57 = load i32, i32* %8
%58 = sitofp i32 %57 to float
%59 = load float, float* %12
%60 = fsub float %58, %59
%61 = fptosi float %60 to i32
%62 = call i32 @pow(i32 %61, i32 2)
%63 = sitofp i32 %62 to float
%64 = fmul float %56, %63
%65 = fneg float %64
%66 = call float @llvm.fmuladd.f32(float %50, float %54, float %65)
%67 = fadd float %49, %66
%68 = load float*, float** %13
store float %67, float* %68
%69 = load float, float* %11
%70 = load float, float* %10
%71 = load i32, i32* %8
%72 = sitofp i32 %71 to float
%73 = load float, float* %12
%74 = fsub float %72, %73
%75 = fneg float %70
%76 = call float @llvm.fmuladd.f32(float %75, float %74, float %69)
%77 = load float*, float** %14
store float %76, float* %77
br label %78
78: ; preds = %38, %20
ret void
}

LLVM IR (-O2):
define void @distance_and_velocity(i32 %0, float %1, float %2, float %3, float %4, float* nocapture writeonly %5, float* nocapture writeonly %6) {
%8 = sitofp i32 %0 to float
%9 = fcmp ugt float %8, %4
%10 = fmul float %2, 0.000000e+00
%11 = tail call i32 @pow(i32 %0, i32 2)
%12 = sitofp i32 %11 to float
%13 = fmul float %10, %12
%14 = tail call float @llvm.fmuladd.f32(float %1, float %8, float %13)
br i1 %9, label %17, label %15
15: ; preds = %7
store float %14, float* %5
%16 = tail call float @llvm.fmuladd.f32(float %2, float %8, float %1)
br label %28
17: ; preds = %7
%18 = fsub float %8, %4
%19 = fptosi float %18 to i32
%20 = tail call i32 @pow(i32 %19, i32 2)
%21 = sitofp i32 %20 to float
%22 = fneg float %10
%23 = fmul float %22, %21
%24 = tail call float @llvm.fmuladd.f32(float %3, float %18, float %23)
%25 = fadd float %14, %24
store float %25, float* %5
%26 = fneg float %2
%27 = tail call float @llvm.fmuladd.f32(float %26, float %18, float %3)
br label %28
28: ; preds = %17, %15
%29 = phi float [ %27, %17 ], [ %16, %15 ]
store float %29, float* %6
ret void
}