#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 /*<<< orphan*/ draw2(float, float);
int /*<<< orphan*/ move2(float, float);
void doarc(float x, float y, float xoff, float yoff, float cosine, float sine,
           int nsegs) {
  float cx, cy, dx, dy;
  int i;
  cx = x + xoff;
  cy = y + yoff;
  move2(cx, cy);
  for (i = 0; i < nsegs; i++) {
    dx = cx - x;
    dy = cy - y;
    cx = x + dx * cosine - dy * sine;
    cy = y + dx * sine + dy * cosine;
    draw2(cx, cy);
  }
}


x86 assembly (clang, -O0):
<doarc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
call   1040 <move2@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    122d <doarc+0x10d>
movss  -0x20(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
call   1030 <draw2@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    117d <doarc+0x5d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doarc>:
push   %rbx
sub    $0x70,%rsp
mov    %edi,%ebx
movaps %xmm5,(%rsp)
movaps %xmm4,0x20(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm1,0x60(%rsp)
unpcklps %xmm1,%xmm0
unpcklps %xmm3,%xmm2
movaps %xmm0,0x40(%rsp)
addps  %xmm0,%xmm2
movaps %xmm2,0x10(%rsp)
movaps %xmm2,%xmm1
shufps $0x55,%xmm2,%xmm1
movaps %xmm2,%xmm0
call   1040 <move2@plt>
movaps 0x10(%rsp),%xmm1
test   %ebx,%ebx
jle    11d0 <doarc+0xb0>
movaps 0x20(%rsp),%xmm3
movaps %xmm3,%xmm2
movaps (%rsp),%xmm0
unpcklps %xmm0,%xmm2
movaps %xmm2,0x30(%rsp)
unpcklps %xmm3,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm1,%xmm2
subss  0x50(%rsp),%xmm2
shufps $0x55,%xmm1,%xmm1
subss  0x60(%rsp),%xmm1
movaps %xmm1,%xmm0
xorps  0xe63(%rip),%xmm0
shufps $0x0,%xmm2,%xmm2
mulps  0x30(%rsp),%xmm2
addps  0x40(%rsp),%xmm2
unpcklps %xmm1,%xmm0
mulps  (%rsp),%xmm0
addps  %xmm2,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,%xmm1
shufps $0x55,%xmm0,%xmm1
call   1030 <draw2@plt>
movaps 0x10(%rsp),%xmm1
add    $0xffffffff,%ebx
jne    1180 <doarc+0x60>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @doarc(float %0, float %1, float %2, float %3, float %4, float %5, i32 %6) {
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca i32
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca i32
store float %0, float* %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 i32 %6, i32* %14
%20 = load float, float* %8
%21 = load float, float* %10
%22 = fadd float %20, %21
store float %22, float* %15
%23 = load float, float* %9
%24 = load float, float* %11
%25 = fadd float %23, %24
store float %25, float* %16
%26 = load float, float* %15
%27 = load float, float* %16
%28 = call i32 @move2(float %26, float %27)
store i32 0, i32* %19
br label %29
29: ; preds = %58, %7
%30 = load i32, i32* %19
%31 = load i32, i32* %14
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %61
33: ; preds = %29
%34 = load float, float* %15
%35 = load float, float* %8
%36 = fsub float %34, %35
store float %36, float* %17
%37 = load float, float* %16
%38 = load float, float* %9
%39 = fsub float %37, %38
store float %39, float* %18
%40 = load float, float* %8
%41 = load float, float* %17
%42 = load float, float* %12
%43 = call float @llvm.fmuladd.f32(float %41, float %42, float %40)
%44 = load float, float* %18
%45 = load float, float* %13
%46 = fneg float %44
%47 = call float @llvm.fmuladd.f32(float %46, float %45, float %43)
store float %47, float* %15
%48 = load float, float* %9
%49 = load float, float* %17
%50 = load float, float* %13
%51 = call float @llvm.fmuladd.f32(float %49, float %50, float %48)
%52 = load float, float* %18
%53 = load float, float* %12
%54 = call float @llvm.fmuladd.f32(float %52, float %53, float %51)
store float %54, float* %16
%55 = load float, float* %15
%56 = load float, float* %16
%57 = call i32 @draw2(float %55, float %56)
br label %58
58: ; preds = %33
%59 = load i32, i32* %19
%60 = add nsw i32 %59, 1
store i32 %60, i32* %19
br label %29
61: ; preds = %29
ret void
}

LLVM IR (-O2):
define void @doarc(float %0, float %1, float %2, float %3, float %4, float %5, i32 %6) {
%8 = insertelement <2 x float> poison, float %0, i64 0
%9 = insertelement <2 x float> %8, float %1, i64 1
%10 = insertelement <2 x float> poison, float %2, i64 0
%11 = insertelement <2 x float> %10, float %3, i64 1
%12 = fadd <2 x float> %9, %11
%13 = extractelement <2 x float> %12, i64 0
%14 = extractelement <2 x float> %12, i64 1
%15 = tail call i32 @move2(float %13, float %14)
%16 = icmp sgt i32 %6, 0
br i1 %16, label %17, label %41
17: ; preds = %7
%18 = insertelement <2 x float> poison, float %4, i64 0
%19 = insertelement <2 x float> %18, float %5, i64 1
%20 = insertelement <2 x float> poison, float %5, i64 0
%21 = insertelement <2 x float> %20, float %4, i64 1
br label %22
22: ; preds = %17, %22
%23 = phi i32 [ %39, %22 ], [ 0, %17 ]
%24 = phi <2 x float> [ %35, %22 ], [ %12, %17 ]
%25 = extractelement <2 x float> %24, i64 0
%26 = fsub float %25, %0
%27 = extractelement <2 x float> %24, i64 1
%28 = fsub float %27, %1
%29 = fneg float %28
%30 = insertelement <2 x float> poison, float %26, i64 0
%31 = shufflevector <2 x float> %30, <2 x float> poison, <2 x i32> zeroinitializer
%32 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %31, <2 x float> %19, <2 x float> %9)
%33 = insertelement <2 x float> poison, float %29, i64 0
%34 = insertelement <2 x float> %33, float %28, i64 1
%35 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %34, <2 x float> %21, <2 x float> %32)
%36 = extractelement <2 x float> %35, i64 0
%37 = extractelement <2 x float> %35, i64 1
%38 = tail call i32 @draw2(float %36, float %37)
%39 = add nuw nsw i32 %23, 1
%40 = icmp eq i32 %39, %6
br i1 %40, label %41, label %22
41: ; preds = %22, %7
ret void
}