#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 M_PI;
int /*<<< orphan*/ polToKartez(double, double, double *, double *);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, double *);
int main() {
  double r, fiDeg, fiRad, x, y;
  printf("Zadej pruvodic r: ");
  if (scanf("%lf", &r) != 1) {
    printf("Spatne zadani\n\a");
    return 1;
  }
  printf("Zadej uhel fi ve stupnich: ");
  if (scanf("%lf", &fiDeg) != 1) {
    printf("Spatne zadani\n\a");
    return 1;
  }
  fiRad = fiDeg * (M_PI / 180.0);
  polToKartez(r, fiRad, &x, &y);
  printf("Tento bod ma souradnice x=%lf a y=%lf\n", x, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1180 <main+0x50>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    121c <main+0xec>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe86(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     11c1 <main+0x91>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    121c <main+0xec>
movsd  -0x18(%rbp),%xmm0
mov    0x2e1b(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xe27(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <polToKartez@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xe3d(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
lea    0x18(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11c6 <main+0x96>
lea    0xecf(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11c6 <main+0x96>
mov    0x2e62(%rip),%rax
movsd  (%rax),%xmm1
divsd  0xe6e(%rip),%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  0x18(%rsp),%xmm0
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <polToKartez@plt>
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
lea    0xe8e(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    11d9 <main+0xa9>
lea    0xe52(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Zadej pruvodic r: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [16 x i8] c"Spatne zadani\0A\07\00"
@.str.3 = [28 x i8] c"Zadej uhel fi ve stupnich: \00"
@M_PI = global double 0.000000e+00
@.str.4 = [39 x i8] c"Tento bod ma souradnice x=%lf a y=%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%9 = icmp ne i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %29
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%15 = icmp ne i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %29
18: ; preds = %12
%19 = load double, double* %3
%20 = load double, double* @M_PI
%21 = fdiv double %20, 1.800000e+02
%22 = fmul double %19, %21
store double %22, double* %4
%23 = load double, double* %2
%24 = load double, double* %4
%25 = call i32 @polToKartez(double %23, double %24, double* %5, double* %6)
%26 = load double, double* %5
%27 = load double, double* %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), double %26, double %27)
store i32 0, i32* %1
br label %29
29: ; preds = %18, %16, %10
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [19 x i8] c"Zadej pruvodic r: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [16 x i8] c"Spatne zadani\0A\07\00"
@.str.3 = [28 x i8] c"Zadej uhel fi ve stupnich: \00"
@M_PI = global double 0.000000e+00
@.str.4 = [39 x i8] c"Tento bod ma souradnice x=%lf a y=%lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%11 = icmp eq i32 %10, 1
br i1 %11, label %14, label %12
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %30
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%17 = icmp eq i32 %16, 1
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %30
20: ; preds = %14
%21 = load double, double* %2
%22 = load double, double* @M_PI
%23 = fdiv double %22, 1.800000e+02
%24 = fmul double %21, %23
%25 = load double, double* %1
%26 = call i32 @polToKartez(double %25, double %24, double* %3, double* %4)
%27 = load double, double* %3
%28 = load double, double* %4
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), double %27, double %28)
br label %30
30: ; preds = %20, %18, %12
%31 = phi i32 [ 1, %12 ], [ 1, %18 ], [ 0, %20 ]
ret i32 %31
}