#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 */
double cos(double);
int /*<<< orphan*/ printf(char *, double, double);
int /*<<< orphan*/ scanf(char *, ...);
double sin(double);
void test_case() {
  int moves;
  scanf("%d", &moves);
  double x = 0.0, y = 0.0,
         theta = 3.1415926535897932384626433832795028841971 / 2.0;
  while (moves--) {
    double delta_theta, radius;
    scanf("%lf %lf", &delta_theta, &radius);
    theta += delta_theta * 3.1415926535897932384626433832795028841971 / 180.0;
    x += radius * cos(theta);
    y += radius * sin(theta);
  }
  printf("%.4lf %.4lf\n", x, y);
}


x86 assembly (clang, -O0):
<test_case>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xec9(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1225 <test_case+0xe5>
lea    0xe89(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
movsd  0xe67(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xe52(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1177 <test_case+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xded(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_case>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
lea    0xec8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
xorpd  %xmm2,%xmm2
subl   $0x1,0xc(%rsp)
jb     122d <test_case+0xed>
xorpd  %xmm0,%xmm0
movsd  0xe89(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
lea    0xe97(%rip),%r14
lea    0x38(%rsp),%r15
lea    0x18(%rsp),%rbx
xchg   %ax,%ax
movapd %xmm0,0x50(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x38(%rsp),%xmm0
mulsd  0xe54(%rip),%xmm0
divsd  0xe54(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
movaps %xmm0,0x20(%rsp)
movapd %xmm1,%xmm0
call   1060 <cos@plt>
movapd %xmm0,0x40(%rsp)
movaps 0x20(%rsp),%xmm0
movhps 0x18(%rsp),%xmm0
movaps %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
movapd 0x40(%rsp),%xmm2
movapd 0x50(%rsp),%xmm1
unpcklpd %xmm0,%xmm2
mulpd  0x20(%rsp),%xmm2
movapd %xmm2,%xmm0
addpd  %xmm1,%xmm0
subl   $0x1,0xc(%rsp)
jae    1190 <test_case+0x50>
addpd  %xmm1,%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
lea    0xde7(%rip),%rdi
movapd %xmm2,%xmm0
call   1030 <printf@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"%lf %lf\00"
@.str.2 = [13 x i8] c"%.4lf %.4lf\0A\00"
define void @test_case() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %3
store double 0x3FF921FB54442D18, double* %4
br label %8
8: ; preds = %12, %0
%9 = load i32, i32* %1
%10 = add nsw i32 %9, -1
store i32 %10, i32* %1
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %29
12: ; preds = %8
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %5, double* %6)
%14 = load double, double* %5
%15 = fmul double %14, 0x400921FB54442D18
%16 = fdiv double %15, 1.800000e+02
%17 = load double, double* %4
%18 = fadd double %17, %16
store double %18, double* %4
%19 = load double, double* %6
%20 = load double, double* %4
%21 = call double @cos(double %20)
%22 = load double, double* %2
%23 = call double @llvm.fmuladd.f64(double %19, double %21, double %22)
store double %23, double* %2
%24 = load double, double* %6
%25 = load double, double* %4
%26 = call double @sin(double %25)
%27 = load double, double* %3
%28 = call double @llvm.fmuladd.f64(double %24, double %26, double %27)
store double %28, double* %3
br label %8
29: ; preds = %8
%30 = load double, double* %2
%31 = load double, double* %3
%32 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %30, double %31)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"%lf %lf\00"
@.str.2 = [13 x i8] c"%.4lf %.4lf\0A\00"
define void @test_case() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = bitcast i32* %1 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %34, label %9
9: ; preds = %0
%10 = bitcast double* %2 to i8*
%11 = bitcast double* %3 to i8*
br label %12
12: ; preds = %9, %12
%13 = phi double [ 0x3FF921FB54442D18, %9 ], [ %19, %12 ]
%14 = phi <2 x double> [ zeroinitializer, %9 ], [ %28, %12 ]
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3)
%16 = load double, double* %2
%17 = fmul double %16, 0x400921FB54442D18
%18 = fdiv double %17, 1.800000e+02
%19 = fadd double %13, %18
%20 = load double, double* %3
%21 = call double @cos(double %19)
%22 = load double, double* %3
%23 = call double @sin(double %19)
%24 = insertelement <2 x double> poison, double %20, i64 0
%25 = insertelement <2 x double> %24, double %22, i64 1
%26 = insertelement <2 x double> poison, double %21, i64 0
%27 = insertelement <2 x double> %26, double %23, i64 1
%28 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %25, <2 x double> %27, <2 x double> %14)
%29 = load i32, i32* %1
%30 = add nsw i32 %29, -1
store i32 %30, i32* %1
%31 = icmp eq i32 %29, 0
br i1 %31, label %32, label %12
32: ; preds = %12
%33 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %25, <2 x double> %27, <2 x double> %14)
br label %34
34: ; preds = %32, %0
%35 = phi <2 x double> [ zeroinitializer, %0 ], [ %33, %32 ]
%36 = extractelement <2 x double> %35, i64 0
%37 = extractelement <2 x double> %35, i64 1
%38 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %36, double %37)
ret void
}