#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 fact(int);
int pown(int, double);
double sinmc(double x) {
  double value = x;
  int sign = -1;
  int i;
  for (i = 3; i < 30; i += 2) {
    value += sign * (pown(i, x) / fact(i));
    sign *= -1;
  }
  return value;
}


x86 assembly (clang, -O0):
<sinmc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x3,-0x18(%rbp)
cmpl   $0x1e,-0x18(%rbp)
jge    11a0 <sinmc+0x80>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
movsd  -0x8(%rbp),%xmm0
call   1030 <pown@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <fact@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
imul   $0xffffffff,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
jmp    1145 <sinmc+0x25>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinmc>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0xffffffff,%ebp
mov    $0x1,%ebx
movsd  %xmm0,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
add    $0x2,%ebx
mov    %ebx,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <pown@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1040 <fact@plt>
mov    %eax,%ecx
mov    %r14d,%eax
cltd
idiv   %ecx
imul   %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
neg    %ebp
cmp    $0x1c,%ebx
jb     1140 <sinmc+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @sinmc(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
store double %0, double* %2
%6 = load double, double* %2
store double %6, double* %3
store i32 -1, i32* %4
store i32 3, i32* %5
br label %7
7: ; preds = %24, %1
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 30
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = load double, double* %2
%14 = call i32 @pown(i32 %12, double %13)
%15 = load i32, i32* %5
%16 = call i32 @fact(i32 %15)
%17 = sdiv i32 %14, %16
%18 = mul nsw i32 %11, %17
%19 = sitofp i32 %18 to double
%20 = load double, double* %3
%21 = fadd double %20, %19
store double %21, double* %3
%22 = load i32, i32* %4
%23 = mul nsw i32 %22, -1
store i32 %23, i32* %4
br label %24
24: ; preds = %10
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 2
store i32 %26, i32* %5
br label %7
27: ; preds = %7
%28 = load double, double* %3
ret double %28
}

LLVM IR (-O2):
define double @sinmc(double %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 3, %1 ], [ %13, %2 ]
%4 = phi i32 [ -1, %1 ], [ %12, %2 ]
%5 = phi double [ %0, %1 ], [ %11, %2 ]
%6 = tail call i32 @pown(i32 %3, double %0)
%7 = tail call i32 @fact(i32 %3)
%8 = sdiv i32 %6, %7
%9 = mul nsw i32 %8, %4
%10 = sitofp i32 %9 to double
%11 = fadd double %5, %10
%12 = sub nsw i32 0, %4
%13 = add nuw nsw i32 %3, 2
%14 = icmp ult i32 %3, 28
br i1 %14, label %2, label %15
15: ; preds = %2
ret double %11
}