#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double, double);
void write_vtkPointCoordinates(FILE *fp, int imax, int jmax, double dx,
                               double dy) {
  double originX = 0.0;
  double originY = 0.0;
  int i = 0;
  int j = 0;
  for (j = 0; j < jmax + 1; j++) {
    for (i = 0; i < imax + 1; i++) {
      fprintf(fp, "%f %f 0\n", originX + (i * dx), originY + (j * dy));
    }
  }
}


x86 assembly (clang, -O0):
<write_vtkPointCoordinates>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11d9 <write_vtkPointCoordinates+0xc9>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11c6 <write_vtkPointCoordinates+0xb6>
mov    -0x8(%rbp),%rdi
movsd  -0x28(%rbp),%xmm1
cvtsi2sdl -0x34(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm2
cvtsi2sdl -0x38(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
lea    0xe4d(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1169 <write_vtkPointCoordinates+0x59>
jmp    11cb <write_vtkPointCoordinates+0xbb>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1151 <write_vtkPointCoordinates+0x41>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_vtkPointCoordinates>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm1,0x10(%rsp)
mov    %rsi,0x8(%rsp)
test   %edx,%edx
js     11c6 <write_vtkPointCoordinates+0xb6>
movapd %xmm0,%xmm1
mov    %edx,%r15d
mov    %rdi,%rbx
mov    0x8(%rsp),%rax
lea    0x1(%rax),%ebp
xor    %r13d,%r13d
xorpd  %xmm2,%xmm2
lea    0xeaf(%rip),%r12
movsd  %xmm0,0x18(%rsp)
jmp    116c <write_vtkPointCoordinates+0x5c>
nopl   0x0(%rax)
lea    0x1(%r13),%eax
cmp    %r15d,%r13d
mov    %eax,%r13d
je     11c6 <write_vtkPointCoordinates+0xb6>
cmpl   $0x0,0x8(%rsp)
js     1160 <write_vtkPointCoordinates+0x50>
xorps  %xmm0,%xmm0
cvtsi2sd %r13d,%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x20(%rsp)
xor    %r14d,%r14d
xchg   %ax,%ax
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
mov    %rbx,%rdi
mov    %r12,%rsi
movsd  0x20(%rsp),%xmm1
call   1030 <fprintf@plt>
xorpd  %xmm2,%xmm2
movsd  0x18(%rsp),%xmm1
add    $0x1,%r14d
cmp    %r14d,%ebp
jne    1190 <write_vtkPointCoordinates+0x80>
jmp    1160 <write_vtkPointCoordinates+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%f %f 0\0A\00"
define void @write_vtkPointCoordinates(i32* nocapture %0, i32 %1, i32 %2, double %3, double %4) {
%6 = icmp slt i32 %2, 0
br i1 %6, label %24, label %7
7: ; preds = %5
%8 = icmp slt i32 %1, 0
br label %9
9: ; preds = %7, %21
%10 = phi i32 [ 0, %7 ], [ %22, %21 ]
br i1 %8, label %21, label %11
11: ; preds = %9
%12 = sitofp i32 %10 to double
%13 = tail call double @llvm.fmuladd.f64(double %12, double %4, double 0.000000e+00)
br label %14
14: ; preds = %11, %14
%15 = phi i32 [ 0, %11 ], [ %19, %14 ]
%16 = sitofp i32 %15 to double
%17 = tail call double @llvm.fmuladd.f64(double %16, double %3, double 0.000000e+00)
%18 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double %17, double %13)
%19 = add nuw i32 %15, 1
%20 = icmp eq i32 %15, %1
br i1 %20, label %21, label %14
21: ; preds = %14, %9
%22 = add nuw i32 %10, 1
%23 = icmp eq i32 %10, %2
br i1 %23, label %24, label %9
24: ; preds = %21, %5
ret void
}