#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 */
float const cos(float);
int genColor(int, float);
float const sin(float);
int genColorJulia(float x, float y, float theta) {
  static int const M = 1000, K = 255 * 3;
  static float const r = 0.7745452294733989;
  float p = r * cos(theta), q = r * sin(theta);
  float newx, newy, dif;
  int t;
  for (t = 1; t < K; t++) {
    newx = x * x - y * y + p;
    newy = 2.f * x * y + q;
    x = newx;
    y = newy;
    dif = x * x + y * y - M;
    if (dif > 0.f)
      return genColor((float)(t) / K * 2 * 255, dif);
  }
  return genColor(2 * 255, dif);
}


x86 assembly (clang, -O0):
<genColorJulia>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  0xea4(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  0xe86(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x1,-0x28(%rbp)
cmpl   $0x2fd,-0x28(%rbp)
jge    1292 <genColorJulia+0x162>
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe36(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x18(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xdde(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    127f <genColorJulia+0x14f>
cvtsi2ssl -0x28(%rbp),%xmm0
movss  0xdc3(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xdaf(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xda7(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
movss  -0x24(%rbp),%xmm0
call   1050 <genColor@plt>
mov    %eax,-0x4(%rbp)
jmp    12a4 <genColorJulia+0x174>
jmp    1284 <genColorJulia+0x154>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    118a <genColorJulia+0x5a>
movss  -0x24(%rbp),%xmm0
mov    $0x1fe,%edi
call   1050 <genColor@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genColorJulia>:
sub    $0x18,%rsp
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0x10(%rsp)
movaps %xmm2,%xmm0
call   1040 <cos@plt>
mulss  0xeaa(%rip),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
movss  0x8(%rsp),%xmm7
movss  0x10(%rsp),%xmm6
movss  0x14(%rsp),%xmm5
mulss  0xe7f(%rip),%xmm0
mov    $0x1,%eax
movss  0xe76(%rip),%xmm2
xorps  %xmm3,%xmm3
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movaps %xmm6,%xmm1
movaps %xmm5,%xmm4
mulss  %xmm5,%xmm4
mulss  %xmm6,%xmm6
subss  %xmm4,%xmm6
addss  %xmm7,%xmm6
addss  %xmm1,%xmm1
mulss  %xmm1,%xmm5
addss  %xmm0,%xmm5
movaps %xmm5,%xmm4
mulss  %xmm5,%xmm4
movaps %xmm6,%xmm1
mulss  %xmm6,%xmm1
addss  %xmm4,%xmm1
addss  %xmm2,%xmm1
ucomiss %xmm3,%xmm1
ja     11ee <genColorJulia+0xbe>
add    $0x1,%eax
cmp    $0x2fd,%eax
jne    11a0 <genColorJulia+0x70>
mov    $0x1fe,%edi
jmp    120d <genColorJulia+0xdd>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0xe0b(%rip),%xmm0
addss  %xmm0,%xmm0
mulss  0xe03(%rip),%xmm0
cvttss2si %xmm0,%edi
movaps %xmm1,%xmm0
add    $0x18,%rsp
jmp    1050 <genColor@plt>

LLVM IR (-O0):
@genColorJulia.M = internal constant i32 1000
@genColorJulia.K = internal constant i32 765
@genColorJulia.r = internal constant float 0x3FE8C91320000000
define i32 @genColorJulia(float %0, float %1, float %2) {
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca i32
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%14 = load float, float* %7
%15 = call float @cos(float %14)
%16 = fmul float 0x3FE8C91320000000, %15
store float %16, float* %8
%17 = load float, float* %7
%18 = call float @sin(float %17)
%19 = fmul float 0x3FE8C91320000000, %18
store float %19, float* %9
store i32 1, i32* %13
br label %20
20: ; preds = %59, %3
%21 = load i32, i32* %13
%22 = icmp slt i32 %21, 765
br i1 %22, label %23, label %62
23: ; preds = %20
%24 = load float, float* %5
%25 = load float, float* %5
%26 = load float, float* %6
%27 = load float, float* %6
%28 = fmul float %26, %27
%29 = fneg float %28
%30 = call float @llvm.fmuladd.f32(float %24, float %25, float %29)
%31 = load float, float* %8
%32 = fadd float %30, %31
store float %32, float* %10
%33 = load float, float* %5
%34 = fmul float 2.000000e+00, %33
%35 = load float, float* %6
%36 = load float, float* %9
%37 = call float @llvm.fmuladd.f32(float %34, float %35, float %36)
store float %37, float* %11
%38 = load float, float* %10
store float %38, float* %5
%39 = load float, float* %11
store float %39, float* %6
%40 = load float, float* %5
%41 = load float, float* %5
%42 = load float, float* %6
%43 = load float, float* %6
%44 = fmul float %42, %43
%45 = call float @llvm.fmuladd.f32(float %40, float %41, float %44)
%46 = fsub float %45, 1.000000e+03
store float %46, float* %12
%47 = load float, float* %12
%48 = fcmp ogt float %47, 0.000000e+00
br i1 %48, label %49, label %58
49: ; preds = %23
%50 = load i32, i32* %13
%51 = sitofp i32 %50 to float
%52 = fdiv float %51, 7.650000e+02
%53 = fmul float %52, 2.000000e+00
%54 = fmul float %53, 2.550000e+02
%55 = fptosi float %54 to i32
%56 = load float, float* %12
%57 = call i32 @genColor(i32 %55, float %56)
store i32 %57, i32* %4
br label %65
58: ; preds = %23
br label %59
59: ; preds = %58
%60 = load i32, i32* %13
%61 = add nsw i32 %60, 1
store i32 %61, i32* %13
br label %20
62: ; preds = %20
%63 = load float, float* %12
%64 = call i32 @genColor(i32 510, float %63)
store i32 %64, i32* %4
br label %65
65: ; preds = %62, %49
%66 = load i32, i32* %4
ret i32 %66
}

LLVM IR (-O2):
define i32 @genColorJulia(float %0, float %1, float %2) {
%4 = tail call float @cos(float %2)
%5 = fmul float %4, 0x3FE8C91320000000
%6 = tail call float @sin(float %2)
%7 = fmul float %6, 0x3FE8C91320000000
br label %8
8: ; preds = %3, %28
%9 = phi i32 [ 1, %3 ], [ %29, %28 ]
%10 = phi float [ %0, %3 ], [ %15, %28 ]
%11 = phi float [ %1, %3 ], [ %17, %28 ]
%12 = fneg float %11
%13 = fmul float %11, %12
%14 = tail call float @llvm.fmuladd.f32(float %10, float %10, float %13)
%15 = fadd float %5, %14
%16 = fmul float %10, 2.000000e+00
%17 = tail call float @llvm.fmuladd.f32(float %16, float %11, float %7)
%18 = fmul float %17, %17
%19 = tail call float @llvm.fmuladd.f32(float %15, float %15, float %18)
%20 = fadd float %19, -1.000000e+03
%21 = fcmp ogt float %20, 0.000000e+00
br i1 %21, label %22, label %28
22: ; preds = %8
%23 = sitofp i32 %9 to float
%24 = fdiv float %23, 7.650000e+02
%25 = fmul float %24, 2.000000e+00
%26 = fmul float %25, 2.550000e+02
%27 = fptosi float %26 to i32
br label %31
28: ; preds = %8
%29 = add nuw nsw i32 %9, 1
%30 = icmp eq i32 %29, 765
br i1 %30, label %31, label %8
31: ; preds = %28, %22
%32 = phi i32 [ %27, %22 ], [ 510, %28 ]
%33 = tail call i32 @genColor(i32 %32, float %20)
ret i32 %33
}