#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 n, x0, y0, dx, dy, x1, y1, x2, y2, t, g;
  scanf("%lf%lf%lf%lf%lf", &n, &x0, &y0, &dx, &dy);
  double sc = (512.0 / n);
  double mx = 0.5 * dx / n;
  double my = 0.5 * dy / n;
  double x3, y3, x4, y4;
  int r;
  int c;
  printf("%%!\n");
  printf("\t 50 50 translate\n");
  printf("\t 0 0 512 512 rectstroke\n");
  x1 = x0;
  for (r = 0; r < n; r++) {
    y1 = y0;
    x2 = x1 + mx;
    x3 = x2 + mx;
    x4 = sc * r;
    for (c = 0; c < n; c++) {
      y2 = y1 + my;
      y3 = y2 + my;
      y4 = sc * c;
      t = mandel(x2, y2);
      g = 1.0 - t / 255.0;
      printf("\t %.3f setgray %.3f %.3f %.3f %.3f rectfill\n", g, x4, y4, sc,
             sc);
      y1 = y3;
    }
    x1 = x3;
  }
  printf("\t showpage\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed0(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x30(%rbp),%r8
lea    -0x38(%rbp),%r9
call   1050 <scanf@plt>
movsd  0xe97(%rip),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe7d(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xe66(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0xa4(%rbp)
cvtsi2sdl -0xa4(%rbp),%xmm1
ff
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1342 <main+0x212>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
cvtsi2sdl -0xa4(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movl   $0x0,-0xa8(%rbp)
cvtsi2sdl -0xa8(%rbp),%xmm1
ff
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1321 <main+0x1f1>
movsd  -0x48(%rbp),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
cvtsi2sdl -0xa8(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
call   1040 <mandel@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  0xd5a(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd46(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0xa0(%rbp),%xmm2
ff
movsd  -0x70(%rbp),%xmm3
movsd  -0x70(%rbp),%xmm4
lea    0xd69(%rip),%rdi
mov    $0x5,%al
call   1030 <printf@plt>
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    124c <main+0x11c>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    11e7 <main+0xb7>
lea    0xd46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
lea    0xed9(%rip),%rdi
lea    0x28(%rsp),%rsi
lea    0x58(%rsp),%rdx
lea    0x50(%rsp),%rcx
lea    0x48(%rsp),%r8
lea    0x40(%rsp),%r9
call   1060 <scanf@plt>
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0xe87(%rip),%xmm0
movsd  0x48(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  0x40(%rsp),%xmm0
movsd  %xmm0,(%rsp)
lea    0xe95(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
movsd  0x8(%rsp),%xmm2
movsd  0x28(%rsp),%xmm4
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm4
jbe    1311 <main+0x1d1>
movsd  0xe19(%rip),%xmm3
movsd  0x18(%rsp),%xmm0
divsd  %xmm0,%xmm3
divsd  %xmm0,%xmm2
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x58(%rsp),%xmm0
lea    0xe2d(%rip),%rbx
xorpd  %xmm1,%xmm1
movsd  %xmm2,0x8(%rsp)
movsd  %xmm3,0x20(%rsp)
jmp    1250 <main+0x110>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x8(%rsp),%xmm2
addsd  %xmm2,%xmm0
add    $0x1,%r14d
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
ucomisd %xmm1,%xmm4
jbe    1311 <main+0x1d1>
movsd  %xmm1,0x10(%rsp)
addsd  %xmm2,%xmm0
ucomisd 0xdbe(%rip),%xmm4
movsd  (%rsp),%xmm2
jbe    1230 <main+0xf0>
movsd  0x10(%rsp),%xmm1
mulsd  %xmm3,%xmm1
movsd  %xmm1,0x10(%rsp)
xorpd  %xmm5,%xmm5
mov    $0x1,%ebp
movsd  0x50(%rsp),%xmm1
movsd  %xmm0,0x30(%rsp)
xchg   %ax,%ax
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm2
movsd  %xmm2,0x18(%rsp)
mulsd  %xmm3,%xmm5
movsd  %xmm5,0x38(%rsp)
call   1050 <mandel@plt>
divsd  0xd5b(%rip),%xmm0
addsd  0xd5b(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm1
movsd  0x38(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
mov    $0x5,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm2
movsd  0x30(%rsp),%xmm0
movsd  0x20(%rsp),%xmm3
xorps  %xmm5,%xmm5
cvtsi2sd %ebp,%xmm5
movsd  0x28(%rsp),%xmm4
add    $0x1,%ebp
ucomisd %xmm5,%xmm4
movsd  0x18(%rsp),%xmm1
ja     1290 <main+0x150>
jmp    1230 <main+0xf0>
lea    0xd7d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x60,%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 double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca i32
%25 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%26 = call i32 @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double* %6, double* %7, double* %8, double* %9, double* %10)
%27 = load double, double* %6
%28 = fdiv double 5.120000e+02, %27
store double %28, double* %17
%29 = load double, double* %9
%30 = fmul double 5.000000e-01, %29
%31 = load double, double* %6
%32 = fdiv double %30, %31
store double %32, double* %18
%33 = load double, double* %10
%34 = fmul double 5.000000e-01, %33
%35 = load double, double* %6
%36 = fdiv double %34, %35
store double %36, double* %19
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%40 = load double, double* %7
store double %40, double* %11
store i32 0, i32* %24
br label %41
41: ; preds = %92, %2
%42 = load i32, i32* %24
%43 = sitofp i32 %42 to double
%44 = load double, double* %6
%45 = fcmp olt double %43, %44
br i1 %45, label %46, label %95
46: ; preds = %41
%47 = load double, double* %8
store double %47, double* %12
%48 = load double, double* %11
%49 = load double, double* %18
%50 = fadd double %48, %49
store double %50, double* %13
%51 = load double, double* %13
%52 = load double, double* %18
%53 = fadd double %51, %52
store double %53, double* %20
%54 = load double, double* %17
%55 = load i32, i32* %24
%56 = sitofp i32 %55 to double
%57 = fmul double %54, %56
store double %57, double* %22
store i32 0, i32* %25
br label %58
58: ; preds = %87, %46
%59 = load i32, i32* %25
%60 = sitofp i32 %59 to double
%61 = load double, double* %6
%62 = fcmp olt double %60, %61
br i1 %62, label %63, label %90
63: ; preds = %58
%64 = load double, double* %12
%65 = load double, double* %19
%66 = fadd double %64, %65
store double %66, double* %14
%67 = load double, double* %14
%68 = load double, double* %19
%69 = fadd double %67, %68
store double %69, double* %21
%70 = load double, double* %17
%71 = load i32, i32* %25
%72 = sitofp i32 %71 to double
%73 = fmul double %70, %72
store double %73, double* %23
%74 = load double, double* %13
%75 = load double, double* %14
%76 = call double @mandel(double %74, double %75)
store double %76, double* %15
%77 = load double, double* %15
%78 = fdiv double %77, 2.550000e+02
%79 = fsub double 1.000000e+00, %78
store double %79, double* %16
%80 = load double, double* %16
%81 = load double, double* %22
%82 = load double, double* %23
%83 = load double, double* %17
%84 = load double, double* %17
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), double %80, double %81, double %82, double %83, double %84)
%86 = load double, double* %21
store double %86, double* %12
br label %87
87: ; preds = %63
%88 = load i32, i32* %25
%89 = add nsw i32 %88, 1
store i32 %89, i32* %25
br label %58
90: ; preds = %58
%91 = load double, double* %20
store double %91, double* %11
br label %92
92: ; preds = %90
%93 = load i32, i32* %24
%94 = add nsw i32 %93, 1
store i32 %94, i32* %24
br label %41
95: ; preds = %41
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%97 = load i32, i32* %3
ret i32 %97
}

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* %3
%15 = fdiv double 5.120000e+02, %14
%16 = load double, double* %6
%17 = fmul double %16, 5.000000e-01
%18 = fdiv double %17, %14
%19 = load double, double* %7
%20 = fmul double %19, 5.000000e-01
%21 = fdiv double %20, %14
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0))
%25 = load double, double* %3
%26 = fcmp ogt double %25, 0.000000e+00
br i1 %26, label %27, label %60
27: ; preds = %2
%28 = load double, double* %4
br label %29
29: ; preds = %27, %55
%30 = phi double [ %56, %55 ], [ %25, %27 ]
%31 = phi double [ %58, %55 ], [ 0.000000e+00, %27 ]
%32 = phi i32 [ %57, %55 ], [ 0, %27 ]
%33 = phi double [ %35, %55 ], [ %28, %27 ]
%34 = fadd double %18, %33
%35 = fadd double %18, %34
%36 = fmul double %15, %31
%37 = fcmp ogt double %30, 0.000000e+00
br i1 %37, label %38, label %55
38: ; preds = %29
%39 = load double, double* %5
br label %40
40: ; preds = %38, %40
%41 = phi double [ %52, %40 ], [ 0.000000e+00, %38 ]
%42 = phi i32 [ %51, %40 ], [ 0, %38 ]
%43 = phi double [ %45, %40 ], [ %39, %38 ]
%44 = fadd double %21, %43
%45 = fadd double %21, %44
%46 = fmul double %15, %41
%47 = call double @mandel(double %34, double %44)
%48 = fdiv double %47, 2.550000e+02
%49 = fsub double 1.000000e+00, %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), double %49, double %36, double %46, double %15, double %15)
%51 = add nuw nsw i32 %42, 1
%52 = sitofp i32 %51 to double
%53 = load double, double* %3
%54 = fcmp ogt double %53, %52
br i1 %54, label %40, label %55
55: ; preds = %40, %29
%56 = phi double [ %30, %29 ], [ %53, %40 ]
%57 = add nuw nsw i32 %32, 1
%58 = sitofp i32 %57 to double
%59 = fcmp ogt double %56, %58
br i1 %59, label %29, label %60
60: ; preds = %55, %2
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
ret i32 0
}