#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;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
void arc_length() {
  float d, a, l;
  printf("Diameter of circle: ");
  scanf("%f", &d);
  printf("Angle measure: ");
  scanf("%f", &a);
  if (a > 360 || a < 0) {
    printf("Angle is not possible\n");
  } else {
    l = (M_PI * d) * (a / 360);
    printf("length of arc: %f", l);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<arc_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe8f(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     1187 <arc_length+0x67>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    119a <arc_length+0x7a>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e9 <arc_length+0xc9>
mov    0x2e47(%rip),%rax
movss  (%rax),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xe49(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arc_length>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xede(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movss  0x8(%rsp),%xmm0
ucomiss 0xe71(%rip),%xmm0
ja     11d4 <arc_length+0x94>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     11d4 <arc_length+0x94>
mov    0x2e48(%rip),%rax
movss  (%rax),%xmm1
mulss  0xc(%rsp),%xmm1
divss  0xe4e(%rip),%xmm0
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe68(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11e0 <arc_length+0xa0>
lea    0xe60(%rip),%rdi
call   1040 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Diameter 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 = [18 x i8] c"length of arc: %f\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @arc_length() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 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 %26
15: ; preds = %10
%16 = load float, float* @M_PI
%17 = load float, float* %1
%18 = fmul float %16, %17
%19 = load float, float* %2
%20 = fdiv float %19, 3.600000e+02
%21 = fmul float %18, %20
store float %21, float* %3
%22 = load float, float* %3
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %15, %13
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Diameter 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 = [18 x i8] c"length of arc: %f\00"
@str = [22 x i8] c"Angle is not possible\00"
define void @arc_length() {
%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 ([21 x i8], [21 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 %24
15: ; preds = %0
%16 = load float, float* @M_PI
%17 = load float, float* %1
%18 = fmul float %16, %17
%19 = fdiv float %9, 3.600000e+02
%20 = fmul float %19, %18
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %21)
%23 = call i32 @putchar(i32 10)
br label %24
24: ; preds = %15, %13
ret void
}