void rowinit(sudoku, a, b) int sudoku[];
int a, b;
{
  int c;
  for (c = 0; c < 9; c++) {
    sudoku[a + ((b + c) % 9)] = (c + 1);
  }
  return;
}


x86 assembly (clang, -O0):
<rowinit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jge    1160 <rowinit+0x60>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    $0x9,%esi
cltd
idiv   %esi
mov    -0x20(%rbp),%rax
mov    %edx,%esi
mov    -0x18(%rbp),%edx
add    %esi,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <rowinit+0x15>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rowinit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
movslq %edx,%r13
imul   $0x38e38e39,%r13,%r8
mov    %r8,%rcx
shr    $0x3f,%rcx
sar    $0x21,%r8
add    %ecx,%r8d
lea    0x1(%r13),%ecx
movslq %ecx,%rcx
imul   $0x38e38e39,%rcx,%r9
mov    %r9,%rcx
shr    $0x3f,%rcx
sar    $0x21,%r9
add    %ecx,%r9d
lea    0x2(%r13),%ecx
movslq %ecx,%rcx
imul   $0x38e38e39,%rcx,%r10
mov    %r10,%rcx
shr    $0x3f,%rcx
sar    $0x21,%r10
add    %ecx,%r10d
lea    0x3(%r13),%ecx
movslq %ecx,%rcx
imul   $0x38e38e39,%rcx,%r11
mov    %r11,%rcx
shr    $0x3f,%rcx
sar    $0x21,%r11
add    %ecx,%r11d
lea    0x4(%r13),%ecx
movslq %ecx,%rcx
imul   $0x38e38e39,%rcx,%r14
mov    %r14,%rcx
shr    $0x3f,%rcx
sar    $0x21,%r14
add    %ecx,%r14d
lea    0x5(%r13),%ecx
movslq %ecx,%rcx
imul   $0x38e38e39,%rcx,%r15
mov    %r15,%rcx
shr    $0x3f,%rcx
sar    $0x21,%r15
add    %ecx,%r15d
lea    0x6(%r13),%ecx
movslq %ecx,%rcx
imul   $0x38e38e39,%rcx,%r12
mov    %r12,%rcx
shr    $0x3f,%rcx
sar    $0x21,%r12
add    %ecx,%r12d
lea    0x7(%r13),%ecx
movslq %ecx,%rcx
imul   $0x38e38e39,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rdx
add    %ecx,%edx
mov    %r13d,%ecx
add    $0x8,%ecx
movslq %ecx,%rcx
imul   $0x38e38e39,%rcx,%rcx
mov    %rcx,%rbx
shr    $0x3f,%rbx
sar    $0x21,%rcx
add    %ebx,%ecx
lea    (%r8,%r8,8),%r8d
lea    (%r9,%r9,8),%ebx
neg    %ebx
add    %r13d,%ebx
add    $0x1,%ebx
lea    (%r10,%r10,8),%eax
neg    %eax
lea    (%rax,%r13,1),%r9d
add    $0x2,%r9d
lea    (%r11,%r11,8),%eax
neg    %eax
lea    (%rax,%r13,1),%r10d
add    $0x3,%r10d
lea    (%r14,%r14,8),%eax
neg    %eax
lea    (%rax,%r13,1),%r11d
add    $0x4,%r11d
lea    (%r15,%r15,8),%eax
neg    %eax
lea    (%rax,%r13,1),%ebp
add    $0x5,%ebp
lea    (%r12,%r12,8),%eax
neg    %eax
lea    (%rax,%r13,1),%r14d
add    $0x6,%r14d
lea    (%rdx,%rdx,8),%edx
neg    %edx
add    %r13d,%edx
add    $0x7,%edx
lea    (%rcx,%rcx,8),%ecx
neg    %ecx
add    %r13d,%ecx
add    $0x8,%ecx
mov    %r13d,%eax
sub    %r8d,%eax
add    %esi,%eax
cltq
movl   $0x1,(%rdi,%rax,4)
add    %esi,%ebx
movslq %ebx,%rax
movl   $0x2,(%rdi,%rax,4)
add    %esi,%r9d
movslq %r9d,%rax
movl   $0x3,(%rdi,%rax,4)
add    %esi,%r10d
movslq %r10d,%rax
movl   $0x4,(%rdi,%rax,4)
add    %esi,%r11d
movslq %r11d,%rax
movl   $0x5,(%rdi,%rax,4)
add    %esi,%ebp
movslq %ebp,%rax
movl   $0x6,(%rdi,%rax,4)
add    %esi,%r14d
movslq %r14d,%rax
movl   $0x7,(%rdi,%rax,4)
add    %esi,%edx
movslq %edx,%rax
movl   $0x8,(%rdi,%rax,4)
add    %esi,%ecx
movslq %ecx,%rax
movl   $0x9,(%rdi,%rax,4)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @rowinit(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %23, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 9
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = load i32, i32* %7
%13 = add nsw i32 %12, 1
%14 = load i32*, i32** %4
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = add nsw i32 %16, %17
%19 = srem i32 %18, 9
%20 = add nsw i32 %15, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %14, i64 %21
store i32 %13, i32* %22
br label %23
23: ; preds = %11
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %8
26: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @rowinit(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = srem i32 %2, 9
%5 = add nsw i32 %4, %1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
store i32 1, i32* %7
%8 = add nsw i32 %2, 1
%9 = srem i32 %8, 9
%10 = add nsw i32 %9, %1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
store i32 2, i32* %12
%13 = add nsw i32 %2, 2
%14 = srem i32 %13, 9
%15 = add nsw i32 %14, %1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %0, i64 %16
store i32 3, i32* %17
%18 = add nsw i32 %2, 3
%19 = srem i32 %18, 9
%20 = add nsw i32 %19, %1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %0, i64 %21
store i32 4, i32* %22
%23 = add nsw i32 %2, 4
%24 = srem i32 %23, 9
%25 = add nsw i32 %24, %1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %0, i64 %26
store i32 5, i32* %27
%28 = add nsw i32 %2, 5
%29 = srem i32 %28, 9
%30 = add nsw i32 %29, %1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %0, i64 %31
store i32 6, i32* %32
%33 = add nsw i32 %2, 6
%34 = srem i32 %33, 9
%35 = add nsw i32 %34, %1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %0, i64 %36
store i32 7, i32* %37
%38 = add nsw i32 %2, 7
%39 = srem i32 %38, 9
%40 = add nsw i32 %39, %1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %0, i64 %41
store i32 8, i32* %42
%43 = add nsw i32 %2, 8
%44 = srem i32 %43, 9
%45 = add nsw i32 %44, %1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %0, i64 %46
store i32 9, i32* %47
ret void
}