#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 mandel(double, double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *, double *, double *, double *,
                         double *);
int main(int argc, char *argv[]) {
  double px, py, ph, t, gray, mpx, mpy, n, x, y, w, h;
  scanf("%lf%lf%lf%lf%lf", &n, &x, &y, &w, &h);
  double baseY = y;
  double s = (512.0 / n);
  int row;
  int col;
  printf("%%!\n");
  printf("\t 50 50 translate\n");
  printf("\t 0 0 512 512 rectstroke\n");
  for (row = 0; row < n; row++) {
    y = baseY;
    for (col = 0; col < n; col++) {
      mpx = x + (0.5 * w / n);
      mpy = y + (0.5 * w / n);
      t = mandel(mpx, mpy);
      gray = 1.0 - t / 255.0;
      px = s * row;
      py = s * col;
      printf("\t %.3f setgray %.3f %.3f %.3f %.3f rectfill\n", gray, px, py, s,
             s);
      y += h / n;
    }
    x += w / n;
  }
  printf("\t showpage\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed0(%rip),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x58(%rbp),%rdx
lea    -0x60(%rbp),%rcx
lea    -0x68(%rbp),%r8
lea    -0x70(%rbp),%r9
call   1050 <scanf@plt>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xe85(%rip),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x84(%rbp)
cvtsi2sdl -0x84(%rbp),%xmm1
ff
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1314 <main+0x1e4>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x88(%rbp)
cvtsi2sdl -0x88(%rbp),%xmm1
ff
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12ec <main+0x1bc>
movsd  -0x58(%rbp),%xmm0
movsd  0xe10(%rip),%xmm1
mulsd  -0x68(%rbp),%xmm1
divsd  -0x50(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xdf0(%rip),%xmm1
mulsd  -0x68(%rbp),%xmm1
divsd  -0x50(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
call   1040 <mandel@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  0xdb4(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xda0(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x80(%rbp),%xmm0
cvtsi2sdl -0x84(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x80(%rbp),%xmm0
cvtsi2sdl -0x88(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm3
movsd  -0x80(%rbp),%xmm4
lea    0xda5(%rip),%rdi
mov    $0x5,%al
call   1030 <printf@plt>
movsd  -0x70(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    11e4 <main+0xb4>
movsd  -0x68(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11b9 <main+0x89>
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
lea    0xed9(%rip),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x28(%rsp),%r8
lea    0x48(%rsp),%r9
call   1060 <scanf@plt>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0xe7f(%rip),%xmm0
divsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0xea4(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
movsd  0x18(%rsp),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jbe    12d4 <main+0x194>
movsd  0xe36(%rip),%xmm3
lea    0xe64(%rip),%rbx
xorpd  %xmm0,%xmm0
jmp    120c <main+0xcc>
nop
movsd  0x28(%rsp),%xmm0
divsd  %xmm2,%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
add    $0x1,%r14d
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
ucomisd %xmm0,%xmm2
jbe    12d4 <main+0x194>
movsd  0x30(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
ucomisd 0xe00(%rip),%xmm2
jbe    11e0 <main+0xa0>
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
xorpd  %xmm0,%xmm0
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,0x40(%rsp)
movsd  0x28(%rsp),%xmm0
mulsd  %xmm3,%xmm0
divsd  %xmm2,%xmm0
addsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm0
call   1050 <mandel@plt>
divsd  0xda5(%rip),%xmm0
addsd  0xda5(%rip),%xmm0
movsd  0x20(%rsp),%xmm3
movsd  0x40(%rsp),%xmm2
mulsd  %xmm3,%xmm2
mov    %rbx,%rdi
movsd  0x38(%rsp),%xmm1
movapd %xmm3,%xmm4
mov    $0x5,%al
call   1040 <printf@plt>
movsd  0xd69(%rip),%xmm3
movsd  0x48(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
divsd  %xmm2,%xmm1
addsd  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  %xmm1,0x8(%rsp)
add    $0x1,%ebp
ucomisd %xmm0,%xmm2
ja     1240 <main+0x100>
jmp    11e0 <main+0xa0>
lea    0xdba(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%lf%lf%lf%lf%lf\00"
@.str.1 = [5 x i8] c"%%!\0A\00"
@.str.2 = [19 x i8] c"\09 50 50 translate\0A\00"
@.str.3 = [26 x i8] c"\09 0 0 512 512 rectstroke\0A\00"
@.str.4 = [45 x i8] c"\09 %.3f setgray %.3f %.3f %.3f %.3f rectfill\0A\00"
@.str.5 = [12 x i8] c"\09 showpage\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca i32
%21 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%22 = call i32 @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double* %13, double* %14, double* %15, double* %16, double* %17)
%23 = load double, double* %15
store double %23, double* %18
%24 = load double, double* %13
%25 = fdiv double 5.120000e+02, %24
store double %25, double* %19
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %20
br label %29
29: ; preds = %88, %2
%30 = load i32, i32* %20
%31 = sitofp i32 %30 to double
%32 = load double, double* %13
%33 = fcmp olt double %31, %32
br i1 %33, label %34, label %91
34: ; preds = %29
%35 = load double, double* %18
store double %35, double* %15
store i32 0, i32* %21
br label %36
36: ; preds = %79, %34
%37 = load i32, i32* %21
%38 = sitofp i32 %37 to double
%39 = load double, double* %13
%40 = fcmp olt double %38, %39
br i1 %40, label %41, label %82
41: ; preds = %36
%42 = load double, double* %14
%43 = load double, double* %16
%44 = fmul double 5.000000e-01, %43
%45 = load double, double* %13
%46 = fdiv double %44, %45
%47 = fadd double %42, %46
store double %47, double* %11
%48 = load double, double* %15
%49 = load double, double* %16
%50 = fmul double 5.000000e-01, %49
%51 = load double, double* %13
%52 = fdiv double %50, %51
%53 = fadd double %48, %52
store double %53, double* %12
%54 = load double, double* %11
%55 = load double, double* %12
%56 = call double @mandel(double %54, double %55)
store double %56, double* %9
%57 = load double, double* %9
%58 = fdiv double %57, 2.550000e+02
%59 = fsub double 1.000000e+00, %58
store double %59, double* %10
%60 = load double, double* %19
%61 = load i32, i32* %20
%62 = sitofp i32 %61 to double
%63 = fmul double %60, %62
store double %63, double* %6
%64 = load double, double* %19
%65 = load i32, i32* %21
%66 = sitofp i32 %65 to double
%67 = fmul double %64, %66
store double %67, double* %7
%68 = load double, double* %10
%69 = load double, double* %6
%70 = load double, double* %7
%71 = load double, double* %19
%72 = load double, double* %19
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), double %68, double %69, double %70, double %71, double %72)
%74 = load double, double* %17
%75 = load double, double* %13
%76 = fdiv double %74, %75
%77 = load double, double* %15
%78 = fadd double %77, %76
store double %78, double* %15
br label %79
79: ; preds = %41
%80 = load i32, i32* %21
%81 = add nsw i32 %80, 1
store i32 %81, i32* %21
br label %36
82: ; preds = %36
%83 = load double, double* %16
%84 = load double, double* %13
%85 = fdiv double %83, %84
%86 = load double, double* %14
%87 = fadd double %86, %85
store double %87, double* %14
br label %88
88: ; preds = %82
%89 = load i32, i32* %20
%90 = add nsw i32 %89, 1
store i32 %90, i32* %20
br label %29
91: ; preds = %29
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%93 = load i32, i32* %3
ret i32 %93
}

LLVM IR (-O2):
@.str = [16 x i8] c"%lf%lf%lf%lf%lf\00"
@.str.1 = [5 x i8] c"%%!\0A\00"
@.str.4 = [45 x i8] c"\09 %.3f setgray %.3f %.3f %.3f %.3f rectfill\0A\00"
@str = [18 x i8] c"\09 50 50 translate\00"
@str.6 = [25 x i8] c"\09 0 0 512 512 rectstroke\00"
@str.7 = [11 x i8] c"\09 showpage\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = bitcast double* %3 to i8*
%9 = bitcast double* %4 to i8*
%10 = bitcast double* %5 to i8*
%11 = bitcast double* %6 to i8*
%12 = bitcast double* %7 to i8*
%13 = call i32 @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double* %3, double* %4, double* %5, double* %6, double* %7)
%14 = load double, double* %5
%15 = load double, double* %3
%16 = fdiv double 5.120000e+02, %15
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0))
%20 = load double, double* %3
%21 = fcmp ogt double %20, 0.000000e+00
br i1 %21, label %22, label %62
22: ; preds = %2, %53
%23 = phi double [ %54, %53 ], [ %20, %2 ]
%24 = phi double [ %60, %53 ], [ 0.000000e+00, %2 ]
%25 = phi i32 [ %59, %53 ], [ 0, %2 ]
store double %14, double* %5
%26 = fcmp ogt double %23, 0.000000e+00
br i1 %26, label %27, label %53
27: ; preds = %22
%28 = fmul double %16, %24
br label %29
29: ; preds = %27, %29
%30 = phi double [ %14, %27 ], [ %49, %29 ]
%31 = phi double [ %23, %27 ], [ %46, %29 ]
%32 = phi double [ 0.000000e+00, %27 ], [ %51, %29 ]
%33 = phi i32 [ 0, %27 ], [ %50, %29 ]
%34 = load double, double* %4
%35 = load double, double* %6
%36 = fmul double %35, 5.000000e-01
%37 = fdiv double %36, %31
%38 = fadd double %34, %37
%39 = fadd double %30, %37
%40 = call double @mandel(double %38, double %39)
%41 = fdiv double %40, 2.550000e+02
%42 = fsub double 1.000000e+00, %41
%43 = fmul double %16, %32
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), double %42, double %28, double %43, double %16, double %16)
%45 = load double, double* %7
%46 = load double, double* %3
%47 = fdiv double %45, %46
%48 = load double, double* %5
%49 = fadd double %48, %47
store double %49, double* %5
%50 = add nuw nsw i32 %33, 1
%51 = sitofp i32 %50 to double
%52 = fcmp ogt double %46, %51
br i1 %52, label %29, label %53
53: ; preds = %29, %22
%54 = phi double [ %23, %22 ], [ %46, %29 ]
%55 = load double, double* %6
%56 = fdiv double %55, %54
%57 = load double, double* %4
%58 = fadd double %57, %56
store double %58, double* %4
%59 = add nuw nsw i32 %25, 1
%60 = sitofp i32 %59 to double
%61 = fcmp ogt double %54, %60
br i1 %61, label %22, label %62
62: ; preds = %53, %2
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
ret i32 0
}