#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*/ DegreesToRadians(double);
int /*<<< orphan*/ PutPixel(double, double);
double cos(int /*<<< orphan*/);
double sin(int /*<<< orphan*/);
void Draw(double angle, int length) {
  double cx = cos(DegreesToRadians(angle));
  double sy = sin(DegreesToRadians(angle));
  int i;
  for (i = 1; i <= length; i++) {
    PutPixel(4.0 + i * cx, 4.0 + i * sy);
  }
}


x86 assembly (clang, -O0):
<Draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <DegreesToRadians@plt>
mov    %eax,%edi
call   1060 <cos@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <DegreesToRadians@plt>
mov    %eax,%edi
call   1050 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11d6 <Draw+0x96>
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5b(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe41(%rip),%xmm2
addsd  %xmm2,%xmm1
call   1030 <PutPixel@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1183 <Draw+0x43>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Draw>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r14d
movsd  %xmm0,0x8(%rsp)
call   1040 <DegreesToRadians@plt>
mov    %eax,%edi
call   1060 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <DegreesToRadians@plt>
mov    %eax,%edi
call   1050 <sin@plt>
test   %r14d,%r14d
jle    11d3 <Draw+0x93>
movapd %xmm0,%xmm2
neg    %r14d
mov    $0x1,%ebx
movsd  %xmm0,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movapd %xmm1,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  0xe57(%rip),%xmm3
addsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
call   1030 <PutPixel@plt>
movsd  0x8(%rsp),%xmm2
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1190 <Draw+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @Draw(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%8 = load double, double* %3
%9 = call i32 @DegreesToRadians(double %8)
%10 = call double @cos(i32 %9)
store double %10, double* %5
%11 = load double, double* %3
%12 = call i32 @DegreesToRadians(double %11)
%13 = call double @sin(i32 %12)
store double %13, double* %6
store i32 1, i32* %7
br label %14
14: ; preds = %28, %2
%15 = load i32, i32* %7
%16 = load i32, i32* %4
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %31
18: ; preds = %14
%19 = load i32, i32* %7
%20 = sitofp i32 %19 to double
%21 = load double, double* %5
%22 = call double @llvm.fmuladd.f64(double %20, double %21, double 4.000000e+00)
%23 = load i32, i32* %7
%24 = sitofp i32 %23 to double
%25 = load double, double* %6
%26 = call double @llvm.fmuladd.f64(double %24, double %25, double 4.000000e+00)
%27 = call i32 @PutPixel(double %22, double %26)
br label %28
28: ; preds = %18
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %14
31: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @Draw(double %0, i32 %1) {
%3 = tail call i32 @DegreesToRadians(double %0)
%4 = tail call double @cos(i32 %3)
%5 = tail call i32 @DegreesToRadians(double %0)
%6 = tail call double @sin(i32 %5)
%7 = icmp slt i32 %1, 1
br i1 %7, label %16, label %8
8: ; preds = %2, %8
%9 = phi i32 [ %14, %8 ], [ 1, %2 ]
%10 = sitofp i32 %9 to double
%11 = tail call double @llvm.fmuladd.f64(double %10, double %4, double 4.000000e+00)
%12 = tail call double @llvm.fmuladd.f64(double %10, double %6, double 4.000000e+00)
%13 = tail call i32 @PutPixel(double %11, double %12)
%14 = add nuw i32 %9, 1
%15 = icmp eq i32 %9, %1
br i1 %15, label %16, label %8
16: ; preds = %8, %2
ret void
}