#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 swe_degnorm(double);
double swe_get_ayanamsa(double);
int swe_houses_armc(double, double, double, int, double *, double *);
char toupper(int);
int sidereal_houses_trad(double tjde, double armc, double eps, double nutl,
                         double lat, int hsys, double *cusp, double *ascmc) {
  int i, retc = (0);
  double ay;
  int ito;
  if (toupper(hsys) == 'G')
    ito = 36;
  else
    ito = 12;
  retc = swe_houses_armc(armc, lat, eps, hsys, cusp, ascmc);
  ay = swe_get_ayanamsa(tjde);
  for (i = 1; i <= ito; i++)
    cusp[i] = swe_degnorm(cusp[i] - ay - nutl);
  for (i = 0; i < 8; i++) {
    if (i == 2)
      continue;
    ascmc[i] = swe_degnorm(ascmc[i] - ay - nutl);
  }
  return retc;
}


x86 assembly (clang, -O0):
<sidereal_houses_trad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %edi,-0x2c(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x2c(%rbp),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
cmp    $0x47,%eax
jne    1193 <sidereal_houses_trad+0x53>
movl   $0x24,-0x54(%rbp)
jmp    119a <sidereal_houses_trad+0x5a>
movl   $0xc,-0x54(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mov    -0x2c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1060 <swe_houses_armc@plt>
mov    %eax,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <swe_get_ayanamsa@plt>
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x54(%rbp),%eax
jg     1215 <sidereal_houses_trad+0xd5>
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x50(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
call   1040 <swe_degnorm@plt>
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11d2 <sidereal_houses_trad+0x92>
movl   $0x0,-0x44(%rbp)
cmpl   $0x8,-0x44(%rbp)
jge    126c <sidereal_houses_trad+0x12c>
cmpl   $0x2,-0x44(%rbp)
jne    1235 <sidereal_houses_trad+0xf5>
jmp    125e <sidereal_houses_trad+0x11e>
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x50(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
call   1040 <swe_degnorm@plt>
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    121c <sidereal_houses_trad+0xdc>
mov    -0x48(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sidereal_houses_trad>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %edi,%r14d
movsd  %xmm4,0x28(%rsp)
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1030 <toupper@plt>
mov    %eax,%r15d
movsd  0x18(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1060 <swe_houses_armc@plt>
mov    %eax,%r14d
movsd  0x8(%rsp),%xmm0
call   1050 <swe_get_ayanamsa@plt>
movsd  %xmm0,0x8(%rsp)
cmp    $0x47,%r15b
mov    $0x25,%eax
mov    $0xd,%r15d
cmove  %rax,%r15
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%rbx,8),%xmm0
subsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
call   1040 <swe_degnorm@plt>
movsd  %xmm0,0x0(%rbp,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11d0 <sidereal_houses_trad+0x90>
movsd  (%r12),%xmm0
subsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
call   1040 <swe_degnorm@plt>
movsd  %xmm0,(%r12)
movsd  0x8(%r12),%xmm0
subsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
call   1040 <swe_degnorm@plt>
movsd  %xmm0,0x8(%r12)
movsd  0x18(%r12),%xmm0
subsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
call   1040 <swe_degnorm@plt>
movsd  %xmm0,0x18(%r12)
movsd  0x20(%r12),%xmm0
subsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
call   1040 <swe_degnorm@plt>
movsd  %xmm0,0x20(%r12)
movsd  0x28(%r12),%xmm0
subsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
call   1040 <swe_degnorm@plt>
movsd  %xmm0,0x28(%r12)
movsd  0x30(%r12),%xmm0
subsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
call   1040 <swe_degnorm@plt>
movsd  %xmm0,0x30(%r12)
movsd  0x38(%r12),%xmm0
subsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
call   1040 <swe_degnorm@plt>
movsd  %xmm0,0x38(%r12)
mov    %r14d,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @sidereal_houses_trad(double %0, double %1, double %2, double %3, double %4, i32 %5, double* %6, double* %7) {
%9 = tail call signext i8 @toupper(i32 %5)
%10 = icmp eq i8 %9, 71
%11 = tail call i32 @swe_houses_armc(double %1, double %4, double %2, i32 %5, double* %6, double* %7)
%12 = tail call double @swe_get_ayanamsa(double %0)
%13 = select i1 %10, i64 37, i64 13
br label %14
14: ; preds = %8, %14
%15 = phi i64 [ 1, %8 ], [ %21, %14 ]
%16 = getelementptr inbounds double, double* %6, i64 %15
%17 = load double, double* %16
%18 = fsub double %17, %12
%19 = fsub double %18, %3
%20 = tail call double @swe_degnorm(double %19)
store double %20, double* %16
%21 = add nuw nsw i64 %15, 1
%22 = icmp eq i64 %21, %13
br i1 %22, label %23, label %14
23: ; preds = %14
%24 = load double, double* %7
%25 = fsub double %24, %12
%26 = fsub double %25, %3
%27 = tail call double @swe_degnorm(double %26)
store double %27, double* %7
%28 = getelementptr inbounds double, double* %7, i64 1
%29 = load double, double* %28
%30 = fsub double %29, %12
%31 = fsub double %30, %3
%32 = tail call double @swe_degnorm(double %31)
store double %32, double* %28
%33 = getelementptr inbounds double, double* %7, i64 3
%34 = load double, double* %33
%35 = fsub double %34, %12
%36 = fsub double %35, %3
%37 = tail call double @swe_degnorm(double %36)
store double %37, double* %33
%38 = getelementptr inbounds double, double* %7, i64 4
%39 = load double, double* %38
%40 = fsub double %39, %12
%41 = fsub double %40, %3
%42 = tail call double @swe_degnorm(double %41)
store double %42, double* %38
%43 = getelementptr inbounds double, double* %7, i64 5
%44 = load double, double* %43
%45 = fsub double %44, %12
%46 = fsub double %45, %3
%47 = tail call double @swe_degnorm(double %46)
store double %47, double* %43
%48 = getelementptr inbounds double, double* %7, i64 6
%49 = load double, double* %48
%50 = fsub double %49, %12
%51 = fsub double %50, %3
%52 = tail call double @swe_degnorm(double %51)
store double %52, double* %48
%53 = getelementptr inbounds double, double* %7, i64 7
%54 = load double, double* %53
%55 = fsub double %54, %12
%56 = fsub double %55, %3
%57 = tail call double @swe_degnorm(double %56)
store double %57, double* %53
ret i32 %11
}