#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void pnod_pat(double *s, double *d, FILE *ps) {
  fprintf(ps, "newpath\n");
  fprintf(ps, "/phi %6.1f def \n", (*s));
  fprintf(ps, "/delta %6.1f def\n", (*d));
  fprintf(ps, "phi sin phi cos moveto\n");
  fprintf(ps, "0 1 180\n");
  fprintf(ps, "{/alpha exch def\n");
  fprintf(
      ps,
      "/x alpha cos phi cos mul alpha sin phi sin delta cos mul mul sub def\n");
  fprintf(
      ps,
      "/y alpha cos phi sin mul alpha sin phi cos delta cos mul mul add def\n");
  fprintf(
      ps,
      "/z                       alpha sin         delta sin mul         def\n");
  fprintf(ps, "x abs 0.001 gt x abs 0.001 gt or {\n");
  fprintf(ps, "/PH y x atan def\n");
  fprintf(ps, "/I0   z dup dup mul neg 1 add sqrt exch atan def\n");
  fprintf(ps, "/R  I0 2 div sin 2 sqrt mul def\n");
  fprintf(ps, "PH sin R mul PH cos R mul lineto\n");
  fprintf(ps, "} if } for\n");
  fprintf(ps, "stroke\n");
}


x86 assembly (clang, -O0):
<pnod_pat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xec0(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xeb7(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xeb7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xee8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xf1c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xf50(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xf62(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xf62(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xf82(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xf91(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xfa1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xf9b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pnod_pat>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xecb(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
movsd  (%r15),%xmm0
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <fprintf@plt>
movsd  (%r14),%xmm0
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <fprintf@plt>
lea    0xeb2(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xeb1(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xea1(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xe9a(%rip),%rdi
mov    $0x45,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xec7(%rip),%rdi
mov    $0x45,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xef4(%rip),%rdi
mov    $0x45,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf21(%rip),%rdi
mov    $0x23,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf2c(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf25(%rip),%rdi
mov    $0x31,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf3e(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf46(%rip),%rdi
mov    $0x21,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf4f(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf42(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"newpath\0A\00"
@.str.1 = [17 x i8] c"/phi %6.1f def \0A\00"
@.str.2 = [18 x i8] c"/delta %6.1f def\0A\00"
@.str.3 = [24 x i8] c"phi sin phi cos moveto\0A\00"
@.str.4 = [9 x i8] c"0 1 180\0A\00"
@.str.5 = [18 x i8] c"{/alpha exch def\0A\00"
@.str.6 = [70 x i8] c"/x alpha cos phi cos mul alpha sin phi sin delta cos mul mul sub def\0A\00"
@.str.7 = [70 x i8] c"/y alpha cos phi sin mul alpha sin phi cos delta cos mul mul add def\0A\00"
@.str.8 = [70 x i8] c"/z alpha sin delta sin mul def\0A\00"
@.str.9 = [36 x i8] c"x abs 0.001 gt x abs 0.001 gt or {\0A\00"
@.str.10 = [18 x i8] c"/PH y x atan def\0A\00"
@.str.11 = [50 x i8] c"/I0 z dup dup mul neg 1 add sqrt exch atan def\0A\00"
@.str.12 = [33 x i8] c"/R I0 2 div sin 2 sqrt mul def\0A\00"
@.str.13 = [34 x i8] c"PH sin R mul PH cos R mul lineto\0A\00"
@.str.14 = [12 x i8] c"} if } for\0A\00"
@.str.15 = [8 x i8] c"stroke\0A\00"
define void @pnod_pat(double* %0, double* %1, i32* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32*
store double* %0, double** %4
store double* %1, double** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %6
%8 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %6
%10 = load double*, double** %4
%11 = load double, double* %10
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %11)
%13 = load i32*, i32** %6
%14 = load double*, double** %5
%15 = load double, double* %14
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %15)
%17 = load i32*, i32** %6
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%19 = load i32*, i32** %6
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%21 = load i32*, i32** %6
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%23 = load i32*, i32** %6
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.6, i64 0, i64 0))
%25 = load i32*, i32** %6
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.7, i64 0, i64 0))
%27 = load i32*, i32** %6
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.8, i64 0, i64 0))
%29 = load i32*, i32** %6
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
%31 = load i32*, i32** %6
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%33 = load i32*, i32** %6
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0))
%35 = load i32*, i32** %6
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0))
%37 = load i32*, i32** %6
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.13, i64 0, i64 0))
%39 = load i32*, i32** %6
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
%41 = load i32*, i32** %6
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"newpath\0A\00"
@.str.1 = [17 x i8] c"/phi %6.1f def \0A\00"
@.str.2 = [18 x i8] c"/delta %6.1f def\0A\00"
@.str.3 = [24 x i8] c"phi sin phi cos moveto\0A\00"
@.str.4 = [9 x i8] c"0 1 180\0A\00"
@.str.5 = [18 x i8] c"{/alpha exch def\0A\00"
@.str.6 = [70 x i8] c"/x alpha cos phi cos mul alpha sin phi sin delta cos mul mul sub def\0A\00"
@.str.7 = [70 x i8] c"/y alpha cos phi sin mul alpha sin phi cos delta cos mul mul add def\0A\00"
@.str.8 = [70 x i8] c"/z alpha sin delta sin mul def\0A\00"
@.str.9 = [36 x i8] c"x abs 0.001 gt x abs 0.001 gt or {\0A\00"
@.str.10 = [18 x i8] c"/PH y x atan def\0A\00"
@.str.11 = [50 x i8] c"/I0 z dup dup mul neg 1 add sqrt exch atan def\0A\00"
@.str.12 = [33 x i8] c"/R I0 2 div sin 2 sqrt mul def\0A\00"
@.str.13 = [34 x i8] c"PH sin R mul PH cos R mul lineto\0A\00"
@.str.14 = [12 x i8] c"} if } for\0A\00"
@.str.15 = [8 x i8] c"stroke\0A\00"
define void @pnod_pat(double* nocapture %0, double* nocapture %1, i32* nocapture %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 8, i64 1, i32* %2)
%5 = load double, double* %0
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %5)
%7 = load double, double* %1
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %7)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i64 23, i64 1, i32* %2)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i64 8, i64 1, i32* %2)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i64 17, i64 1, i32* %2)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.6, i64 0, i64 0), i64 69, i64 1, i32* %2)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.7, i64 0, i64 0), i64 69, i64 1, i32* %2)
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.8, i64 0, i64 0), i64 69, i64 1, i32* %2)
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i64 35, i64 1, i32* %2)
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i64 17, i64 1, i32* %2)
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0), i64 49, i64 1, i32* %2)
%18 = tail call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0), i64 32, i64 1, i32* %2)
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.13, i64 0, i64 0), i64 33, i64 1, i32* %2)
%20 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0), i64 11, i64 1, i32* %2)
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i64 7, i64 1, i32* %2)
ret void
}