#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 atan2(int, int);
int fabs(int);
int /*<<< orphan*/ printf(char *);
int angle(int x, int y) {
  float atand = atan2(y, x) * 180.0 / 3.141592654;
  int angle = (int)atand;
  if (angle >= 0 && angle <= 90) {
    printf("aaa");
    angle = 90 - angle;
  } else if (angle > 90 && angle <= 180) {
    printf("bbb");
    angle = 450 - angle;
  } else if (angle < 0 && angle >= -90) {
    printf("ccc");
    angle = fabs(angle) + 90;
  } else {
    printf("ddd");
    angle = fabs(angle) + 90;
  }
  return angle;
}


x86 assembly (clang, -O0):
<angle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <atan2@plt>
movsd  0xeb7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea3(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
cvttss2si -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     11a2 <angle+0x72>
cmpl   $0x5a,-0x10(%rbp)
jg     11a2 <angle+0x72>
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5a,%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    122c <angle+0xfc>
cmpl   $0x5a,-0x10(%rbp)
jle    11d5 <angle+0xa5>
cmpl   $0xb4,-0x10(%rbp)
jg     11d5 <angle+0xa5>
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1c2,%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1227 <angle+0xf7>
cmpl   $0x0,-0x10(%rbp)
jge    1208 <angle+0xd8>
cmpl   $0xffffffa6,-0x10(%rbp)
jl     1208 <angle+0xd8>
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%edi
call   1050 <fabs@plt>
add    $0x5a,%eax
mov    %eax,-0x10(%rbp)
jmp    1222 <angle+0xf2>
lea    0xe0d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%edi
call   1050 <fabs@plt>
add    $0x5a,%eax
mov    %eax,-0x10(%rbp)
jmp    1227 <angle+0xf7>
jmp    122c <angle+0xfc>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<angle>:
push   %rbx
mov    %edi,%eax
mov    %esi,%edi
mov    %eax,%esi
call   1030 <atan2@plt>
mulsd  0xebc(%rip),%xmm0
divsd  0xebc(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvttss2si %xmm0,%ebx
cmp    $0x5a,%ebx
ja     116c <angle+0x3c>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5a,%eax
jmp    1185 <angle+0x55>
lea    -0x5b(%rbx),%eax
cmp    $0x59,%eax
ja     1189 <angle+0x59>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1c2,%eax
sub    %ebx,%eax
pop    %rbx
ret
cmp    $0xffffffa6,%ebx
jb     1197 <angle+0x67>
lea    0xe83(%rip),%rdi
jmp    119e <angle+0x6e>
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
mov    %ebx,%edi
call   1050 <fabs@plt>
add    $0x5a,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"aaa\00"
@.str.1 = [4 x i8] c"bbb\00"
@.str.2 = [4 x i8] c"ccc\00"
@.str.3 = [4 x i8] c"ddd\00"
define i32 @angle(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = call double @atan2(i32 %7, i32 %8)
%10 = fmul double %9, 1.800000e+02
%11 = fdiv double %10, 0x400921FB54524550
%12 = fptrunc double %11 to float
store float %12, float* %5
%13 = load float, float* %5
%14 = fptosi float %13 to i32
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %2
%18 = load i32, i32* %6
%19 = icmp sle i32 %18, 90
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* %6
%23 = sub nsw i32 90, %22
store i32 %23, i32* %6
br label %52
24: ; preds = %17, %2
%25 = load i32, i32* %6
%26 = icmp sgt i32 %25, 90
br i1 %26, label %27, label %34
27: ; preds = %24
%28 = load i32, i32* %6
%29 = icmp sle i32 %28, 180
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%32 = load i32, i32* %6
%33 = sub nsw i32 450, %32
store i32 %33, i32* %6
br label %51
34: ; preds = %27, %24
%35 = load i32, i32* %6
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %45
37: ; preds = %34
%38 = load i32, i32* %6
%39 = icmp sge i32 %38, -90
br i1 %39, label %40, label %45
40: ; preds = %37
%41 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%42 = load i32, i32* %6
%43 = call i32 @fabs(i32 %42)
%44 = add nsw i32 %43, 90
store i32 %44, i32* %6
br label %50
45: ; preds = %37, %34
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%47 = load i32, i32* %6
%48 = call i32 @fabs(i32 %47)
%49 = add nsw i32 %48, 90
store i32 %49, i32* %6
br label %50
50: ; preds = %45, %40
br label %51
51: ; preds = %50, %30
br label %52
52: ; preds = %51, %20
%53 = load i32, i32* %6
ret i32 %53
}

LLVM IR (-O2):
@.str = [4 x i8] c"aaa\00"
@.str.1 = [4 x i8] c"bbb\00"
@.str.2 = [4 x i8] c"ccc\00"
@.str.3 = [4 x i8] c"ddd\00"
define i32 @angle(i32 %0, i32 %1) {
%3 = tail call double @atan2(i32 %1, i32 %0)
%4 = fmul double %3, 1.800000e+02
%5 = fdiv double %4, 0x400921FB54524550
%6 = fptrunc double %5 to float
%7 = fptosi float %6 to i32
%8 = icmp ult i32 %7, 91
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = sub nuw nsw i32 90, %7
br label %28
12: ; preds = %2
%13 = add i32 %7, -91
%14 = icmp ult i32 %13, 90
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%17 = sub nuw nsw i32 450, %7
br label %28
18: ; preds = %12
%19 = icmp ugt i32 %7, -91
br i1 %19, label %20, label %24
20: ; preds = %18
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%22 = tail call i32 @fabs(i32 %7)
%23 = add nsw i32 %22, 90
br label %28
24: ; preds = %18
%25 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%26 = tail call i32 @fabs(i32 %7)
%27 = add nsw i32 %26, 90
br label %28
28: ; preds = %15, %24, %20, %9
%29 = phi i32 [ %11, %9 ], [ %17, %15 ], [ %23, %20 ], [ %27, %24 ]
ret i32 %29
}