#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 /*<<< orphan*/ GL_TRIANGLE_FAN;
int /*<<< orphan*/ GL_TRIANGLE_STRIP;
double M_PI;
double cos(double);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glNormal3d(double, double, double);
int /*<<< orphan*/ glNormal3dv(double *);
int /*<<< orphan*/ glVertex3d(double, double, double);
int /*<<< orphan*/ normiraj(double *);
double sin(double);
int /*<<< orphan*/ vprodukt(double *, double, double, double, double, double,
                            double);
void stozacV2(double r, double h, int n) {
  double t, v[] = {0.0, 0.0, 0.0};
  int i;
  glBegin(GL_TRIANGLE_FAN);
  glNormal3d(0.0, 0.0, -1.0);
  glVertex3d(0.0, 0.0, 0.0);
  t = 0.0;
  for (i = 0; i <= n; i++) {
    glVertex3d(r * cos(t), r * sin(t), 0.0);
    t += 2.0 * M_PI / n;
  }
  glEnd();
  glBegin(GL_TRIANGLE_STRIP);
  t = 2.0 * M_PI;
  for (i = 0; i <= n; i++) {
    vprodukt(v, r * cos(t), r * sin(t), -h, cos(t + M_PI / 2.0),
             sin(t + M_PI / 2.0), 0.0);
    normiraj(v);
    glNormal3dv(v);
    glVertex3d(0.0, 0.0, h);
    glVertex3d(r * cos(t), r * sin(t), 0.0);
    t -= 2.0 * M_PI / n;
  }
  glEnd();
}


x86 assembly (clang, -O0):
<stozacV2>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
call   10b0 <glBegin@plt>
xorps  %xmm1,%xmm1
movsd  0xe1f(%rip),%xmm2
movaps %xmm1,%xmm0
call   1030 <glNormal3d@plt>
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1060 <glVertex3d@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1298 <stozacV2+0xf8>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
call   10a0 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1090 <sin@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm1
xorps  %xmm2,%xmm2
call   1060 <glVertex3d@plt>
movsd  0xd9c(%rip),%xmm0
mov    0x2d6d(%rip),%rax
mulsd  (%rax),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1206 <stozacV2+0x66>
mov    $0x0,%al
call   1080 <glEnd@plt>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
call   10b0 <glBegin@plt>
movsd  0xd53(%rip),%xmm0
mov    0x2d24(%rip),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     148d <stozacV2+0x2ed>
lea    -0x40(%rbp),%rax
mov    %rax,-0xa0(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   10a0 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1090 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
mov    0x2c74(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xc90(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
call   10a0 <cos@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
mov    0x2c47(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xc63(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
call   1090 <sin@plt>
mov    -0xa0(%rbp),%rdi
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x88(%rbp),%xmm3
ff
movaps %xmm0,%xmm4
movsd  -0x80(%rbp),%xmm0
xorps  %xmm5,%xmm5
call   10c0 <vprodukt@plt>
lea    -0x40(%rbp),%rdi
call   1050 <normiraj@plt>
lea    -0x40(%rbp),%rdi
call   1040 <glNormal3dv@plt>
movsd  -0x10(%rbp),%xmm2
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   1060 <glVertex3d@plt>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x20(%rbp),%xmm0
call   10a0 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1090 <sin@plt>
movsd  -0x70(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm2,%xmm1
xorps  %xmm2,%xmm2
call   1060 <glVertex3d@plt>
movsd  0xbab(%rip),%xmm1
mov    0x2b7c(%rip),%rax
mulsd  (%rax),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12cc <stozacV2+0x12c>
mov    $0x0,%al
call   1080 <glEnd@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stozacV2>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %edi,%ebx
movapd %xmm1,0x30(%rsp)
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm0,%xmm0
movapd %xmm0,0x50(%rsp)
movq   $0x0,0x60(%rsp)
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
movsd  0xe2f(%rip),%xmm2
xorpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
call   1030 <glNormal3d@plt>
xorpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
xorps  %xmm2,%xmm2
call   1060 <glVertex3d@plt>
test   %ebx,%ebx
js     13e4 <stozacV2+0x254>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x18(%rsp)
mov    $0xffffffff,%ebp
mov    0x2dd1(%rip),%r15
xorpd  %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
call   1090 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1080 <sin@plt>
movapd %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
xorps  %xmm2,%xmm2
movsd  0x10(%rsp),%xmm0
call   1060 <glVertex3d@plt>
movsd  (%r15),%xmm0
addsd  %xmm0,%xmm0
divsd  0x18(%rsp),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1220 <stozacV2+0x90>
xor    %eax,%eax
call   1070 <glEnd@plt>
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
test   %ebx,%ebx
js     13f9 <stozacV2+0x269>
movsd  (%r15),%xmm0
addsd  %xmm0,%xmm0
movapd 0xd5c(%rip),%xmm1
xorpd  0x30(%rsp),%xmm1
movapd %xmm1,0x40(%rsp)
add    $0x1,%ebx
lea    0x50(%rsp),%r14
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
call   1090 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1080 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  (%r15),%xmm0
movsd  0xcfa(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  (%rsp),%xmm0
call   1090 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  (%r15),%xmm0
mulsd  0xcd9(%rip),%xmm0
addsd  (%rsp),%xmm0
call   1080 <sin@plt>
movapd %xmm0,%xmm4
xorps  %xmm5,%xmm5
mov    %r14,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movaps 0x40(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
call   10b0 <vprodukt@plt>
mov    %r14,%rdi
call   1050 <normiraj@plt>
mov    %r14,%rdi
call   1040 <glNormal3dv@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movaps 0x30(%rsp),%xmm2
call   1060 <glVertex3d@plt>
movsd  (%rsp),%xmm0
call   1090 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1080 <sin@plt>
movapd %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
xorps  %xmm2,%xmm2
movsd  0x10(%rsp),%xmm0
call   1060 <glVertex3d@plt>
movsd  (%r15),%xmm0
addsd  %xmm0,%xmm0
divsd  0x18(%rsp),%xmm0
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0xffffffff,%ebx
jne    12d0 <stozacV2+0x140>
jmp    13f9 <stozacV2+0x269>
xor    %eax,%eax
call   1070 <glEnd@plt>
mov    0x2c06(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
xor    %eax,%eax
call   1070 <glEnd@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@GL_TRIANGLE_FAN = global i32 0
@M_PI = global double 0.000000e+00
@GL_TRIANGLE_STRIP = global i32 0
define void @stozacV2(double %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca double
%8 = alloca [3 x double]
%9 = alloca i32
store double %0, double* %4
store double %1, double* %5
store i32 %2, i32* %6
%10 = bitcast [3 x double]* %8 to i8*
%11 = load i32, i32* @GL_TRIANGLE_FAN
%12 = call i32 @glBegin(i32 %11)
%13 = call i32 @glNormal3d(double 0.000000e+00, double 0.000000e+00, double -1.000000e+00)
%14 = call i32 @glVertex3d(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
store double 0.000000e+00, double* %7
store i32 0, i32* %9
br label %15
15: ; preds = %36, %3
%16 = load i32, i32* %9
%17 = load i32, i32* %6
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %39
19: ; preds = %15
%20 = load double, double* %4
%21 = load double, double* %7
%22 = call double @cos(double %21)
%23 = fmul double %20, %22
%24 = load double, double* %4
%25 = load double, double* %7
%26 = call double @sin(double %25)
%27 = fmul double %24, %26
%28 = call i32 @glVertex3d(double %23, double %27, double 0.000000e+00)
%29 = load double, double* @M_PI
%30 = fmul double 2.000000e+00, %29
%31 = load i32, i32* %6
%32 = sitofp i32 %31 to double
%33 = fdiv double %30, %32
%34 = load double, double* %7
%35 = fadd double %34, %33
store double %35, double* %7
br label %36
36: ; preds = %19
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
br label %15
39: ; preds = %15
%40 = call i32 (...) @glEnd()
%41 = load i32, i32* @GL_TRIANGLE_STRIP
%42 = call i32 @glBegin(i32 %41)
%43 = load double, double* @M_PI
%44 = fmul double 2.000000e+00, %43
store double %44, double* %7
store i32 0, i32* %9
br label %45
45: ; preds = %94, %39
%46 = load i32, i32* %9
%47 = load i32, i32* %6
%48 = icmp sle i32 %46, %47
br i1 %48, label %49, label %97
49: ; preds = %45
%50 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%51 = load double, double* %4
%52 = load double, double* %7
%53 = call double @cos(double %52)
%54 = fmul double %51, %53
%55 = load double, double* %4
%56 = load double, double* %7
%57 = call double @sin(double %56)
%58 = fmul double %55, %57
%59 = load double, double* %5
%60 = fneg double %59
%61 = load double, double* %7
%62 = load double, double* @M_PI
%63 = fdiv double %62, 2.000000e+00
%64 = fadd double %61, %63
%65 = call double @cos(double %64)
%66 = load double, double* %7
%67 = load double, double* @M_PI
%68 = fdiv double %67, 2.000000e+00
%69 = fadd double %66, %68
%70 = call double @sin(double %69)
%71 = call i32 @vprodukt(double* %50, double %54, double %58, double %60, double %65, double %70, double 0.000000e+00)
%72 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%73 = call i32 @normiraj(double* %72)
%74 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%75 = call i32 @glNormal3dv(double* %74)
%76 = load double, double* %5
%77 = call i32 @glVertex3d(double 0.000000e+00, double 0.000000e+00, double %76)
%78 = load double, double* %4
%79 = load double, double* %7
%80 = call double @cos(double %79)
%81 = fmul double %78, %80
%82 = load double, double* %4
%83 = load double, double* %7
%84 = call double @sin(double %83)
%85 = fmul double %82, %84
%86 = call i32 @glVertex3d(double %81, double %85, double 0.000000e+00)
%87 = load double, double* @M_PI
%88 = fmul double 2.000000e+00, %87
%89 = load i32, i32* %6
%90 = sitofp i32 %89 to double
%91 = fdiv double %88, %90
%92 = load double, double* %7
%93 = fsub double %92, %91
store double %93, double* %7
br label %94
94: ; preds = %49
%95 = load i32, i32* %9
%96 = add nsw i32 %95, 1
store i32 %96, i32* %9
br label %45
97: ; preds = %45
%98 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_TRIANGLE_FAN = global i32 0
@M_PI = global double 0.000000e+00
@GL_TRIANGLE_STRIP = global i32 0
define void @stozacV2(double %0, double %1, i32 %2) {
%4 = alloca [3 x double]
%5 = bitcast [3 x double]* %4 to i8*
%6 = load i32, i32* @GL_TRIANGLE_FAN
%7 = tail call i32 @glBegin(i32 %6)
%8 = tail call i32 @glNormal3d(double 0.000000e+00, double 0.000000e+00, double -1.000000e+00)
%9 = tail call i32 @glVertex3d(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%10 = icmp slt i32 %2, 0
br i1 %10, label %67, label %11
11: ; preds = %3
%12 = sitofp i32 %2 to double
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ 0, %11 ], [ %25, %13 ]
%15 = phi double [ 0.000000e+00, %11 ], [ %24, %13 ]
%16 = tail call double @cos(double %15)
%17 = fmul double %16, %0
%18 = tail call double @sin(double %15)
%19 = fmul double %18, %0
%20 = tail call i32 @glVertex3d(double %17, double %19, double 0.000000e+00)
%21 = load double, double* @M_PI
%22 = fmul double %21, 2.000000e+00
%23 = fdiv double %22, %12
%24 = fadd double %15, %23
%25 = add nuw i32 %14, 1
%26 = icmp eq i32 %14, %2
br i1 %26, label %27, label %13
27: ; preds = %13
%28 = tail call i32 (...) @glEnd()
%29 = load i32, i32* @GL_TRIANGLE_STRIP
%30 = tail call i32 @glBegin(i32 %29)
br i1 %10, label %71, label %31
31: ; preds = %27
%32 = load double, double* @M_PI
%33 = fmul double %32, 2.000000e+00
%34 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%35 = fneg double %1
%36 = sitofp i32 %2 to double
br label %37
37: ; preds = %31, %37
%38 = phi i32 [ 0, %31 ], [ %65, %37 ]
%39 = phi double [ %33, %31 ], [ %64, %37 ]
%40 = call double @cos(double %39)
%41 = fmul double %40, %0
%42 = call double @sin(double %39)
%43 = fmul double %42, %0
%44 = load double, double* @M_PI
%45 = fmul double %44, 5.000000e-01
%46 = fadd double %39, %45
%47 = call double @cos(double %46)
%48 = load double, double* @M_PI
%49 = fmul double %48, 5.000000e-01
%50 = fadd double %39, %49
%51 = call double @sin(double %50)
%52 = call i32 @vprodukt(double* %34, double %41, double %43, double %35, double %47, double %51, double 0.000000e+00)
%53 = call i32 @normiraj(double* %34)
%54 = call i32 @glNormal3dv(double* %34)
%55 = call i32 @glVertex3d(double 0.000000e+00, double 0.000000e+00, double %1)
%56 = call double @cos(double %39)
%57 = fmul double %56, %0
%58 = call double @sin(double %39)
%59 = fmul double %58, %0
%60 = call i32 @glVertex3d(double %57, double %59, double 0.000000e+00)
%61 = load double, double* @M_PI
%62 = fmul double %61, 2.000000e+00
%63 = fdiv double %62, %36
%64 = fsub double %39, %63
%65 = add nuw i32 %38, 1
%66 = icmp eq i32 %38, %2
br i1 %66, label %71, label %37
67: ; preds = %3
%68 = tail call i32 (...) @glEnd()
%69 = load i32, i32* @GL_TRIANGLE_STRIP
%70 = tail call i32 @glBegin(i32 %69)
br label %71
71: ; preds = %37, %67, %27
%72 = call i32 (...) @glEnd()
ret void
}