#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 atof(char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
char iter_to_char(int);
int /*<<< orphan*/ iter_to_color(int);
int iterate(float, float);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ reset_tty(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void main(int argc, char **argv) {
  int x, y;
  float cr, ci;
  float step_r, step_i;
  float min_r = -2.0;
  float min_i = -2.0;
  float max_r = 2.0;
  float max_i = 2.0;
  int value;
  if (argc > 4) {
    min_r = atof(argv[1]);
    min_i = atof(argv[2]);
    max_r = atof(argv[3]);
    max_i = atof(argv[4]);
  }
  argc;
  argv;
  step_r = (max_r - min_r) / 80;
  step_i = (max_i - min_i) / 39;
  for (y = 0, ci = max_i; y < 39; y++, ci -= step_i) {
    for (x = 0, cr = min_r; x < 80; x++, cr += step_r) {
      value = iterate(cr, ci);
      iter_to_color(value);
      putchar(iter_to_char(value));
      fflush(stdout);
    }
    putchar('\n');
  }
  reset_tty(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xe7d(%rip),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  0xe70(%rip),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  0xe5f(%rip),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  0xe52(%rip),%xmm0
movss  %xmm0,-0x38(%rbp)
cmpl   $0x4,-0x4(%rbp)
jle    1205 <main+0x95>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atof@plt>
movss  %xmm0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atof@plt>
movss  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atof@plt>
movss  %xmm0,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1040 <atof@plt>
movss  %xmm0,-0x38(%rbp)
movss  -0x34(%rbp),%xmm0
subss  -0x2c(%rbp),%xmm0
movss  0xdf5(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x38(%rbp),%xmm0
subss  -0x30(%rbp),%xmm0
movss  0xdd6(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
cmpl   $0x27,-0x18(%rbp)
jge    12f1 <main+0x181>
movl   $0x0,-0x14(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cmpl   $0x50,-0x14(%rbp)
jge    12c6 <main+0x156>
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
call   1090 <iterate@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%edi
call   1060 <iter_to_color@plt>
mov    -0x3c(%rbp),%edi
call   1080 <iter_to_char@plt>
movsbl %al,%edi
call   1030 <putchar@plt>
mov    0x2d3e(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movss  -0x24(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1267 <main+0xf7>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movss  -0x28(%rbp),%xmm1
movss  -0x20(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    124c <main+0xdc>
xor    %edi,%edi
call   1050 <reset_tty@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
cmp    $0x5,%edi
jl     11cc <main+0x5c>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <atof@plt>
movss  %xmm0,0x8(%rsp)
mov    0x10(%rbx),%rdi
call   1040 <atof@plt>
movss  %xmm0,0x4(%rsp)
mov    0x18(%rbx),%rdi
call   1040 <atof@plt>
movss  %xmm0,0xc(%rsp)
mov    0x20(%rbx),%rdi
call   1040 <atof@plt>
movss  0x4(%rsp),%xmm3
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm2
jmp    11e2 <main+0x72>
movss  0xe2c(%rip),%xmm1
movss  0xe28(%rip),%xmm2
movaps %xmm2,%xmm3
movaps %xmm1,%xmm0
subss  %xmm2,%xmm1
divss  0xe1a(%rip),%xmm1
movss  %xmm1,0xc(%rsp)
movaps %xmm0,%xmm1
subss  %xmm3,%xmm1
divss  0xe09(%rip),%xmm1
movss  %xmm1,0x14(%rsp)
xor    %r14d,%r14d
mov    0x2dcd(%rip),%r15
movss  %xmm2,0x8(%rsp)
nopl   0x0(%rax)
movss  %xmm0,0x10(%rsp)
mov    $0x50,%ebp
nopl   0x0(%rax,%rax,1)
movss  %xmm2,0x4(%rsp)
movss  0x4(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1090 <iterate@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1060 <iter_to_color@plt>
mov    %ebx,%edi
call   1080 <iter_to_char@plt>
movsbl %al,%edi
call   1030 <putchar@plt>
mov    (%r15),%edi
call   1070 <fflush@plt>
movss  0x4(%rsp),%xmm2
addss  0xc(%rsp),%xmm2
add    $0xffffffff,%ebp
jne    1230 <main+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
movss  0x10(%rsp),%xmm0
subss  0x14(%rsp),%xmm0
cmp    $0x27,%r14d
movss  0x8(%rsp),%xmm2
jne    1220 <main+0xb0>
xor    %edi,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <reset_tty@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store float -2.000000e+00, float* %11
store float -2.000000e+00, float* %12
store float 2.000000e+00, float* %13
store float 2.000000e+00, float* %14
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 4
br i1 %17, label %18, label %35
18: ; preds = %2
%19 = load i8**, i8*** %4
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call float @atof(i8* %21)
store float %22, float* %11
%23 = load i8**, i8*** %4
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call float @atof(i8* %25)
store float %26, float* %12
%27 = load i8**, i8*** %4
%28 = getelementptr inbounds i8*, i8** %27, i64 3
%29 = load i8*, i8** %28
%30 = call float @atof(i8* %29)
store float %30, float* %13
%31 = load i8**, i8*** %4
%32 = getelementptr inbounds i8*, i8** %31, i64 4
%33 = load i8*, i8** %32
%34 = call float @atof(i8* %33)
store float %34, float* %14
br label %35
35: ; preds = %18, %2
%36 = load i32, i32* %3
%37 = load i8**, i8*** %4
%38 = load float, float* %13
%39 = load float, float* %11
%40 = fsub float %38, %39
%41 = fdiv float %40, 8.000000e+01
store float %41, float* %9
%42 = load float, float* %14
%43 = load float, float* %12
%44 = fsub float %42, %43
%45 = fdiv float %44, 3.900000e+01
store float %45, float* %10
store i32 0, i32* %6
%46 = load float, float* %14
store float %46, float* %8
br label %47
47: ; preds = %74, %35
%48 = load i32, i32* %6
%49 = icmp slt i32 %48, 39
br i1 %49, label %50, label %80
50: ; preds = %47
store i32 0, i32* %5
%51 = load float, float* %11
store float %51, float* %7
br label %52
52: ; preds = %66, %50
%53 = load i32, i32* %5
%54 = icmp slt i32 %53, 80
br i1 %54, label %55, label %72
55: ; preds = %52
%56 = load float, float* %7
%57 = load float, float* %8
%58 = call i32 @iterate(float %56, float %57)
store i32 %58, i32* %15
%59 = load i32, i32* %15
%60 = call i32 @iter_to_color(i32 %59)
%61 = load i32, i32* %15
%62 = call signext i8 @iter_to_char(i32 %61)
%63 = call i32 @putchar(i8 signext %62)
%64 = load i32, i32* @stdout
%65 = call i32 @fflush(i32 %64)
br label %66
66: ; preds = %55
%67 = load i32, i32* %5
%68 = add nsw i32 %67, 1
store i32 %68, i32* %5
%69 = load float, float* %9
%70 = load float, float* %7
%71 = fadd float %70, %69
store float %71, float* %7
br label %52
72: ; preds = %52
%73 = call i32 @putchar(i8 signext 10)
br label %74
74: ; preds = %72
%75 = load i32, i32* %6
%76 = add nsw i32 %75, 1
store i32 %76, i32* %6
%77 = load float, float* %10
%78 = load float, float* %8
%79 = fsub float %78, %77
store float %79, float* %8
br label %47
80: ; preds = %47
%81 = call i32 @reset_tty(i32 0)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 4
br i1 %3, label %4, label %17
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call float @atof(i8* %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call float @atof(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 3
%12 = load i8*, i8** %11
%13 = tail call float @atof(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 4
%15 = load i8*, i8** %14
%16 = tail call float @atof(i8* %15)
br label %17
17: ; preds = %4, %2
%18 = phi float [ %7, %4 ], [ -2.000000e+00, %2 ]
%19 = phi float [ %10, %4 ], [ -2.000000e+00, %2 ]
%20 = phi float [ %13, %4 ], [ 2.000000e+00, %2 ]
%21 = phi float [ %16, %4 ], [ 2.000000e+00, %2 ]
%22 = fsub float %20, %18
%23 = fdiv float %22, 8.000000e+01
%24 = fsub float %21, %19
%25 = fdiv float %24, 3.900000e+01
br label %26
26: ; preds = %17, %41
%27 = phi i32 [ 0, %17 ], [ %43, %41 ]
%28 = phi float [ %21, %17 ], [ %44, %41 ]
br label %29
29: ; preds = %26, %29
%30 = phi i32 [ 0, %26 ], [ %38, %29 ]
%31 = phi float [ %18, %26 ], [ %39, %29 ]
%32 = tail call i32 @iterate(float %31, float %28)
%33 = tail call i32 @iter_to_color(i32 %32)
%34 = tail call signext i8 @iter_to_char(i32 %32)
%35 = tail call i32 @putchar(i8 signext %34)
%36 = load i32, i32* @stdout
%37 = tail call i32 @fflush(i32 %36)
%38 = add nuw nsw i32 %30, 1
%39 = fadd float %23, %31
%40 = icmp eq i32 %38, 80
br i1 %40, label %41, label %29
41: ; preds = %29
%42 = tail call i32 @putchar(i8 signext 10)
%43 = add nuw nsw i32 %27, 1
%44 = fsub float %28, %25
%45 = icmp eq i32 %43, 39
br i1 %45, label %46, label %26
46: ; preds = %41
%47 = tail call i32 @reset_tty(i32 0)
ret void
}