#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 acos(int const);
int const sqrt(int const);
double get_lattice_vector_angle(const int n, const int m) {
  return acos((n - 0.5 * m) / (sqrt(n * n + m * m - n * m * 1.0)));
}


x86 assembly (clang, -O0):
<get_lattice_vector_angle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xec0(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    %ecx,%eax
cvtsi2sd %eax,%xmm1
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <acos@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_lattice_vector_angle>:
push   %rax
cvtsi2sd %edi,%xmm0
cvtsi2sd %esi,%xmm1
mulsd  0xecf(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
mov    %esi,%eax
imul   %edi,%esi
imul   %edi,%edi
imul   %eax,%eax
add    %edi,%eax
sub    %esi,%eax
mov    %eax,%edi
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
pop    %rax
jmp    1030 <acos@plt>

LLVM IR (-O0):
define double @get_lattice_vector_angle(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = sitofp i32 %5 to double
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to double
%9 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %8, double %6)
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = mul nsw i32 %10, %11
%13 = load i32, i32* %4
%14 = load i32, i32* %4
%15 = mul nsw i32 %13, %14
%16 = add nsw i32 %12, %15
%17 = sitofp i32 %16 to double
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = mul nsw i32 %18, %19
%21 = sitofp i32 %20 to double
%22 = fneg double %21
%23 = call double @llvm.fmuladd.f64(double %22, double 1.000000e+00, double %17)
%24 = fptosi double %23 to i32
%25 = call i32 @sqrt(i32 %24)
%26 = sitofp i32 %25 to double
%27 = fdiv double %9, %26
%28 = fptosi double %27 to i32
%29 = call double @acos(i32 %28)
ret double %29
}

LLVM IR (-O2):
define double @get_lattice_vector_angle(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to double
%4 = sitofp i32 %1 to double
%5 = tail call double @llvm.fmuladd.f64(double %4, double -5.000000e-01, double %3)
%6 = mul nsw i32 %0, %0
%7 = mul nsw i32 %1, %1
%8 = add nuw nsw i32 %7, %6
%9 = mul nsw i32 %1, %0
%10 = sub i32 %8, %9
%11 = tail call i32 @sqrt(i32 %10)
%12 = sitofp i32 %11 to double
%13 = fdiv double %5, %12
%14 = fptosi double %13 to i32
%15 = tail call double @acos(i32 %14)
ret double %15
}