#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 powf(float, double);
float p(float x) {
  float ret, tmp;
  ret = x * (2 / 3.1416);
  tmp = 1 - (powf(x, 2.0) / 6) + (powf(x, 4.0) / 40) + (powf(x, 6.0) / 336) +
        (powf(x, 8.0) / 3456);
  ret = ret * tmp;
  return ret;
}


x86 assembly (clang, -O0):
<p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xef2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movsd  0xed0(%rip),%xmm1
call   1030 <powf@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
call   1030 <powf@plt>
mov    $0x28,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
movsd  0xe76(%rip),%xmm1
call   1030 <powf@plt>
mov    $0x150,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movsd  0xe4a(%rip),%xmm1
call   1030 <powf@plt>
mov    $0xd80,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p>:
push   %r14
push   %rbx
push   %rax
movaps %xmm0,%xmm2
movss  %xmm0,(%rsp)
cvtss2sd %xmm0,%xmm0
mulsd  0xed8(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
movsd  0xece(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <powf@plt>
cltq
imul   $0xffffffffd5555555,%rax,%r14
mov    %r14,%rax
shr    $0x3f,%rax
shr    $0x20,%r14
add    %eax,%r14d
movsd  0xeaf(%rip),%xmm1
movss  (%rsp),%xmm0
call   1030 <powf@plt>
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x24,%rbx
add    %eax,%ebx
add    %r14d,%ebx
movsd  0xe8c(%rip),%xmm1
movss  (%rsp),%xmm0
call   1030 <powf@plt>
cltq
imul   $0x30c30c31,%rax,%r14
mov    %r14,%rax
shr    $0x3f,%rax
sar    $0x26,%r14
add    %eax,%r14d
add    %ebx,%r14d
movsd  0xe68(%rip),%xmm1
movss  (%rsp),%xmm0
call   1030 <powf@plt>
cltq
imul   $0x4bda12f7,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2a,%rax
add    %ecx,%eax
add    %r14d,%eax
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x4(%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define float @p(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fmul double %6, 0x3FE45F2D4E8DB8F2
%8 = fptrunc double %7 to float
store float %8, float* %3
%9 = load float, float* %2
%10 = call i32 @powf(float %9, double 2.000000e+00)
%11 = sdiv i32 %10, 6
%12 = sub nsw i32 1, %11
%13 = load float, float* %2
%14 = call i32 @powf(float %13, double 4.000000e+00)
%15 = sdiv i32 %14, 40
%16 = add nsw i32 %12, %15
%17 = load float, float* %2
%18 = call i32 @powf(float %17, double 6.000000e+00)
%19 = sdiv i32 %18, 336
%20 = add nsw i32 %16, %19
%21 = load float, float* %2
%22 = call i32 @powf(float %21, double 8.000000e+00)
%23 = sdiv i32 %22, 3456
%24 = add nsw i32 %20, %23
%25 = sitofp i32 %24 to float
store float %25, float* %4
%26 = load float, float* %3
%27 = load float, float* %4
%28 = fmul float %26, %27
store float %28, float* %3
%29 = load float, float* %3
ret float %29
}

LLVM IR (-O2):
define float @p(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 0x3FE45F2D4E8DB8F2
%4 = fptrunc double %3 to float
%5 = tail call i32 @powf(float %0, double 2.000000e+00)
%6 = sdiv i32 %5, -6
%7 = add nsw i32 %6, 1
%8 = tail call i32 @powf(float %0, double 4.000000e+00)
%9 = sdiv i32 %8, 40
%10 = add nsw i32 %7, %9
%11 = tail call i32 @powf(float %0, double 6.000000e+00)
%12 = sdiv i32 %11, 336
%13 = add nsw i32 %10, %12
%14 = tail call i32 @powf(float %0, double 8.000000e+00)
%15 = sdiv i32 %14, 3456
%16 = add nsw i32 %13, %15
%17 = sitofp i32 %16 to float
%18 = fmul float %4, %17
ret float %18
}