#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*/ allNeigbours(int **, int, int);
int /*<<< orphan*/ fillbombs(int **, int, int, int);
int liesInt(int, int);
int /*<<< orphan*/ printMatrix(int **, int, int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int ar[10][10] = {
      0,
  };
  int zeilen, spalten, bombs;
  printf("\nEnter rows -> ");
  zeilen = liesInt(11, 2);
  printf("\nEnter colums -> ");
  spalten = liesInt(11, 2);
  printf("\nEnter bombs -> ");
  bombs = liesInt((zeilen * spalten) / 2, 1);
  fillbombs(ar, zeilen, spalten, bombs);
  allNeigbours(ar, zeilen, spalten);
  printMatrix(ar, zeilen, spalten);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1060 <memset@plt>
lea    0xe7b(%rip),%rdi
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x2,%esi
call   1070 <liesInt@plt>
mov    %eax,-0x194(%rbp)
lea    0xe6a(%rip),%rdi
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x2,%esi
call   1070 <liesInt@plt>
mov    %eax,-0x198(%rbp)
lea    0xe5b(%rip),%rdi
call   1050 <printf@plt>
mov    -0x194(%rbp),%eax
imul   -0x198(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    $0x1,%esi
call   1070 <liesInt@plt>
mov    %eax,-0x19c(%rbp)
lea    -0x190(%rbp),%rdi
mov    -0x194(%rbp),%esi
mov    -0x198(%rbp),%edx
mov    -0x19c(%rbp),%ecx
call   1030 <fillbombs@plt>
lea    -0x190(%rbp),%rdi
mov    -0x194(%rbp),%esi
mov    -0x198(%rbp),%edx
call   1040 <allNeigbours@plt>
lea    -0x190(%rbp),%rdi
mov    -0x194(%rbp),%esi
mov    -0x198(%rbp),%edx
call   1080 <printMatrix@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x190,%rsp
mov    %rsp,%r14
mov    $0x190,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x2,%esi
call   1070 <liesInt@plt>
mov    %eax,%ebp
lea    0xe6f(%rip),%rdi
call   1050 <printf@plt>
mov    $0xb,%edi
mov    $0x2,%esi
call   1070 <liesInt@plt>
mov    %eax,%ebx
lea    0xe64(%rip),%rdi
call   1050 <printf@plt>
mov    %ebx,%eax
imul   %ebp,%eax
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
mov    $0x1,%esi
call   1070 <liesInt@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
call   1030 <fillbombs@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1040 <allNeigbours@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1080 <printMatrix@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0AEnter rows -> \00"
@.str.1 = [18 x i8] c"\0AEnter colums -> \00"
@.str.2 = [17 x i8] c"\0AEnter bombs -> \00"
define i32 @main() {
%1 = alloca [10 x [10 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [10 x [10 x i32]]* %1 to i8*
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @liesInt(i32 11, i32 2)
store i32 %7, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @liesInt(i32 11, i32 2)
store i32 %9, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = mul nsw i32 %11, %12
%14 = sdiv i32 %13, 2
%15 = call i32 @liesInt(i32 %14, i32 1)
store i32 %15, i32* %4
%16 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 0
%17 = bitcast [10 x i32]* %16 to i32**
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @fillbombs(i32** %17, i32 %18, i32 %19, i32 %20)
%22 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 0
%23 = bitcast [10 x i32]* %22 to i32**
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = call i32 @allNeigbours(i32** %23, i32 %24, i32 %25)
%27 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 0
%28 = bitcast [10 x i32]* %27 to i32**
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = call i32 @printMatrix(i32** %28, i32 %29, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0AEnter rows -> \00"
@.str.1 = [18 x i8] c"\0AEnter colums -> \00"
@.str.2 = [17 x i8] c"\0AEnter bombs -> \00"
define i32 @main() {
%1 = alloca [10 x [10 x i32]]
%2 = bitcast [10 x [10 x i32]]* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @liesInt(i32 11, i32 2)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @liesInt(i32 11, i32 2)
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%8 = mul nsw i32 %6, %4
%9 = sdiv i32 %8, 2
%10 = tail call i32 @liesInt(i32 %9, i32 1)
%11 = bitcast [10 x [10 x i32]]* %1 to i32**
%12 = call i32 @fillbombs(i32** %11, i32 %4, i32 %6, i32 %10)
%13 = call i32 @allNeigbours(i32** %11, i32 %4, i32 %6)
%14 = call i32 @printMatrix(i32** %11, i32 %4, i32 %6)
ret i32 0
}