#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 abs(int);
int /*<<< orphan*/ atan(double);
double convert_to_degrees(int /*<<< orphan*/);
double pythagorean(double, double);
void move_chessman(int *current_coordinates, int *target_coordinates) {
  int current_x = current_coordinates[0];
  int current_y = current_coordinates[1];
  int target_x = target_coordinates[0];
  int target_y = target_coordinates[1];
  double x, y, angle, hypotenuse;
  x = abs(current_x - 4) + 5 / 2;
  y = current_y + 30 + 5 / 2;
  angle = convert_to_degrees(atan(x / y));
  hypotenuse = pythagorean(x, y);
}


x86 assembly (clang, -O0):
<move_chessman>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
sub    $0x4,%edi
call   1030 <abs@plt>
add    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1e,%eax
add    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
call   1040 <atan@plt>
mov    %eax,%edi
call   1060 <convert_to_degrees@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1050 <pythagorean@plt>
movsd  %xmm0,-0x40(%rbp)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_chessman>:
sub    $0x18,%rsp
mov    (%rdi),%eax
lea    -0x4(%rax),%ecx
lea    -0x4(%rax),%edx
neg    %edx
cmp    $0x4,%eax
cmovge %ecx,%edx
mov    0x4(%rdi),%eax
add    $0x2,%edx
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x10(%rsp)
add    $0x20,%eax
cvtsi2sd %eax,%xmm1
movsd  %xmm1,0x8(%rsp)
divsd  %xmm1,%xmm0
call   1030 <atan@plt>
mov    %eax,%edi
call   1050 <convert_to_degrees@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
add    $0x18,%rsp
jmp    1040 <pythagorean@plt>

LLVM IR (-O0):
define void @move_chessman(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store i32* %0, i32** %3
store i32* %1, i32** %4
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 0
%15 = load i32, i32* %14
store i32 %15, i32* %5
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i64 1
%18 = load i32, i32* %17
store i32 %18, i32* %6
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 0
%21 = load i32, i32* %20
store i32 %21, i32* %7
%22 = load i32*, i32** %4
%23 = getelementptr inbounds i32, i32* %22, i64 1
%24 = load i32, i32* %23
store i32 %24, i32* %8
%25 = load i32, i32* %5
%26 = sub nsw i32 %25, 4
%27 = call i32 @abs(i32 %26)
%28 = add nsw i32 %27, 2
%29 = sitofp i32 %28 to double
store double %29, double* %9
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 30
%32 = add nsw i32 %31, 2
%33 = sitofp i32 %32 to double
store double %33, double* %10
%34 = load double, double* %9
%35 = load double, double* %10
%36 = fdiv double %34, %35
%37 = call i32 @atan(double %36)
%38 = call double @convert_to_degrees(i32 %37)
store double %38, double* %11
%39 = load double, double* %9
%40 = load double, double* %10
%41 = call double @pythagorean(double %39, double %40)
store double %41, double* %12
ret void
}

LLVM IR (-O2):
define void @move_chessman(i32* nocapture %0, i32* nocapture readnone %1) {
%3 = load i32, i32* %0
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = add nsw i32 %3, -4
%7 = icmp slt i32 %3, 4
%8 = sub i32 4, %3
%9 = select i1 %7, i32 %8, i32 %6
%10 = add nsw i32 %9, 2
%11 = sitofp i32 %10 to double
%12 = add nsw i32 %5, 32
%13 = sitofp i32 %12 to double
%14 = fdiv double %11, %13
%15 = tail call i32 @atan(double %14)
%16 = tail call double @convert_to_degrees(i32 %15)
%17 = tail call double @pythagorean(double %11, double %13)
ret void
}