#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_AMBIENT_AND_DIFFUSE;
int /*<<< orphan*/ GL_BLEND;
int /*<<< orphan*/ GL_EMISSION;
int /*<<< orphan*/ GL_FRONT;
int /*<<< orphan*/ GL_LINES;
double gen_rand_float(int /*<<< orphan*/, double);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glDisable(int /*<<< orphan*/);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glMaterialfv(int /*<<< orphan*/, int /*<<< orphan*/,
                                float *);
int /*<<< orphan*/ glVertex3f(double, double, double);
void draw_torp_plasma(void) {
  float emit0[] = {1, 1, 1, 1};
  float ad0[] = {0, 0, 0, 1};
  int k;
  glEnable(GL_BLEND);
  for (k = 0; k < 20; ++k) {
    ad0[3] = gen_rand_float(0, 1);
    emit0[0] = emit0[1] = gen_rand_float(0, 1);
    glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, ad0);
    glMaterialfv(GL_FRONT, GL_EMISSION, emit0);
    glBegin(GL_LINES);
    glVertex3f(0, 0, 0);
    if (k % 7 == 0)
      glVertex3f(gen_rand_float(0, 2 * 0.5) - 0.5,
                 gen_rand_float(0, 2 * 0.5) - 0.5,
                 gen_rand_float(0, 2 * 0.5) - 0.5);
    else
      glVertex3f(gen_rand_float(0, 0.5) - 0.5 / 2,
                 gen_rand_float(0, 0.5) - 0.5 / 2,
                 gen_rand_float(0, 0.5) - 0.5 / 2);
    glEnd();
  }
  glDisable(GL_BLEND);
  return;
}


x86 assembly (clang, -O0):
<draw_torp_plasma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xea1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xe9e(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xe9b(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe98(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x14,-0x24(%rbp)
jge    1352 <draw_torp_plasma+0x1e2>
xor    %edi,%edi
movsd  0xe33(%rip),%xmm0
call   1030 <gen_rand_float@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xor    %edi,%edi
movsd  0xe1b(%rip),%xmm0
call   1030 <gen_rand_float@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  %xmm0,-0x10(%rbp)
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    0x2db8(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1080 <glMaterialfv@plt>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
mov    0x2dad(%rip),%rax
mov    (%rax),%esi
lea    -0x10(%rbp),%rdx
call   1080 <glMaterialfv@plt>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1040 <glVertex3f@plt>
mov    -0x24(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12d0 <draw_torp_plasma+0x160>
xor    %edi,%edi
movsd  0xd98(%rip),%xmm0
call   1030 <gen_rand_float@plt>
movsd  0xd9b(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
xor    %edi,%edi
movsd  0xd78(%rip),%xmm0
call   1030 <gen_rand_float@plt>
movsd  0xd7b(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
xor    %edi,%edi
movsd  0xd58(%rip),%xmm0
call   1030 <gen_rand_float@plt>
movsd  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
movsd  0xd4e(%rip),%xmm3
subsd  %xmm3,%xmm2
call   1040 <glVertex3f@plt>
jmp    133d <draw_torp_plasma+0x1cd>
xor    %edi,%edi
movsd  0xd36(%rip),%xmm0
call   1030 <gen_rand_float@plt>
movsd  0xd21(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
xor    %edi,%edi
movsd  0xd16(%rip),%xmm0
call   1030 <gen_rand_float@plt>
movsd  0xd01(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
xor    %edi,%edi
movsd  0xcf6(%rip),%xmm0
call   1030 <gen_rand_float@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
movsd  0xcd4(%rip),%xmm3
subsd  %xmm3,%xmm2
call   1040 <glVertex3f@plt>
mov    $0x0,%al
call   1060 <glEnd@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b9 <draw_torp_plasma+0x49>
mov    0x2c7f(%rip),%rax
mov    (%rax),%edi
call   1070 <glDisable@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_torp_plasma>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movaps 0xeab(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeaf(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2e35(%rip),%rbx
lea    0xe5e(%rip),%r13
lea    0xe67(%rip),%rbp
xor    %r14d,%r14d
xor    %r15d,%r15d
nop
movzbl %r14b,%r14d
lea    (%r14,%r14,8),%eax
lea    (%r14,%rax,4),%eax
shr    $0x8,%eax
mov    %r14d,%ecx
sub    %al,%cl
shr    %cl
add    %al,%cl
shr    $0x2,%cl
movzbl %cl,%r12d
lea    0x0(,%r12,8),%eax
sub    %eax,%r12d
xor    %edi,%edi
movsd  0xe0c(%rip),%xmm0
call   1030 <gen_rand_float@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x3c(%rsp)
xor    %edi,%edi
movsd  0xdf3(%rip),%xmm0
call   1030 <gen_rand_float@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x14(%rsp)
movss  %xmm0,0x10(%rsp)
mov    (%rbx),%edi
mov    0x2d95(%rip),%rax
mov    (%rax),%esi
lea    0x30(%rsp),%rdx
call   1080 <glMaterialfv@plt>
mov    (%rbx),%edi
mov    0x2d90(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rdx
call   1080 <glMaterialfv@plt>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
call   1040 <glVertex3f@plt>
xor    %eax,%eax
cmp    %r15b,%r12b
sete   %al
movsd  0x0(%r13,%rax,8),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x0(%rbp,%rax,8),%xmm0
movsd  %xmm0,(%rsp)
xor    %edi,%edi
movapd %xmm1,%xmm0
call   1030 <gen_rand_float@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
xor    %edi,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <gen_rand_float@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
xor    %edi,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <gen_rand_float@plt>
movsd  (%rsp),%xmm2
addsd  %xmm0,%xmm2
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1040 <glVertex3f@plt>
xor    %eax,%eax
call   1060 <glEnd@plt>
add    $0xffffffff,%r15d
add    $0x1,%r14b
cmp    $0xffffffec,%r15d
jne    11c0 <draw_torp_plasma+0x50>
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
call   1070 <glDisable@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.draw_torp_plasma.emit0 = [4 x float] [float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00]
@__const.draw_torp_plasma.ad0 = [4 x float] [float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00]
@GL_BLEND = global i32 0
@GL_FRONT = global i32 0
@GL_AMBIENT_AND_DIFFUSE = global i32 0
@GL_EMISSION = global i32 0
@GL_LINES = global i32 0
define void @draw_torp_plasma() {
%1 = alloca [4 x float]
%2 = alloca [4 x float]
%3 = alloca i32
%4 = bitcast [4 x float]* %1 to i8*
%5 = bitcast [4 x float]* %2 to i8*
%6 = load i32, i32* @GL_BLEND
%7 = call i32 @glEnable(i32 %6)
store i32 0, i32* %3
br label %8
8: ; preds = %51, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 20
br i1 %10, label %11, label %54
11: ; preds = %8
%12 = call double @gen_rand_float(i32 0, double 1.000000e+00)
%13 = fptrunc double %12 to float
%14 = getelementptr inbounds [4 x float], [4 x float]* %2, i64 0, i64 3
store float %13, float* %14
%15 = call double @gen_rand_float(i32 0, double 1.000000e+00)
%16 = fptrunc double %15 to float
%17 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 1
store float %16, float* %17
%18 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 0
store float %16, float* %18
%19 = load i32, i32* @GL_FRONT
%20 = load i32, i32* @GL_AMBIENT_AND_DIFFUSE
%21 = getelementptr inbounds [4 x float], [4 x float]* %2, i64 0, i64 0
%22 = call i32 @glMaterialfv(i32 %19, i32 %20, float* %21)
%23 = load i32, i32* @GL_FRONT
%24 = load i32, i32* @GL_EMISSION
%25 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 0
%26 = call i32 @glMaterialfv(i32 %23, i32 %24, float* %25)
%27 = load i32, i32* @GL_LINES
%28 = call i32 @glBegin(i32 %27)
%29 = call i32 @glVertex3f(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%30 = load i32, i32* %3
%31 = srem i32 %30, 7
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %41
33: ; preds = %11
%34 = call double @gen_rand_float(i32 0, double 1.000000e+00)
%35 = fsub double %34, 5.000000e-01
%36 = call double @gen_rand_float(i32 0, double 1.000000e+00)
%37 = fsub double %36, 5.000000e-01
%38 = call double @gen_rand_float(i32 0, double 1.000000e+00)
%39 = fsub double %38, 5.000000e-01
%40 = call i32 @glVertex3f(double %35, double %37, double %39)
br label %49
41: ; preds = %11
%42 = call double @gen_rand_float(i32 0, double 5.000000e-01)
%43 = fsub double %42, 2.500000e-01
%44 = call double @gen_rand_float(i32 0, double 5.000000e-01)
%45 = fsub double %44, 2.500000e-01
%46 = call double @gen_rand_float(i32 0, double 5.000000e-01)
%47 = fsub double %46, 2.500000e-01
%48 = call i32 @glVertex3f(double %43, double %45, double %47)
br label %49
49: ; preds = %41, %33
%50 = call i32 (...) @glEnd()
br label %51
51: ; preds = %49
%52 = load i32, i32* %3
%53 = add nsw i32 %52, 1
store i32 %53, i32* %3
br label %8
54: ; preds = %8
%55 = load i32, i32* @GL_BLEND
%56 = call i32 @glDisable(i32 %55)
ret void
}

LLVM IR (-O2):
@__const.draw_torp_plasma.emit0 = [4 x float] [float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00]
@__const.draw_torp_plasma.ad0 = [4 x float] [float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00]
@GL_BLEND = global i32 0
@GL_FRONT = global i32 0
@GL_AMBIENT_AND_DIFFUSE = global i32 0
@GL_EMISSION = global i32 0
@GL_LINES = global i32 0
define void @draw_torp_plasma() {
%1 = alloca [4 x float]
%2 = alloca [4 x float]
%3 = bitcast [4 x float]* %1 to i8*
%4 = bitcast [4 x float]* %2 to i8*
%5 = load i32, i32* @GL_BLEND
%6 = tail call i32 @glEnable(i32 %5)
%7 = getelementptr inbounds [4 x float], [4 x float]* %2, i64 0, i64 3
%8 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 1
%9 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 0
%10 = getelementptr inbounds [4 x float], [4 x float]* %2, i64 0, i64 0
br label %11
11: ; preds = %0, %11
%12 = phi i32 [ 0, %0 ], [ %39, %11 ]
%13 = call double @gen_rand_float(i32 0, double 1.000000e+00)
%14 = fptrunc double %13 to float
store float %14, float* %7
%15 = call double @gen_rand_float(i32 0, double 1.000000e+00)
%16 = fptrunc double %15 to float
store float %16, float* %8
store float %16, float* %9
%17 = load i32, i32* @GL_FRONT
%18 = load i32, i32* @GL_AMBIENT_AND_DIFFUSE
%19 = call i32 @glMaterialfv(i32 %17, i32 %18, float* %10)
%20 = load i32, i32* @GL_FRONT
%21 = load i32, i32* @GL_EMISSION
%22 = call i32 @glMaterialfv(i32 %20, i32 %21, float* %9)
%23 = load i32, i32* @GL_LINES
%24 = call i32 @glBegin(i32 %23)
%25 = call i32 @glVertex3f(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%26 = trunc i32 %12 to i8
%27 = urem i8 %26, 7
%28 = icmp eq i8 %27, 0
%29 = select i1 %28, double 1.000000e+00, double 5.000000e-01
%30 = select i1 %28, double -5.000000e-01, double -2.500000e-01
%31 = call double @gen_rand_float(i32 0, double %29)
%32 = fadd double %31, %30
%33 = call double @gen_rand_float(i32 0, double %29)
%34 = fadd double %33, %30
%35 = call double @gen_rand_float(i32 0, double %29)
%36 = fadd double %35, %30
%37 = call i32 @glVertex3f(double %32, double %34, double %36)
%38 = call i32 (...) @glEnd()
%39 = add nuw nsw i32 %12, 1
%40 = icmp eq i32 %39, 20
br i1 %40, label %41, label %11
41: ; preds = %11
%42 = load i32, i32* @GL_BLEND
%43 = call i32 @glDisable(i32 %42)
ret void
}