#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 */
int /*<<< orphan*/ printf(char *, int, int);
int strlen(char *);
void printCoordinates(int row, int col, int d_row, int d_col, char *word) {
  for (int i = 0; i < strlen(word); i++) {
    printf("[%d][%d]\n", row, col);
    row += d_row;
    col += d_col;
  }
}


x86 assembly (clang, -O0):
<printCoordinates>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    118d <printCoordinates+0x6d>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113f <printCoordinates+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printCoordinates>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r12
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebp
mov    %edi,%ebx
mov    %r8,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1177 <printCoordinates+0x57>
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
lea    0xea9(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1040 <printf@plt>
add    %r15d,%ebx
add    %r14d,%ebp
add    $0x1,%r13d
mov    %r12,%rdi
call   1030 <strlen@plt>
cmp    %eax,%r13d
jl     1150 <printCoordinates+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"[%d][%d]\0A\00"
define void @printCoordinates(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
store i32 0, i32* %11
br label %12
12: ; preds = %27, %5
%13 = load i32, i32* %11
%14 = load i8*, i8** %10
%15 = call i32 @strlen(i8* %14)
%16 = icmp slt i32 %13, %15
br i1 %16, label %17, label %30
17: ; preds = %12
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %19)
%21 = load i32, i32* %8
%22 = load i32, i32* %6
%23 = add nsw i32 %22, %21
store i32 %23, i32* %6
%24 = load i32, i32* %9
%25 = load i32, i32* %7
%26 = add nsw i32 %25, %24
store i32 %26, i32* %7
br label %27
27: ; preds = %17
%28 = load i32, i32* %11
%29 = add nsw i32 %28, 1
store i32 %29, i32* %11
br label %12
30: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"[%d][%d]\0A\00"
define void @printCoordinates(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = tail call i32 @strlen(i8* %4)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %9, %5
ret void
9: ; preds = %5, %9
%10 = phi i32 [ %16, %9 ], [ 0, %5 ]
%11 = phi i32 [ %14, %9 ], [ %0, %5 ]
%12 = phi i32 [ %15, %9 ], [ %1, %5 ]
%13 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
%14 = add nsw i32 %11, %2
%15 = add nsw i32 %12, %3
%16 = add nuw nsw i32 %10, 1
%17 = tail call i32 @strlen(i8* %4)
%18 = icmp slt i32 %16, %17
br i1 %18, label %9, label %8
}