#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 EXIT_SUCCESS;
int /*<<< orphan*/ alloc_2D_arr_memory(char ***, int, int);
int /*<<< orphan*/ copy_to_2D_array(int, int, char **, char *, size_t);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ free_2D_memory(void **, int);
int /*<<< orphan*/ print_the_field(int, int, char **, size_t);
size_t remove_new_line(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ start_mission(int, int, char **, char *);
int /*<<< orphan*/ stdin;
int main() {
  char text[1001];
  fgets(text, 1001, stdin);
  size_t textLenght = remove_new_line(text);
  int lineLenght;
  scanf("%3d%*c", &lineLenght);
  float rows = textLenght / ((float)lineLenght);
  int rowLenght = (int)rows + 1;
  char bomb[202];
  fgets(bomb, 1001, stdin);
  remove_new_line(bomb);
  char **field = NULL;
  alloc_2D_arr_memory(&field, rowLenght, lineLenght);
  copy_to_2D_array(rowLenght, lineLenght, field, text, textLenght);
  start_mission(rowLenght, lineLenght, field, bomb);
  print_the_field(rowLenght, lineLenght, field, textLenght);
  free_2D_memory((void **)field, rowLenght);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4f0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e4f(%rip),%rax
mov    (%rax),%edx
lea    -0x3f0(%rbp),%rdi
mov    %rdi,-0x4e8(%rbp)
mov    $0x3e9,%esi
call   1060 <fgets@plt>
mov    -0x4e8(%rbp),%rdi
call   10a0 <remove_new_line@plt>
mov    %rax,-0x3f8(%rbp)
lea    0xe33(%rip),%rdi
lea    -0x3fc(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x3f8(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x4e0(%rbp)
ff
test   %rax,%rax
movss  %xmm0,-0x4dc(%rbp)
ff
js     1225 <main+0xa5>
movss  -0x4e0(%rbp),%xmm0
ff
movss  %xmm0,-0x4dc(%rbp)
ff
movss  -0x4dc(%rbp),%xmm0
ff
cvtsi2ssl -0x3fc(%rbp),%xmm1
ff
divss  %xmm1,%xmm0
movss  %xmm0,-0x400(%rbp)
ff
cvttss2si -0x400(%rbp),%eax
ff
add    $0x1,%eax
mov    %eax,-0x404(%rbp)
lea    -0x4d0(%rbp),%rdi
mov    0x2d88(%rip),%rax
mov    (%rax),%edx
mov    $0x3e9,%esi
call   1060 <fgets@plt>
lea    -0x4d0(%rbp),%rdi
call   10a0 <remove_new_line@plt>
movq   $0x0,-0x4d8(%rbp)
mov    -0x404(%rbp),%esi
mov    -0x3fc(%rbp),%edx
lea    -0x4d8(%rbp),%rdi
call   1070 <alloc_2D_arr_memory@plt>
mov    -0x404(%rbp),%edi
mov    -0x3fc(%rbp),%esi
mov    -0x4d8(%rbp),%rdx
lea    -0x3f0(%rbp),%rcx
mov    -0x3f8(%rbp),%r8
call   1080 <copy_to_2D_array@plt>
mov    -0x404(%rbp),%edi
mov    -0x3fc(%rbp),%esi
mov    -0x4d8(%rbp),%rdx
lea    -0x4d0(%rbp),%rcx
call   1030 <start_mission@plt>
mov    -0x404(%rbp),%edi
mov    -0x3fc(%rbp),%esi
mov    -0x4d8(%rbp),%rdx
mov    -0x3f8(%rbp),%rcx
call   1040 <print_the_field@plt>
mov    -0x4d8(%rbp),%rdi
mov    -0x404(%rbp),%esi
call   1050 <free_2D_memory@plt>
mov    0x2cc0(%rip),%rax
mov    (%rax),%eax
add    $0x4f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x4d8,%rsp
mov    0x2e54(%rip),%r15
mov    (%r15),%edx
lea    0xe0(%rsp),%r14
mov    %r14,%rdi
mov    $0x3e9,%esi
call   1060 <fgets@plt>
mov    %r14,%rdi
call   10a0 <remove_new_line@plt>
mov    %rax,%rbx
lea    0xe42(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1090 <scanf@plt>
test   %rbx,%rbx
js     11d4 <main+0x54>
cvtsi2ss %rbx,%xmm0
jmp    11eb <main+0x6b>
mov    %rbx,%rax
shr    %rax
mov    %ebx,%ecx
and    $0x1,%ecx
or     %rax,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ssl 0x4(%rsp),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%ebp
add    $0x1,%ebp
mov    (%r15),%edx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x3e9,%esi
call   1060 <fgets@plt>
mov    %r15,%rdi
call   10a0 <remove_new_line@plt>
movq   $0x0,0x8(%rsp)
mov    0x4(%rsp),%edx
lea    0x8(%rsp),%rdi
mov    %ebp,%esi
call   1070 <alloc_2D_arr_memory@plt>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%rdx
mov    %ebp,%edi
mov    %r14,%rcx
mov    %rbx,%r8
call   1080 <copy_to_2D_array@plt>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%rdx
mov    %ebp,%edi
mov    %r15,%rcx
call   1030 <start_mission@plt>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%rdx
mov    %ebp,%edi
mov    %rbx,%rcx
call   1040 <print_the_field@plt>
mov    0x8(%rsp),%rdi
mov    %ebp,%esi
call   1050 <free_2D_memory@plt>
mov    0x2d57(%rip),%rax
mov    (%rax),%eax
add    $0x4d8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [7 x i8] c"%3d%*c\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [1001 x i8]
%3 = alloca i64
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
%7 = alloca [202 x i8]
%8 = alloca i8**
store i32 0, i32* %1
%9 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %9, i32 1001, i32 %10)
%12 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%13 = call i64 @remove_new_line(i8* %12)
store i64 %13, i64* %3
%14 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %4)
%15 = load i64, i64* %3
%16 = uitofp i64 %15 to float
%17 = load i32, i32* %4
%18 = sitofp i32 %17 to float
%19 = fdiv float %16, %18
store float %19, float* %5
%20 = load float, float* %5
%21 = fptosi float %20 to i32
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
%23 = getelementptr inbounds [202 x i8], [202 x i8]* %7, i64 0, i64 0
%24 = load i32, i32* @stdin
%25 = call i32 @fgets(i8* %23, i32 1001, i32 %24)
%26 = getelementptr inbounds [202 x i8], [202 x i8]* %7, i64 0, i64 0
%27 = call i64 @remove_new_line(i8* %26)
store i8** null, i8*** %8
%28 = load i32, i32* %6
%29 = load i32, i32* %4
%30 = call i32 @alloc_2D_arr_memory(i8*** %8, i32 %28, i32 %29)
%31 = load i32, i32* %6
%32 = load i32, i32* %4
%33 = load i8**, i8*** %8
%34 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%35 = load i64, i64* %3
%36 = call i32 @copy_to_2D_array(i32 %31, i32 %32, i8** %33, i8* %34, i64 %35)
%37 = load i32, i32* %6
%38 = load i32, i32* %4
%39 = load i8**, i8*** %8
%40 = getelementptr inbounds [202 x i8], [202 x i8]* %7, i64 0, i64 0
%41 = call i32 @start_mission(i32 %37, i32 %38, i8** %39, i8* %40)
%42 = load i32, i32* %6
%43 = load i32, i32* %4
%44 = load i8**, i8*** %8
%45 = load i64, i64* %3
%46 = call i32 @print_the_field(i32 %42, i32 %43, i8** %44, i64 %45)
%47 = load i8**, i8*** %8
%48 = load i32, i32* %6
%49 = call i32 @free_2D_memory(i8** %47, i32 %48)
%50 = load i32, i32* @EXIT_SUCCESS
ret i32 %50
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [7 x i8] c"%3d%*c\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [1001 x i8]
%2 = alloca i32
%3 = alloca [202 x i8]
%4 = alloca i8**
%5 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i32 1001, i32 %6)
%8 = call i64 @remove_new_line(i8* %5)
%9 = bitcast i32* %2 to i8*
%10 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = uitofp i64 %8 to float
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to float
%14 = fdiv float %11, %13
%15 = fptosi float %14 to i32
%16 = add nsw i32 %15, 1
%17 = getelementptr inbounds [202 x i8], [202 x i8]* %3, i64 0, i64 0
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %17, i32 1001, i32 %18)
%20 = call i64 @remove_new_line(i8* %17)
%21 = bitcast i8*** %4 to i8*
store i8** null, i8*** %4
%22 = load i32, i32* %2
%23 = call i32 @alloc_2D_arr_memory(i8*** %4, i32 %16, i32 %22)
%24 = load i32, i32* %2
%25 = load i8**, i8*** %4
%26 = call i32 @copy_to_2D_array(i32 %16, i32 %24, i8** %25, i8* %5, i64 %8)
%27 = load i32, i32* %2
%28 = load i8**, i8*** %4
%29 = call i32 @start_mission(i32 %16, i32 %27, i8** %28, i8* %17)
%30 = load i32, i32* %2
%31 = load i8**, i8*** %4
%32 = call i32 @print_the_field(i32 %16, i32 %30, i8** %31, i64 %8)
%33 = load i8**, i8*** %4
%34 = call i32 @free_2D_memory(i8** %33, i32 %16)
%35 = load i32, i32* @EXIT_SUCCESS
ret i32 %35
}