#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
main() {
  double deg, tot = 0;
  printf("Please enter the degrees between (0-360) \n");
  scanf("%lf", &deg);
  if ((deg >= 0) && (deg <= 90)) {
    tot = 90 - deg;
    printf("the bearing is East %f degrees North \n", tot);
  } else if ((deg > 90) && (deg <= 180)) {
    tot = 180 - deg;
    printf("the bearing is South %f degrees East \n", tot);
  } else if ((deg > 180) && (deg <= 270)) {
    tot = 270 - deg;
    printf("the bearing is West %f degrees South \n", tot);
  } else if ((deg > 270) && (deg <= 360)) {
    tot = 360 - deg;
    printf("the bearing is North %f degrees West \n", tot);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11a4 <main+0x84>
movsd  0xe91(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11a4 <main+0x84>
movsd  0xe7e(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xeb7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12aa <main+0x18a>
movsd  -0x10(%rbp),%xmm0
movsd  0xe4f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11f8 <main+0xd8>
movsd  0xe45(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11f8 <main+0xd8>
movsd  0xe32(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe8a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12a5 <main+0x185>
movsd  -0x10(%rbp),%xmm0
movsd  0xe03(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    124c <main+0x12c>
movsd  0xdf9(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     124c <main+0x12c>
movsd  0xde6(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe5d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12a0 <main+0x180>
movsd  -0x10(%rbp),%xmm0
movsd  0xdb7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    129b <main+0x17b>
movsd  0xdad(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     129b <main+0x17b>
movsd  0xd9a(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe30(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12a0 <main+0x180>
jmp    12a5 <main+0x185>
jmp    12aa <main+0x18a>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf88(%rip),%rdi
call   1030 <puts@plt>
lea    0xedc(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     117a <main+0x4a>
movsd  0xe9d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     117a <main+0x4a>
lea    0xeb4(%rip),%rdi
movsd  0xe88(%rip),%xmm0
jmp    11f3 <main+0xc3>
ucomisd 0xe7e(%rip),%xmm1
jbe    11a3 <main+0x73>
movsd  0xe7c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11a3 <main+0x73>
lea    0xeb2(%rip),%rdi
movsd  0xe67(%rip),%xmm0
jmp    11f3 <main+0xc3>
ucomisd 0xe5d(%rip),%xmm1
jbe    11cc <main+0x9c>
movsd  0xe5b(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11cc <main+0x9c>
lea    0xeb0(%rip),%rdi
movsd  0xe46(%rip),%xmm0
jmp    11f3 <main+0xc3>
ucomisd 0xe3c(%rip),%xmm1
jbe    11fe <main+0xce>
movsd  0xe3a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11fe <main+0xce>
lea    0xeae(%rip),%rdi
movsd  0xe25(%rip),%xmm0
subsd  %xmm1,%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Please enter the degrees between (0-360) \0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [39 x i8] c"the bearing is East %f degrees North \0A\00"
@.str.3 = [39 x i8] c"the bearing is South %f degrees East \0A\00"
@.str.4 = [39 x i8] c"the bearing is West %f degrees South \0A\00"
@.str.5 = [39 x i8] c"the bearing is North %f degrees West \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%6 = load double, double* %2
%7 = fcmp oge double %6, 0.000000e+00
br i1 %7, label %8, label %16
8: ; preds = %0
%9 = load double, double* %2
%10 = fcmp ole double %9, 9.000000e+01
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load double, double* %2
%13 = fsub double 9.000000e+01, %12
store double %13, double* %3
%14 = load double, double* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), double %14)
br label %52
16: ; preds = %8, %0
%17 = load double, double* %2
%18 = fcmp ogt double %17, 9.000000e+01
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load double, double* %2
%21 = fcmp ole double %20, 1.800000e+02
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load double, double* %2
%24 = fsub double 1.800000e+02, %23
store double %24, double* %3
%25 = load double, double* %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), double %25)
br label %51
27: ; preds = %19, %16
%28 = load double, double* %2
%29 = fcmp ogt double %28, 1.800000e+02
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = load double, double* %2
%32 = fcmp ole double %31, 2.700000e+02
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load double, double* %2
%35 = fsub double 2.700000e+02, %34
store double %35, double* %3
%36 = load double, double* %3
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), double %36)
br label %50
38: ; preds = %30, %27
%39 = load double, double* %2
%40 = fcmp ogt double %39, 2.700000e+02
br i1 %40, label %41, label %49
41: ; preds = %38
%42 = load double, double* %2
%43 = fcmp ole double %42, 3.600000e+02
br i1 %43, label %44, label %49
44: ; preds = %41
%45 = load double, double* %2
%46 = fsub double 3.600000e+02, %45
store double %46, double* %3
%47 = load double, double* %3
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), double %47)
br label %49
49: ; preds = %44, %41, %38
br label %50
50: ; preds = %49, %33
br label %51
51: ; preds = %50, %22
br label %52
52: ; preds = %51, %11
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [39 x i8] c"the bearing is East %f degrees North \0A\00"
@.str.3 = [39 x i8] c"the bearing is South %f degrees East \0A\00"
@.str.4 = [39 x i8] c"the bearing is West %f degrees South \0A\00"
@.str.5 = [39 x i8] c"the bearing is North %f degrees West \0A\00"
@str = [42 x i8] c"Please enter the degrees between (0-360) \00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = fcmp oge double %5, 0.000000e+00
%7 = fcmp ole double %5, 9.000000e+01
%8 = and i1 %6, %7
br i1 %8, label %21, label %9
9: ; preds = %0
%10 = fcmp ogt double %5, 9.000000e+01
%11 = fcmp ole double %5, 1.800000e+02
%12 = and i1 %10, %11
br i1 %12, label %21, label %13
13: ; preds = %9
%14 = fcmp ogt double %5, 1.800000e+02
%15 = fcmp ole double %5, 2.700000e+02
%16 = and i1 %14, %15
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = fcmp ogt double %5, 2.700000e+02
%19 = fcmp ole double %5, 3.600000e+02
%20 = and i1 %18, %19
br i1 %20, label %21, label %26
21: ; preds = %17, %13, %9, %0
%22 = phi double [ 9.000000e+01, %0 ], [ 1.800000e+02, %9 ], [ 2.700000e+02, %13 ], [ 3.600000e+02, %17 ]
%23 = phi i8* [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), %0 ], [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), %9 ], [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), %13 ], [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), %17 ]
%24 = fsub double %22, %5
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %23, double %24)
br label %26
26: ; preds = %21, %17
ret i32 0
}