#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 swe_calc_ut(double, int /*<<< orphan*/, int, double *,
                int /*<<< orphan*/ *);
double swe_degnorm(int);
double swe_deltat_ex(double, int, int /*<<< orphan*/ *);
int swe_houses_armc(double, double, double, int, double *, double *);
int swe_sidtime0(double, double, double);
double swi_epsiln(double, int /*<<< orphan*/);
int /*<<< orphan*/ swi_nutation(double, int /*<<< orphan*/, double *);
char toupper(int);
int swe_houses(double tjd_ut, double geolat, double geolon, int hsys,
               double *cusp, double *ascmc) {
  int i, retc = 0;
  double armc, eps, nutlo[2];
  double tjde = tjd_ut + swe_deltat_ex(tjd_ut, -1, NULL);
  eps = swi_epsiln(tjde, 0) * (180.0 / 3.14159265358979323846);
  swi_nutation(tjde, 0, nutlo);
  for (i = 0; i < 2; i++)
    nutlo[i] *= (180.0 / 3.14159265358979323846);
  armc =
      swe_degnorm(swe_sidtime0(tjd_ut, eps + nutlo[1], nutlo[0]) * 15 + geolon);
  if (toupper(hsys) == 'I') {
    int flags = 256 | (2 * 1024);
    double xp[6];
    int result = swe_calc_ut(tjd_ut, 0, flags, xp, NULL);
    if (result < 0)
      return (-1);
    ascmc[9] = xp[1];
  }
  retc = swe_houses_armc(armc, geolat, eps + nutlo[1], hsys, cusp, ascmc);
  return retc;
}


x86 assembly (clang, -O0):
<swe_houses>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %edi,-0x24(%rbp)
mov    %rsi,-0x30(%rbp)
mov    %rdx,-0x38(%rbp)
movl   $0x0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   10a0 <swe_deltat_ex@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
xor    %edi,%edi
call   1040 <swi_epsiln@plt>
movsd  0xe0c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x68(%rbp),%xmm0
lea    -0x60(%rbp),%rsi
xor    %edi,%edi
call   1060 <swi_nutation@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x2,-0x3c(%rbp)
jge    1244 <swe_houses+0xc4>
movslq -0x3c(%rbp),%rax
movsd  0xdd6(%rip),%xmm0
mulsd  -0x60(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x60(%rbp,%rax,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1214 <swe_houses+0x94>
movsd  -0x10(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
addsd  -0x58(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
call   1070 <swe_sidtime0@plt>
imul   $0xf,%eax,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <swe_degnorm@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x24(%rbp),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
cmp    $0x49,%eax
jne    12dc <swe_houses+0x15c>
movl   $0x900,-0x6c(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x6c(%rbp),%esi
lea    -0xa0(%rbp),%rdx
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%ecx
call   1080 <swe_calc_ut@plt>
mov    %eax,-0xa4(%rbp)
cmpl   $0x0,-0xa4(%rbp)
jge    12cb <swe_houses+0x14b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1309 <swe_houses+0x189>
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x38(%rbp),%rax
movsd  %xmm0,0x48(%rax)
movsd  -0x48(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
addsd  -0x58(%rbp),%xmm2
mov    -0x24(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1090 <swe_houses_armc@plt>
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swe_houses>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    $0xffffffff,%edi
xor    %esi,%esi
call   10a0 <swe_deltat_ex@plt>
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
xor    %edi,%edi
call   1040 <swi_epsiln@plt>
movsd  %xmm0,0x18(%rsp)
lea    0x20(%rsp),%rsi
movsd  0x38(%rsp),%xmm0
xor    %edi,%edi
call   1060 <swi_nutation@plt>
movapd 0x20(%rsp),%xmm2
mulpd  0xe19(%rip),%xmm2
movapd %xmm2,0x20(%rsp)
movsd  0x18(%rsp),%xmm0
mulsd  0xe15(%rip),%xmm0
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
movsd  %xmm0,0x18(%rsp)
addsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
call   1070 <swe_sidtime0@plt>
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,2),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <swe_degnorm@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebp,%edi
call   1030 <toupper@plt>
cmp    $0x49,%al
jne    126d <swe_houses+0xed>
lea    0x40(%rsp),%rdx
movsd  0x10(%rsp),%xmm0
xor    %edi,%edi
mov    $0x900,%esi
xor    %ecx,%ecx
call   1080 <swe_calc_ut@plt>
test   %eax,%eax
js     1294 <swe_houses+0x114>
movsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x48(%rbx)
movsd  0x18(%rsp),%xmm2
addsd  0x28(%rsp),%xmm2
movsd  0x8(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1090 <swe_houses_armc@plt>
jmp    1299 <swe_houses+0x119>
mov    $0xffffffff,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @swe_houses(double %0, double %1, double %2, i32 %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca [2 x double]
%19 = alloca double
%20 = alloca i32
%21 = alloca [6 x double]
%22 = alloca i32
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
store i32 0, i32* %15
%23 = load double, double* %8
%24 = load double, double* %8
%25 = call double @swe_deltat_ex(double %24, i32 -1, i32* null)
%26 = fadd double %23, %25
store double %26, double* %19
%27 = load double, double* %19
%28 = call double @swi_epsiln(double %27, i32 0)
%29 = fmul double %28, 0x404CA5DC1A63C1F8
store double %29, double* %17
%30 = load double, double* %19
%31 = getelementptr inbounds [2 x double], [2 x double]* %18, i64 0, i64 0
%32 = call i32 @swi_nutation(double %30, i32 0, double* %31)
store i32 0, i32* %14
br label %33
33: ; preds = %42, %6
%34 = load i32, i32* %14
%35 = icmp slt i32 %34, 2
br i1 %35, label %36, label %45
36: ; preds = %33
%37 = load i32, i32* %14
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [2 x double], [2 x double]* %18, i64 0, i64 %38
%40 = load double, double* %39
%41 = fmul double %40, 0x404CA5DC1A63C1F8
store double %41, double* %39
br label %42
42: ; preds = %36
%43 = load i32, i32* %14
%44 = add nsw i32 %43, 1
store i32 %44, i32* %14
br label %33
45: ; preds = %33
%46 = load double, double* %8
%47 = load double, double* %17
%48 = getelementptr inbounds [2 x double], [2 x double]* %18, i64 0, i64 1
%49 = load double, double* %48
%50 = fadd double %47, %49
%51 = getelementptr inbounds [2 x double], [2 x double]* %18, i64 0, i64 0
%52 = load double, double* %51
%53 = call i32 @swe_sidtime0(double %46, double %50, double %52)
%54 = mul nsw i32 %53, 15
%55 = sitofp i32 %54 to double
%56 = load double, double* %10
%57 = fadd double %55, %56
%58 = fptosi double %57 to i32
%59 = call double @swe_degnorm(i32 %58)
store double %59, double* %16
%60 = load i32, i32* %11
%61 = call signext i8 @toupper(i32 %60)
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 73
br i1 %63, label %64, label %77
64: ; preds = %45
store i32 2304, i32* %20
%65 = load double, double* %8
%66 = load i32, i32* %20
%67 = getelementptr inbounds [6 x double], [6 x double]* %21, i64 0, i64 0
%68 = call i32 @swe_calc_ut(double %65, i32 0, i32 %66, double* %67, i32* null)
store i32 %68, i32* %22
%69 = load i32, i32* %22
%70 = icmp slt i32 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %64
store i32 -1, i32* %7
br label %89
72: ; preds = %64
%73 = getelementptr inbounds [6 x double], [6 x double]* %21, i64 0, i64 1
%74 = load double, double* %73
%75 = load double*, double** %13
%76 = getelementptr inbounds double, double* %75, i64 9
store double %74, double* %76
br label %77
77: ; preds = %72, %45
%78 = load double, double* %16
%79 = load double, double* %9
%80 = load double, double* %17
%81 = getelementptr inbounds [2 x double], [2 x double]* %18, i64 0, i64 1
%82 = load double, double* %81
%83 = fadd double %80, %82
%84 = load i32, i32* %11
%85 = load double*, double** %12
%86 = load double*, double** %13
%87 = call i32 @swe_houses_armc(double %78, double %79, double %83, i32 %84, double* %85, double* %86)
store i32 %87, i32* %15
%88 = load i32, i32* %15
store i32 %88, i32* %7
br label %89
89: ; preds = %77, %71
%90 = load i32, i32* %7
ret i32 %90
}

LLVM IR (-O2):
define i32 @swe_houses(double %0, double %1, double %2, i32 %3, double* %4, double* %5) {
%7 = alloca <2 x double>
%8 = alloca [6 x double]
%9 = bitcast <2 x double>* %7 to i8*
%10 = tail call double @swe_deltat_ex(double %0, i32 -1, i32* null)
%11 = fadd double %10, %0
%12 = tail call double @swi_epsiln(double %11, i32 0)
%13 = getelementptr inbounds <2 x double>, <2 x double>* %7, i64 0, i64 0
%14 = call i32 @swi_nutation(double %11, i32 0, double* %13)
%15 = getelementptr inbounds <2 x double>, <2 x double>* %7, i64 0, i64 1
%16 = load <2 x double>, <2 x double>* %7
%17 = fmul <2 x double> %16, <double 0x404CA5DC1A63C1F8, double 0x404CA5DC1A63C1F8>
store <2 x double> %17, <2 x double>* %7
%18 = fmul double %12, 0x404CA5DC1A63C1F8
%19 = extractelement <2 x double> %17, i64 1
%20 = fadd double %18, %19
%21 = extractelement <2 x double> %17, i64 0
%22 = call i32 @swe_sidtime0(double %0, double %20, double %21)
%23 = mul nsw i32 %22, 15
%24 = sitofp i32 %23 to double
%25 = fadd double %24, %2
%26 = fptosi double %25 to i32
%27 = call double @swe_degnorm(i32 %26)
%28 = call signext i8 @toupper(i32 %3)
%29 = icmp eq i8 %28, 73
br i1 %29, label %30, label %39
30: ; preds = %6
%31 = bitcast [6 x double]* %8 to i8*
%32 = getelementptr inbounds [6 x double], [6 x double]* %8, i64 0, i64 0
%33 = call i32 @swe_calc_ut(double %0, i32 0, i32 2304, double* %32, i32* null)
%34 = icmp slt i32 %33, 0
br i1 %34, label %43, label %35
35: ; preds = %30
%36 = getelementptr inbounds [6 x double], [6 x double]* %8, i64 0, i64 1
%37 = load double, double* %36
%38 = getelementptr inbounds double, double* %5, i64 9
store double %37, double* %38
br label %39
39: ; preds = %35, %6
%40 = load double, double* %15
%41 = fadd double %18, %40
%42 = call i32 @swe_houses_armc(double %27, double %1, double %41, i32 %3, double* %4, double* %5)
br label %44
43: ; preds = %30
br label %44
44: ; preds = %43, %39
%45 = phi i32 [ %42, %39 ], [ -1, %43 ]
ret i32 %45
}