#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*/ fputs(char *, int /*<<< orphan*/);
int mandelbrot(int, int);
int /*<<< orphan*/ stderr;
void run2() {
  int x, y;
  for (y = -39; y < 39; y++) {
    fputs("\n", stderr);
    for (x = -39; x < 39; x++) {
      int i = mandelbrot(x / 40.0, y / 40.0);
      if (i == 0)
        fputs("*", stderr);
      else
        fputs(" ", stderr);
    }
  }
  fputs("\n", stderr);
}


x86 assembly (clang, -O0):
<run2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffd9,-0x8(%rbp)
cmpl   $0x27,-0x8(%rbp)
jge    11f0 <run2+0xd0>
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1030 <fputs@plt>
movl   $0xffffffd9,-0x4(%rbp)
cmpl   $0x27,-0x4(%rbp)
jge    11dd <run2+0xbd>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe7f(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
call   1040 <mandelbrot@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11b5 <run2+0x95>
mov    0x2e3e(%rip),%rax
mov    (%rax),%esi
lea    0xe5f(%rip),%rdi
call   1030 <fputs@plt>
jmp    11ca <run2+0xaa>
mov    0x2e24(%rip),%rax
mov    (%rax),%esi
lea    0xe47(%rip),%rdi
call   1030 <fputs@plt>
jmp    11cf <run2+0xaf>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1155 <run2+0x35>
jmp    11e2 <run2+0xc2>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <run2+0xf>
mov    0x2de9(%rip),%rax
mov    (%rax),%esi
lea    0xe08(%rip),%rdi
call   1030 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0xffffffd9,%r15d
movsd  0xec4(%rip),%xmm0
mov    0x2e9d(%rip),%r12
lea    0xed0(%rip),%r13
lea    0xecb(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
mov    (%r12),%esi
lea    0xea7(%rip),%rdi
call   1030 <fputs@plt>
movsd  0x8(%rsp),%xmm0
movsd  0xe84(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ebp
mov    $0x4e,%r14d
movsd  0xe66(%rip),%xmm0
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
divsd  0xe54(%rip),%xmm0
cvttsd2si %xmm0,%edi
mov    %ebp,%esi
call   1040 <mandelbrot@plt>
test   %eax,%eax
mov    (%r12),%esi
mov    %rbx,%rdi
cmove  %r13,%rdi
call   1030 <fputs@plt>
movsd  0x10(%rsp),%xmm0
addsd  0xe31(%rip),%xmm0
add    $0xffffffff,%r14d
jne    11a0 <run2+0x80>
movsd  0x8(%rsp),%xmm0
movsd  0xe1d(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x1,%r15d
cmp    $0x27,%r15d
jne    1160 <run2+0x40>
mov    (%r12),%esi
lea    0xe08(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [2 x i8] c" \00"
define void @run2() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 -39, i32* %2
br label %4
4: ; preds = %36, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 39
br i1 %6, label %7, label %39
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %8)
store i32 -39, i32* %1
br label %10
10: ; preds = %32, %7
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 39
br i1 %12, label %13, label %35
13: ; preds = %10
%14 = load i32, i32* %1
%15 = sitofp i32 %14 to double
%16 = fdiv double %15, 4.000000e+01
%17 = fptosi double %16 to i32
%18 = load i32, i32* %2
%19 = sitofp i32 %18 to double
%20 = fdiv double %19, 4.000000e+01
%21 = fptosi double %20 to i32
%22 = call i32 @mandelbrot(i32 %17, i32 %21)
store i32 %22, i32* %3
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %13
%26 = load i32, i32* @stderr
%27 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %31
28: ; preds = %13
%29 = load i32, i32* @stderr
%30 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %25
br label %32
32: ; preds = %31
%33 = load i32, i32* %1
%34 = add nsw i32 %33, 1
store i32 %34, i32* %1
br label %10
35: ; preds = %10
br label %36
36: ; preds = %35
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %4
39: ; preds = %4
%40 = load i32, i32* @stderr
%41 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %40)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [2 x i8] c" \00"
define void @run2() {
br label %1
1: ; preds = %0, %20
%2 = phi i32 [ -39, %0 ], [ %21, %20 ]
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = sitofp i32 %2 to double
%6 = fdiv double %5, 4.000000e+01
%7 = fptosi double %6 to i32
br label %8
8: ; preds = %1, %8
%9 = phi i32 [ -39, %1 ], [ %18, %8 ]
%10 = sitofp i32 %9 to double
%11 = fdiv double %10, 4.000000e+01
%12 = fptosi double %11 to i32
%13 = tail call i32 @mandelbrot(i32 %12, i32 %7)
%14 = icmp eq i32 %13, 0
%15 = load i32, i32* @stderr
%16 = select i1 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%17 = tail call i32 @fputs(i8* %16, i32 %15)
%18 = add nsw i32 %9, 1
%19 = icmp eq i32 %18, 39
br i1 %19, label %20, label %8
20: ; preds = %8
%21 = add nsw i32 %2, 1
%22 = icmp eq i32 %21, 39
br i1 %22, label %23, label %1
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %24)
ret void
}