#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 M_PI;
float pow(float, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
void sector_area() {
  float r, a, sa;
  printf("Radius of circle: ");
  scanf("%f", &r);
  printf("Angle measure: ");
  scanf("%f", &a);
  if (a > 360 || a < 0) {
    printf("Angle is not possible\n");
  } else {
    sa = (M_PI * pow(r, 2)) * (a / 360);
    printf("Sector area: %f", sa);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<sector_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe7f(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     1197 <sector_area+0x67>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    11aa <sector_area+0x7a>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1214 <sector_area+0xe4>
mov    0x2e37(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xe1e(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sector_area>:
push   %rbx
sub    $0x10,%rsp
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeca(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xe61(%rip),%xmm0
ja     1203 <sector_area+0xb3>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     1203 <sector_area+0xb3>
mov    0x2e38(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1070 <pow@plt>
mulss  0x8(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
divss  0xe22(%rip),%xmm1
mulss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe37(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    120f <sector_area+0xbf>
lea    0xe2d(%rip),%rdi
call   1040 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Radius of circle: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [16 x i8] c"Angle measure: \00"
@.str.3 = [23 x i8] c"Angle is not possible\0A\00"
@M_PI = global float 0.000000e+00
@.str.4 = [16 x i8] c"Sector area: %f\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @sector_area() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%8 = load float, float* %2
%9 = fcmp ogt float %8, 3.600000e+02
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = load float, float* %2
%12 = fcmp olt float %11, 0.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %10, %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %27
15: ; preds = %10
%16 = load float, float* @M_PI
%17 = load float, float* %1
%18 = call float @pow(float %17, i32 2)
%19 = fmul float %16, %18
%20 = load float, float* %2
%21 = fdiv float %20, 3.600000e+02
%22 = fmul float %19, %21
store float %22, float* %3
%23 = load float, float* %3
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), double %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %27
27: ; preds = %15, %13
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Radius of circle: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [16 x i8] c"Angle measure: \00"
@M_PI = global float 0.000000e+00
@.str.4 = [16 x i8] c"Sector area: %f\00"
@str = [22 x i8] c"Angle is not possible\00"
define void @sector_area() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = load float, float* %2
%10 = fcmp ogt float %9, 3.600000e+02
%11 = fcmp olt float %9, 0.000000e+00
%12 = or i1 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %26
15: ; preds = %0
%16 = load float, float* @M_PI
%17 = load float, float* %1
%18 = call float @pow(float %17, i32 2)
%19 = fmul float %16, %18
%20 = load float, float* %2
%21 = fdiv float %20, 3.600000e+02
%22 = fmul float %19, %21
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), double %23)
%25 = call i32 @putchar(i32 10)
br label %26
26: ; preds = %15, %13
ret void
}