#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 M_PI;
double atan2(double, double);
double cos(double);
double sin(double);
double sqrt(int);
int pnodal(char **figure, double s, double d, int rx, int ry, char pnod) {
  int th, jx, jy;
  double x, y, z, thr, azi, ain, r;
  for (th = 0; th <= 360; th++) {
    thr = ((double)th) * M_PI / 360.;
    y = cos(s) * cos(thr) - sin(s) * sin(thr) * cos(d);
    x = sin(s) * cos(thr) + cos(s) * sin(thr) * cos(d);
    z = sin(thr) * sin(d);
    azi = atan2(y, x);
    ain = atan2(sqrt(1 - z * z), z);
    r = sqrt(2) * sin(ain / 2.);
    jx = (int)(r * cos(azi) * (double)rx);
    jy = (int)(r * sin(azi) * (double)ry);
    figure[ry - jy][rx + jx] = pnod;
  }
  return 1;
}


x86 assembly (clang, -O0):
<pnodal>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %edx,-0x20(%rbp)
mov    %al,-0x21(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x168,-0x28(%rbp)
jg     141b <pnodal+0x2db>
cvtsi2sdl -0x28(%rbp),%xmm0
mov    0x2e64(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xe80(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0xc0(%rbp),%xmm1
ff
movsd  -0xb8(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movsd  -0x98(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xccd(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movsd  -0x48(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,-0x60(%rbp)
mov    $0x2,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xc8d(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x30(%rbp)
mov    -0x21(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
sub    -0x30(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x1c(%rbp),%ecx
add    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    116b <pnodal+0x2b>
mov    $0x1,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pnodal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %ecx,%r14d
mov    %edx,%r12d
mov    %esi,%ebx
movsd  %xmm1,0x38(%rsp)
movsd  %xmm0,0x28(%rsp)
mov    %rdi,%r15
xorps  %xmm0,%xmm0
cvtsi2sd %esi,%xmm0
movsd  %xmm0,0x48(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x40(%rsp)
xorpd  %xmm0,%xmm0
mov    $0x169,%ebp
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x50(%rsp)
mov    0x2e4b(%rip),%rax
movsd  (%rax),%xmm1
mulsd  %xmm0,%xmm1
divsd  0xe53(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x28(%rsp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x28(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x38(%rsp),%xmm0
call   1050 <cos@plt>
movsd  0x30(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x18(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x28(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
movsd  0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x38(%rsp),%xmm0
call   1050 <cos@plt>
movsd  0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  0x30(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x38(%rsp),%xmm0
call   1040 <sin@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  0xd12(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1060 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,0x10(%rsp)
mov    $0x2,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xcde(%rip),%xmm0
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x8(%rsp),%xmm0
mulsd  0x48(%rsp),%xmm0
cvttsd2si %xmm0,%r13d
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
mulsd  0x40(%rsp),%xmm0
cvttsd2si %xmm0,%eax
movsd  0x50(%rsp),%xmm0
mov    %r12d,%ecx
sub    %eax,%ecx
movslq %ecx,%rax
mov    (%r15,%rax,8),%rax
add    %ebx,%r13d
movslq %r13d,%rcx
mov    %r14b,(%rax,%rcx,1)
addsd  0xc6a(%rip),%xmm0
add    $0xffffffff,%ebp
jne    1190 <pnodal+0x50>
mov    $0x1,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define i32 @pnodal(i8** %0, double %1, double %2, i32 %3, i32 %4, i8 signext %5) {
%7 = alloca i8**
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
store i8** %0, i8*** %7
store double %1, double* %8
store double %2, double* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8 %5, i8* %12
store i32 0, i32* %13
br label %23
23: ; preds = %109, %6
%24 = load i32, i32* %13
%25 = icmp sle i32 %24, 360
br i1 %25, label %26, label %112
26: ; preds = %23
%27 = load i32, i32* %13
%28 = sitofp i32 %27 to double
%29 = load double, double* @M_PI
%30 = fmul double %28, %29
%31 = fdiv double %30, 3.600000e+02
store double %31, double* %19
%32 = load double, double* %8
%33 = call double @cos(double %32)
%34 = load double, double* %19
%35 = call double @cos(double %34)
%36 = load double, double* %8
%37 = call double @sin(double %36)
%38 = load double, double* %19
%39 = call double @sin(double %38)
%40 = fmul double %37, %39
%41 = load double, double* %9
%42 = call double @cos(double %41)
%43 = fmul double %40, %42
%44 = fneg double %43
%45 = call double @llvm.fmuladd.f64(double %33, double %35, double %44)
store double %45, double* %17
%46 = load double, double* %8
%47 = call double @sin(double %46)
%48 = load double, double* %19
%49 = call double @cos(double %48)
%50 = load double, double* %8
%51 = call double @cos(double %50)
%52 = load double, double* %19
%53 = call double @sin(double %52)
%54 = fmul double %51, %53
%55 = load double, double* %9
%56 = call double @cos(double %55)
%57 = fmul double %54, %56
%58 = call double @llvm.fmuladd.f64(double %47, double %49, double %57)
store double %58, double* %16
%59 = load double, double* %19
%60 = call double @sin(double %59)
%61 = load double, double* %9
%62 = call double @sin(double %61)
%63 = fmul double %60, %62
store double %63, double* %18
%64 = load double, double* %17
%65 = load double, double* %16
%66 = call double @atan2(double %64, double %65)
store double %66, double* %20
%67 = load double, double* %18
%68 = load double, double* %18
%69 = fneg double %67
%70 = call double @llvm.fmuladd.f64(double %69, double %68, double 1.000000e+00)
%71 = fptosi double %70 to i32
%72 = call double @sqrt(i32 %71)
%73 = load double, double* %18
%74 = call double @atan2(double %72, double %73)
store double %74, double* %21
%75 = call double @sqrt(i32 2)
%76 = load double, double* %21
%77 = fdiv double %76, 2.000000e+00
%78 = call double @sin(double %77)
%79 = fmul double %75, %78
store double %79, double* %22
%80 = load double, double* %22
%81 = load double, double* %20
%82 = call double @cos(double %81)
%83 = fmul double %80, %82
%84 = load i32, i32* %10
%85 = sitofp i32 %84 to double
%86 = fmul double %83, %85
%87 = fptosi double %86 to i32
store i32 %87, i32* %14
%88 = load double, double* %22
%89 = load double, double* %20
%90 = call double @sin(double %89)
%91 = fmul double %88, %90
%92 = load i32, i32* %11
%93 = sitofp i32 %92 to double
%94 = fmul double %91, %93
%95 = fptosi double %94 to i32
store i32 %95, i32* %15
%96 = load i8, i8* %12
%97 = load i8**, i8*** %7
%98 = load i32, i32* %11
%99 = load i32, i32* %15
%100 = sub nsw i32 %98, %99
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8*, i8** %97, i64 %101
%103 = load i8*, i8** %102
%104 = load i32, i32* %10
%105 = load i32, i32* %14
%106 = add nsw i32 %104, %105
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %103, i64 %107
store i8 %96, i8* %108
br label %109
109: ; preds = %26
%110 = load i32, i32* %13
%111 = add nsw i32 %110, 1
store i32 %111, i32* %13
br label %23
112: ; preds = %23
ret i32 1
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define i32 @pnodal(i8** nocapture %0, double %1, double %2, i32 %3, i32 %4, i8 signext %5) {
%7 = sitofp i32 %3 to double
%8 = sitofp i32 %4 to double
br label %9
9: ; preds = %6, %9
%10 = phi i32 [ 0, %6 ], [ %60, %9 ]
%11 = sitofp i32 %10 to double
%12 = load double, double* @M_PI
%13 = fmul double %12, %11
%14 = fdiv double %13, 3.600000e+02
%15 = tail call double @cos(double %1)
%16 = tail call double @cos(double %14)
%17 = tail call double @sin(double %1)
%18 = tail call double @sin(double %14)
%19 = tail call double @cos(double %2)
%20 = fneg double %17
%21 = fmul double %18, %20
%22 = fmul double %21, %19
%23 = tail call double @llvm.fmuladd.f64(double %15, double %16, double %22)
%24 = tail call double @sin(double %1)
%25 = tail call double @cos(double %14)
%26 = tail call double @cos(double %1)
%27 = tail call double @sin(double %14)
%28 = fmul double %26, %27
%29 = tail call double @cos(double %2)
%30 = fmul double %28, %29
%31 = tail call double @llvm.fmuladd.f64(double %24, double %25, double %30)
%32 = tail call double @sin(double %14)
%33 = tail call double @sin(double %2)
%34 = fmul double %32, %33
%35 = tail call double @atan2(double %23, double %31)
%36 = fneg double %34
%37 = tail call double @llvm.fmuladd.f64(double %36, double %34, double 1.000000e+00)
%38 = fptosi double %37 to i32
%39 = tail call double @sqrt(i32 %38)
%40 = tail call double @atan2(double %39, double %34)
%41 = tail call double @sqrt(i32 2)
%42 = fmul double %40, 5.000000e-01
%43 = tail call double @sin(double %42)
%44 = fmul double %41, %43
%45 = tail call double @cos(double %35)
%46 = fmul double %44, %45
%47 = fmul double %46, %7
%48 = fptosi double %47 to i32
%49 = tail call double @sin(double %35)
%50 = fmul double %44, %49
%51 = fmul double %50, %8
%52 = fptosi double %51 to i32
%53 = sub nsw i32 %4, %52
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %0, i64 %54
%56 = load i8*, i8** %55
%57 = add nsw i32 %48, %3
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %56, i64 %58
store i8 %5, i8* %59
%60 = add nuw nsw i32 %10, 1
%61 = icmp eq i32 %60, 361
br i1 %61, label %62, label %9
62: ; preds = %9
ret i32 1
}