#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 y3 = y0;
  int r;
  int c;
  printf("%%!\n");
  printf("\t 50 50 translate\n");
  printf("\t 0 0 512 512 rectstroke\n");
  for (r = 0; r < n; r++) {
    y1 = y3;
    x1 = sc * r;
    for (c = 0; c < n; c++) {
      y1 = sc * c;
      x2 = x0 + mx;
      y2 = y0 + my;
      t = mandel(x2, y2);
      g = 1.0 - t / 255.0;
      printf("\t %.3f setgray %.3f %.3f %.3f %.3f rectfill\n", g, x1, y1, sc,
             sc);
      y0 += (2 * my);
    }
    x0 += (2 * mx);
  }
  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    -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)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8c(%rbp)
cvtsi2sdl -0x8c(%rbp),%xmm1
ff
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    132c <main+0x1fc>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x70(%rbp),%xmm0
cvtsi2sdl -0x8c(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x90(%rbp)
cvtsi2sdl -0x90(%rbp),%xmm1
ff
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1301 <main+0x1d1>
movsd  -0x70(%rbp),%xmm0
cvtsi2sdl -0x90(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
call   1040 <mandel@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  0xd7e(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd6a(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
movsd  -0x70(%rbp),%xmm4
lea    0xd93(%rip),%rdi
mov    $0x5,%al
call   1030 <printf@plt>
movsd  -0x80(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    122e <main+0xfe>
movsd  -0x78(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    11ea <main+0xba>
lea    0xd5c(%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    $0x60,%rsp
lea    0xed9(%rip),%rdi
lea    0x40(%rsp),%rsi
lea    0x38(%rsp),%rdx
lea    0x30(%rsp),%rcx
lea    0x58(%rsp),%r8
lea    0x50(%rsp),%r9
call   1060 <scanf@plt>
movsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0xe87(%rip),%xmm0
movsd  0x58(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mulsd  0x50(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xe94(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x40(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1326 <main+0x1e6>
movsd  0xe18(%rip),%xmm3
movsd  0x20(%rsp),%xmm4
divsd  %xmm4,%xmm3
divsd  %xmm4,%xmm2
movsd  0x8(%rsp),%xmm1
divsd  %xmm4,%xmm1
lea    0xe36(%rip),%rbx
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm4
addsd  %xmm1,%xmm4
xorpd  %xmm1,%xmm1
movsd  %xmm2,0x10(%rsp)
movsd  %xmm3,0x28(%rsp)
movsd  %xmm4,0x48(%rsp)
jmp    125a <main+0x11a>
nopl   (%rax)
movapd %xmm2,%xmm1
addsd  %xmm2,%xmm1
addsd  0x38(%rsp),%xmm1
movsd  %xmm1,0x38(%rsp)
add    $0x1,%r14d
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
ucomisd %xmm1,%xmm0
jbe    1326 <main+0x1e6>
movsd  %xmm1,0x18(%rsp)
ucomisd 0xdb8(%rip),%xmm0
movsd  0x8(%rsp),%xmm5
jbe    1230 <main+0xf0>
movsd  0x18(%rsp),%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm6,%xmm6
mov    $0x1,%ebp
movsd  0x30(%rsp),%xmm1
nop
mulsd  %xmm3,%xmm6
movsd  %xmm6,0x20(%rsp)
movsd  0x38(%rsp),%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm5,%xmm1
call   1050 <mandel@plt>
divsd  0xd5b(%rip),%xmm0
addsd  0xd5b(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x28(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
mov    $0x5,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm5
movsd  0x48(%rsp),%xmm4
movsd  0x28(%rsp),%xmm3
movsd  0x10(%rsp),%xmm2
movsd  0x30(%rsp),%xmm1
addsd  %xmm4,%xmm1
movsd  %xmm1,0x30(%rsp)
xorps  %xmm6,%xmm6
cvtsi2sd %ebp,%xmm6
movsd  0x40(%rsp),%xmm0
add    $0x1,%ebp
ucomisd %xmm6,%xmm0
ja     1290 <main+0x150>
jmp    1230 <main+0xf0>
lea    0xd68(%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 i32
%22 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%23 = 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)
%24 = load double, double* %6
%25 = fdiv double 5.120000e+02, %24
store double %25, double* %17
%26 = load double, double* %9
%27 = fmul double 5.000000e-01, %26
%28 = load double, double* %6
%29 = fdiv double %27, %28
store double %29, double* %18
%30 = load double, double* %10
%31 = fmul double 5.000000e-01, %30
%32 = load double, double* %6
%33 = fdiv double %31, %32
store double %33, double* %19
%34 = load double, double* %8
store double %34, double* %20
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %21
br label %38
38: ; preds = %87, %2
%39 = load i32, i32* %21
%40 = sitofp i32 %39 to double
%41 = load double, double* %6
%42 = fcmp olt double %40, %41
br i1 %42, label %43, label %90
43: ; preds = %38
%44 = load double, double* %20
store double %44, double* %12
%45 = load double, double* %17
%46 = load i32, i32* %21
%47 = sitofp i32 %46 to double
%48 = fmul double %45, %47
store double %48, double* %11
store i32 0, i32* %22
br label %49
49: ; preds = %80, %43
%50 = load i32, i32* %22
%51 = sitofp i32 %50 to double
%52 = load double, double* %6
%53 = fcmp olt double %51, %52
br i1 %53, label %54, label %83
54: ; preds = %49
%55 = load double, double* %17
%56 = load i32, i32* %22
%57 = sitofp i32 %56 to double
%58 = fmul double %55, %57
store double %58, double* %12
%59 = load double, double* %7
%60 = load double, double* %18
%61 = fadd double %59, %60
store double %61, double* %13
%62 = load double, double* %8
%63 = load double, double* %19
%64 = fadd double %62, %63
store double %64, double* %14
%65 = load double, double* %13
%66 = load double, double* %14
%67 = call double @mandel(double %65, double %66)
store double %67, double* %15
%68 = load double, double* %15
%69 = fdiv double %68, 2.550000e+02
%70 = fsub double 1.000000e+00, %69
store double %70, double* %16
%71 = load double, double* %16
%72 = load double, double* %11
%73 = load double, double* %12
%74 = load double, double* %17
%75 = load double, double* %17
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), double %71, double %72, double %73, double %74, double %75)
%77 = load double, double* %19
%78 = load double, double* %8
%79 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %77, double %78)
store double %79, double* %8
br label %80
80: ; preds = %54
%81 = load i32, i32* %22
%82 = add nsw i32 %81, 1
store i32 %82, i32* %22
br label %49
83: ; preds = %49
%84 = load double, double* %18
%85 = load double, double* %7
%86 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %84, double %85)
store double %86, double* %7
br label %87
87: ; preds = %83
%88 = load i32, i32* %21
%89 = add nsw i32 %88, 1
store i32 %89, i32* %21
br label %38
90: ; preds = %38
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%92 = load i32, i32* %3
ret i32 %92
}

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