#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 */
float cos(double);
float sin(double);
void posit(int np, int nr, float *ax, float *ay, float *mx, float *my) {
  float sinth = sin(3.14159265359 / 180 * np);
  float costh = cos(3.14159265359 / 180 * np);
  int ind = nr - 384;
  int rwidth = 1;
  float tmp_length = (float)ind * rwidth;
  *ax = -sinth * tmp_length;
  *ay = costh * tmp_length;
  *mx = costh;
  *my = sinth;
}


x86 assembly (clang, -O0):
<posit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xeb5(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x2c(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe9a(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x180,%eax
mov    %eax,-0x34(%rbp)
movl   $0x1,-0x38(%rbp)
cvtsi2ssl -0x34(%rbp),%xmm0
cvtsi2ssl -0x38(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x2c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x3c(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x30(%rbp),%xmm0
mulss  -0x3c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x2c(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<posit>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %esi,%ebp
cvtsi2sd %edi,%xmm0
mulsd  0xeba(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
movapd %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
add    $0xfffffe80,%ebp
cvtsi2ss %ebp,%xmm1
movaps 0xe9d(%rip),%xmm2
movaps 0x10(%rsp),%xmm3
xorps  %xmm3,%xmm2
mulss  %xmm1,%xmm2
movss  %xmm2,(%rbx)
mulss  %xmm0,%xmm1
movss  %xmm1,(%r12)
movss  %xmm0,(%r15)
movss  %xmm3,(%r14)
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @posit(i32 %0, i32 %1, float* %2, float* %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca float*
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float
%14 = alloca float
%15 = alloca i32
%16 = alloca i32
%17 = alloca float
store i32 %0, i32* %7
store i32 %1, i32* %8
store float* %2, float** %9
store float* %3, float** %10
store float* %4, float** %11
store float* %5, float** %12
%18 = load i32, i32* %7
%19 = sitofp i32 %18 to double
%20 = fmul double 0x3F91DF46A2529E84, %19
%21 = call float @sin(double %20)
store float %21, float* %13
%22 = load i32, i32* %7
%23 = sitofp i32 %22 to double
%24 = fmul double 0x3F91DF46A2529E84, %23
%25 = call float @cos(double %24)
store float %25, float* %14
%26 = load i32, i32* %8
%27 = sub nsw i32 %26, 384
store i32 %27, i32* %15
store i32 1, i32* %16
%28 = load i32, i32* %15
%29 = sitofp i32 %28 to float
%30 = load i32, i32* %16
%31 = sitofp i32 %30 to float
%32 = fmul float %29, %31
store float %32, float* %17
%33 = load float, float* %13
%34 = fneg float %33
%35 = load float, float* %17
%36 = fmul float %34, %35
%37 = load float*, float** %9
store float %36, float* %37
%38 = load float, float* %14
%39 = load float, float* %17
%40 = fmul float %38, %39
%41 = load float*, float** %10
store float %40, float* %41
%42 = load float, float* %14
%43 = load float*, float** %11
store float %42, float* %43
%44 = load float, float* %13
%45 = load float*, float** %12
store float %44, float* %45
ret void
}

LLVM IR (-O2):
define void @posit(i32 %0, i32 %1, float* nocapture writeonly %2, float* nocapture writeonly %3, float* nocapture writeonly %4, float* nocapture writeonly %5) {
%7 = sitofp i32 %0 to double
%8 = fmul double %7, 0x3F91DF46A2529E84
%9 = tail call float @sin(double %8)
%10 = tail call float @cos(double %8)
%11 = add nsw i32 %1, -384
%12 = sitofp i32 %11 to float
%13 = fneg float %9
%14 = fmul float %12, %13
store float %14, float* %2
%15 = fmul float %10, %12
store float %15, float* %3
store float %10, float* %4
store float %9, float* %5
ret void
}