#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 */
char countNeighborMines(char **, int, int, int, int);
void fillMineInfo(char mineField[][100 + 1], int numR, int numC) {
  int r, c;
  for (r = 0; r < numR; ++r) {
    for (c = 0; c < numC; ++c) {
      if (mineField[r][c] != '*') {
        mineField[r][c] = '0' + countNeighborMines(mineField, numR, numC, r, c);
      }
    }
  }
}


x86 assembly (clang, -O0):
<fillMineInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c2 <fillMineInfo+0xb2>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11af <fillMineInfo+0x9f>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x65,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2a,%eax
je     119c <fillMineInfo+0x8c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1030 <countNeighborMines@plt>
movsbl %al,%eax
add    $0x30,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x65,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11a1 <fillMineInfo+0x91>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113c <fillMineInfo+0x2c>
jmp    11b4 <fillMineInfo+0xa4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <fillMineInfo+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillMineInfo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
test   %esi,%esi
jle    118b <fillMineInfo+0x7b>
mov    %esi,%r15d
mov    %rdi,%r14
mov    0xc(%rsp),%ebp
mov    %esi,%eax
mov    %rax,0x10(%rsp)
xor    %r13d,%r13d
mov    %rdi,%r12
jmp    114f <fillMineInfo+0x3f>
nop
add    $0x1,%r13
add    $0x65,%r12
cmp    0x10(%rsp),%r13
je     118b <fillMineInfo+0x7b>
cmpl   $0x0,0xc(%rsp)
jle    1140 <fillMineInfo+0x30>
xor    %ebx,%ebx
jmp    1169 <fillMineInfo+0x59>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1140 <fillMineInfo+0x30>
cmpb   $0x2a,(%r12,%rbx,1)
je     1160 <fillMineInfo+0x50>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r13d,%ecx
mov    %ebx,%r8d
call   1030 <countNeighborMines@plt>
add    $0x30,%al
mov    %al,(%r12,%rbx,1)
jmp    1160 <fillMineInfo+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fillMineInfo([101 x i8]* %0, i32 %1, i32 %2) {
%4 = alloca [101 x i8]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store [101 x i8]* %0, [101 x i8]** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %52, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %55
13: ; preds = %9
store i32 0, i32* %8
br label %14
14: ; preds = %48, %13
%15 = load i32, i32* %8
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %51
18: ; preds = %14
%19 = load [101 x i8]*, [101 x i8]** %4
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [101 x i8], [101 x i8]* %19, i64 %21
%23 = load i32, i32* %8
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [101 x i8], [101 x i8]* %22, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 42
br i1 %28, label %29, label %47
29: ; preds = %18
%30 = load [101 x i8]*, [101 x i8]** %4
%31 = bitcast [101 x i8]* %30 to i8**
%32 = load i32, i32* %5
%33 = load i32, i32* %6
%34 = load i32, i32* %7
%35 = load i32, i32* %8
%36 = call signext i8 @countNeighborMines(i8** %31, i32 %32, i32 %33, i32 %34, i32 %35)
%37 = sext i8 %36 to i32
%38 = add nsw i32 48, %37
%39 = trunc i32 %38 to i8
%40 = load [101 x i8]*, [101 x i8]** %4
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [101 x i8], [101 x i8]* %40, i64 %42
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [101 x i8], [101 x i8]* %43, i64 0, i64 %45
store i8 %39, i8* %46
br label %47
47: ; preds = %29, %18
br label %48
48: ; preds = %47
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %14
51: ; preds = %14
br label %52
52: ; preds = %51
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %9
55: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @fillMineInfo([101 x i8]* %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %29
5: ; preds = %3
%6 = icmp sgt i32 %2, 0
%7 = bitcast [101 x i8]* %0 to i8**
%8 = zext i32 %1 to i64
%9 = zext i32 %2 to i64
br label %10
10: ; preds = %5, %26
%11 = phi i64 [ 0, %5 ], [ %27, %26 ]
br i1 %6, label %12, label %26
12: ; preds = %10
%13 = trunc i64 %11 to i32
br label %14
14: ; preds = %12, %23
%15 = phi i64 [ 0, %12 ], [ %24, %23 ]
%16 = getelementptr inbounds [101 x i8], [101 x i8]* %0, i64 %11, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 42
br i1 %18, label %23, label %19
19: ; preds = %14
%20 = trunc i64 %15 to i32
%21 = tail call signext i8 @countNeighborMines(i8** %7, i32 %1, i32 %2, i32 %13, i32 %20)
%22 = add i8 %21, 48
store i8 %22, i8* %16
br label %23
23: ; preds = %14, %19
%24 = add nuw nsw i64 %15, 1
%25 = icmp eq i64 %24, %9
br i1 %25, label %26, label %14
26: ; preds = %23, %10
%27 = add nuw nsw i64 %11, 1
%28 = icmp eq i64 %27, %8
br i1 %28, label %29, label %10
29: ; preds = %26, %3
ret void
}