#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 *, int, int);
void write_uvpPointCoordinates(FILE *fp, int origin_i, int origin_j, int imax,
                               int jmax, double dx, double dy) {
  int i, j;
  for (j = 0; j < jmax + 1; j++) {
    for (i = 0; i < imax + 1; i++) {
      fprintf(fp, "%f %f 0\n", origin_i + (i * dx), origin_j + (j * dy));
    }
  }
}


x86 assembly (clang, -O0):
<write_uvpPointCoordinates>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11ca <write_uvpPointCoordinates+0xba>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11b7 <write_uvpPointCoordinates+0xa7>
mov    -0x8(%rbp),%rdi
cvtsi2sdl -0xc(%rbp),%xmm1
cvtsi2sdl -0x2c(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
cvtsi2sdl -0x10(%rbp),%xmm1
cvtsi2sdl -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
lea    0xe5c(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1152 <write_uvpPointCoordinates+0x42>
jmp    11bc <write_uvpPointCoordinates+0xac>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    113a <write_uvpPointCoordinates+0x2a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_uvpPointCoordinates>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movsd  %xmm1,0x20(%rsp)
mov    %rcx,0x10(%rsp)
mov    %r8d,0xc(%rsp)
test   %r8d,%r8d
js     11d8 <write_uvpPointCoordinates+0xc8>
mov    %rdi,%r13
cvtsi2sd %esi,%xmm2
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
movsd  %xmm1,0x18(%rsp)
mov    0x10(%rsp),%rax
lea    0x1(%rax),%ebx
xor    %r14d,%r14d
lea    0xea3(%rip),%r12
movsd  %xmm0,0x30(%rsp)
movsd  %xmm2,0x28(%rsp)
jmp    117e <write_uvpPointCoordinates+0x6e>
nopl   0x0(%rax,%rax,1)
lea    0x1(%r14),%eax
cmp    0xc(%rsp),%r14d
mov    %eax,%r14d
je     11d8 <write_uvpPointCoordinates+0xc8>
cmpl   $0x0,0x10(%rsp)
js     1170 <write_uvpPointCoordinates+0x60>
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
mulsd  0x20(%rsp),%xmm1
addsd  0x18(%rsp),%xmm1
cvttsd2si %xmm1,%ebp
xor    %r15d,%r15d
xorps  %xmm1,%xmm1
cvtsi2sd %r15d,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edx
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebp,%ecx
call   1030 <fprintf@plt>
movsd  0x28(%rsp),%xmm2
movsd  0x30(%rsp),%xmm0
add    $0x1,%r15d
cmp    %r15d,%ebx
jne    11a0 <write_uvpPointCoordinates+0x90>
jmp    1170 <write_uvpPointCoordinates+0x60>
add    $0x38,%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_uvpPointCoordinates(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, double %5, double %6) {
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca i32
%16 = alloca i32
store i32* %0, i32** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store double %5, double* %13
store double %6, double* %14
store i32 0, i32* %16
br label %17
17: ; preds = %49, %7
%18 = load i32, i32* %16
%19 = load i32, i32* %12
%20 = add nsw i32 %19, 1
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %52
22: ; preds = %17
store i32 0, i32* %15
br label %23
23: ; preds = %45, %22
%24 = load i32, i32* %15
%25 = load i32, i32* %11
%26 = add nsw i32 %25, 1
%27 = icmp slt i32 %24, %26
br i1 %27, label %28, label %48
28: ; preds = %23
%29 = load i32*, i32** %8
%30 = load i32, i32* %9
%31 = sitofp i32 %30 to double
%32 = load i32, i32* %15
%33 = sitofp i32 %32 to double
%34 = load double, double* %13
%35 = call double @llvm.fmuladd.f64(double %33, double %34, double %31)
%36 = fptosi double %35 to i32
%37 = load i32, i32* %10
%38 = sitofp i32 %37 to double
%39 = load i32, i32* %16
%40 = sitofp i32 %39 to double
%41 = load double, double* %14
%42 = call double @llvm.fmuladd.f64(double %40, double %41, double %38)
%43 = fptosi double %42 to i32
%44 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %36, i32 %43)
br label %45
45: ; preds = %28
%46 = load i32, i32* %15
%47 = add nsw i32 %46, 1
store i32 %47, i32* %15
br label %23
48: ; preds = %23
br label %49
49: ; preds = %48
%50 = load i32, i32* %16
%51 = add nsw i32 %50, 1
store i32 %51, i32* %16
br label %17
52: ; preds = %17
ret void
}

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