#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 */
void buildassignmentvector_dbl(long *assignment, bool *starMatrix, long nOfRows,
                               long nOfColumns) {
  long row, col;
  for (row = 0; row < nOfRows; row++)
    for (col = 0; col < nOfColumns; col++)
      if (starMatrix[row + nOfRows * col]) {
        assignment[row] = col;
        break;
      }
}


x86 assembly (clang, -O0):
<buildassignmentvector_dbl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    119f <buildassignmentvector_dbl+0x9f>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1189 <buildassignmentvector_dbl+0x89>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rdx
imul   -0x30(%rbp),%rdx
add    %rdx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1173 <buildassignmentvector_dbl+0x73>
mov    -0x30(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    1189 <buildassignmentvector_dbl+0x89>
jmp    1178 <buildassignmentvector_dbl+0x78>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1132 <buildassignmentvector_dbl+0x32>
jmp    118e <buildassignmentvector_dbl+0x8e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111c <buildassignmentvector_dbl+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildassignmentvector_dbl>:
test   %rdx,%rdx
jle    1153 <buildassignmentvector_dbl+0x53>
lea    0x0(,%rdx,4),%r9
xor    %r8d,%r8d
jmp    1131 <buildassignmentvector_dbl+0x31>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r10,(%rdi,%r8,8)
add    $0x1,%r8
add    $0x4,%rsi
cmp    %rdx,%r8
je     1153 <buildassignmentvector_dbl+0x53>
test   %rcx,%rcx
jle    1124 <buildassignmentvector_dbl+0x24>
mov    %rsi,%rax
xor    %r10d,%r10d
nopl   0x0(%rax)
cmpl   $0x0,(%rax)
jne    1120 <buildassignmentvector_dbl+0x20>
add    $0x1,%r10
add    %r9,%rax
cmp    %r10,%rcx
jne    1140 <buildassignmentvector_dbl+0x40>
jmp    1124 <buildassignmentvector_dbl+0x24>
ret

LLVM IR (-O0):
define void @buildassignmentvector_dbl(i64* %0, i32* %1, i64 %2, i64 %3) {
%5 = alloca i64*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i64* %0, i64** %5
store i32* %1, i32** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
store i64 0, i64* %9
br label %11
11: ; preds = %40, %4
%12 = load i64, i64* %9
%13 = load i64, i64* %7
%14 = icmp slt i64 %12, %13
br i1 %14, label %15, label %43
15: ; preds = %11
store i64 0, i64* %10
br label %16
16: ; preds = %36, %15
%17 = load i64, i64* %10
%18 = load i64, i64* %8
%19 = icmp slt i64 %17, %18
br i1 %19, label %20, label %39
20: ; preds = %16
%21 = load i32*, i32** %6
%22 = load i64, i64* %9
%23 = load i64, i64* %7
%24 = load i64, i64* %10
%25 = mul nsw i64 %23, %24
%26 = add nsw i64 %22, %25
%27 = getelementptr inbounds i32, i32* %21, i64 %26
%28 = load i32, i32* %27
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %20
%31 = load i64, i64* %10
%32 = load i64*, i64** %5
%33 = load i64, i64* %9
%34 = getelementptr inbounds i64, i64* %32, i64 %33
store i64 %31, i64* %34
br label %39
35: ; preds = %20
br label %36
36: ; preds = %35
%37 = load i64, i64* %10
%38 = add nsw i64 %37, 1
store i64 %38, i64* %10
br label %16
39: ; preds = %30, %16
br label %40
40: ; preds = %39
%41 = load i64, i64* %9
%42 = add nsw i64 %41, 1
store i64 %42, i64* %9
br label %11
43: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @buildassignmentvector_dbl(i64* nocapture writeonly %0, i32* nocapture %1, i64 %2, i64 %3) {
%5 = icmp sgt i64 %2, 0
br i1 %5, label %6, label %25
6: ; preds = %4
%7 = icmp sgt i64 %3, 0
br label %8
8: ; preds = %6, %22
%9 = phi i64 [ 0, %6 ], [ %23, %22 ]
br i1 %7, label %10, label %22
10: ; preds = %8, %19
%11 = phi i64 [ %20, %19 ], [ 0, %8 ]
%12 = mul nsw i64 %11, %2
%13 = add nsw i64 %12, %9
%14 = getelementptr inbounds i32, i32* %1, i64 %13
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %10
%18 = getelementptr inbounds i64, i64* %0, i64 %9
store i64 %11, i64* %18
br label %22
19: ; preds = %10
%20 = add nuw nsw i64 %11, 1
%21 = icmp eq i64 %20, %3
br i1 %21, label %22, label %10
22: ; preds = %19, %8, %17
%23 = add nuw nsw i64 %9, 1
%24 = icmp eq i64 %23, %2
br i1 %24, label %25, label %8
25: ; preds = %22, %4
ret void
}