#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 I;
int mandelbrot(double, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  double y = -1.3;
  while (y <= 0.9) {
    double x = -2.0;
    while (x <= 1.3) {
      printf("%c",
             " .::!!!ooooOOOOO################################################ "
                 [mandelbrot(x + I * y, 1024) / 16]);
      x += 0.025;
    }
    y += 0.05;
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xec4(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11f6 <main+0xd6>
movsd  0xeb9(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb4(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     11d1 <main+0xb1>
movsd  -0x18(%rbp),%xmm1
mov    0x2e6d(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    $0x400,%edi
call   1040 <mandelbrot@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
lea    0xe8b(%rip),%rax
movsbl (%rax,%rcx,1),%esi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xe66(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    115c <main+0x3c>
movsd  0xe47(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113c <main+0x1c>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  0xed1(%rip),%xmm1
mov    0x2eb2(%rip),%r14
lea    0xef3(%rip),%rbx
nopl   (%rax)
movsd  0xec0(%rip),%xmm2
movsd  %xmm1,0x8(%rsp)
xchg   %ax,%ax
movsd  %xmm2,0x10(%rsp)
movsd  (%r14),%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
mov    $0x400,%edi
call   1040 <mandelbrot@plt>
lea    0xf(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x4,%ecx
movslq %ecx,%rax
movsbl (%rax,%rbx,1),%edi
call   1030 <putchar@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
addsd  0xe78(%rip),%xmm2
movsd  0xe78(%rip),%xmm0
ucomisd %xmm2,%xmm0
jae    1150 <main+0x30>
addsd  0xe72(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x8(%rsp),%xmm1
movsd  0xe5c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    1140 <main+0x20>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [66 x i8] c" .::!!!ooooOOOOO################################################ \00"
@I = global double 0.000000e+00
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
store double -1.300000e+00, double* %2
br label %4
4: ; preds = %25, %0
%5 = load double, double* %2
%6 = fcmp ole double %5, 9.000000e-01
br i1 %6, label %7, label %29
7: ; preds = %4
store double -2.000000e+00, double* %3
br label %8
8: ; preds = %11, %7
%9 = load double, double* %3
%10 = fcmp ole double %9, 1.300000e+00
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load double, double* %3
%13 = load double, double* @I
%14 = load double, double* %2
%15 = call double @llvm.fmuladd.f64(double %13, double %14, double %12)
%16 = call i32 @mandelbrot(double %15, i32 1024)
%17 = sdiv i32 %16, 16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [66 x i8], [66 x i8]* @.str.1, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load double, double* %3
%24 = fadd double %23, 2.500000e-02
store double %24, double* %3
br label %8
25: ; preds = %8
%26 = load double, double* %2
%27 = fadd double %26, 5.000000e-02
store double %27, double* %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %4
29: ; preds = %4
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str.1 = [66 x i8] c" .::!!!ooooOOOOO################################################ \00"
@I = global double 0.000000e+00
define i32 @main() {
br label %1
1: ; preds = %0, %16
%2 = phi double [ -1.300000e+00, %0 ], [ %17, %16 ]
br label %3
3: ; preds = %1, %3
%4 = phi double [ -2.000000e+00, %1 ], [ %14, %3 ]
%5 = load double, double* @I
%6 = tail call double @llvm.fmuladd.f64(double %5, double %2, double %4)
%7 = tail call i32 @mandelbrot(double %6, i32 1024)
%8 = sdiv i32 %7, 16
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [66 x i8], [66 x i8]* @.str.1, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = tail call i32 @putchar(i32 %12)
%14 = fadd double %4, 2.500000e-02
%15 = fcmp ugt double %14, 1.300000e+00
br i1 %15, label %16, label %3
16: ; preds = %3
%17 = fadd double %2, 5.000000e-02
%18 = tail call i32 @putchar(i32 10)
%19 = fcmp ugt double %17, 9.000000e-01
br i1 %19, label %20, label %1
20: ; preds = %16
ret i32 0
}