#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 mandelbrot(double, double);
int /*<<< orphan*/ putchar(char);
int main() {
  int ix, iy;
  for (iy = 0; iy <= 50; ++iy) {
    for (ix = 0; ix <= 80; ++ix) {
      double x0 = ix * (1.0 - -2.0) / 80 + -2.0;
      double y0 = iy * (1.3 - -1.3) / 50 + -1.3;
      putchar(" +@-.*"[mandelbrot(x0, y0) % 5]);
    }
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x32,-0xc(%rbp)
jg     11fd <main+0xdd>
movl   $0x0,-0x8(%rbp)
cmpl   $0x50,-0x8(%rbp)
jg     11e5 <main+0xc5>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xeca(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xea2(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe84(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe70(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe5c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1040 <mandelbrot@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0xe62(%rip),%rax
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1147 <main+0x27>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
xor    %r14d,%r14d
xorpd  %xmm0,%xmm0
lea    0xf02(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
mulsd  0xeb2(%rip),%xmm0
divsd  0xeb2(%rip),%xmm0
addsd  0xeb2(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    $0x51,%ebp
xorpd  %xmm1,%xmm1
nopl   (%rax)
movsd  %xmm1,0x18(%rsp)
movapd %xmm1,%xmm0
mulsd  0xe96(%rip),%xmm0
divsd  0xe96(%rip),%xmm0
addsd  0xe96(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <mandelbrot@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
cltq
movsbl (%rax,%rbx,1),%edi
call   1030 <putchar@plt>
movsd  0x18(%rsp),%xmm1
addsd  0xe5f(%rip),%xmm1
add    $0xffffffff,%ebp
jne    1170 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x8(%rsp),%xmm0
movsd  0xe42(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x1,%r14d
cmp    $0x33,%r14d
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c" +@-.*\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store i32 0, i32* %3
br label %6
6: ; preds = %37, %0
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 50
br i1 %8, label %9, label %40
9: ; preds = %6
store i32 0, i32* %2
br label %10
10: ; preds = %32, %9
%11 = load i32, i32* %2
%12 = icmp sle i32 %11, 80
br i1 %12, label %13, label %35
13: ; preds = %10
%14 = load i32, i32* %2
%15 = sitofp i32 %14 to double
%16 = fmul double %15, 3.000000e+00
%17 = fdiv double %16, 8.000000e+01
%18 = fadd double %17, -2.000000e+00
store double %18, double* %4
%19 = load i32, i32* %3
%20 = sitofp i32 %19 to double
%21 = fmul double %20, 2.600000e+00
%22 = fdiv double %21, 5.000000e+01
%23 = fadd double %22, -1.300000e+00
store double %23, double* %5
%24 = load double, double* %4
%25 = load double, double* %5
%26 = call i32 @mandelbrot(double %24, double %25)
%27 = srem i32 %26, 5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [7 x i8], [7 x i8]* @.str, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = call i32 @putchar(i8 signext %30)
br label %32
32: ; preds = %13
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %10
35: ; preds = %10
%36 = call i32 @putchar(i8 signext 10)
br label %37
37: ; preds = %35
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %6
40: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c" +@-.*\00"
define i32 @main() {
br label %1
1: ; preds = %0, %21
%2 = phi i32 [ 0, %0 ], [ %23, %21 ]
%3 = sitofp i32 %2 to double
%4 = fmul double %3, 2.600000e+00
%5 = fdiv double %4, 5.000000e+01
%6 = fadd double %5, -1.300000e+00
br label %7
7: ; preds = %1, %7
%8 = phi i32 [ 0, %1 ], [ %19, %7 ]
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 3.000000e+00
%11 = fdiv double %10, 8.000000e+01
%12 = fadd double %11, -2.000000e+00
%13 = tail call i32 @mandelbrot(double %12, double %6)
%14 = srem i32 %13, 5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [7 x i8], [7 x i8]* @.str, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = tail call i32 @putchar(i8 signext %17)
%19 = add nuw nsw i32 %8, 1
%20 = icmp eq i32 %19, 81
br i1 %20, label %21, label %7
21: ; preds = %7
%22 = tail call i32 @putchar(i8 signext 10)
%23 = add nuw nsw i32 %2, 1
%24 = icmp eq i32 %23, 51
br i1 %24, label %25, label %1
25: ; preds = %21
ret i32 0
}