#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*/ calculete_score(char *, size_t, int, int *, int *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ print_result(int, int);
size_t read_line(char **, size_t *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int chessboardSize;
  scanf("%d%*c", &chessboardSize);
  char *input = NULL;
  size_t size = 0;
  size_t lenght = read_line(&input, &size);
  int blackScore = 0, whiteScore = 0;
  calculete_score(input, lenght, chessboardSize, &blackScore, &whiteScore);
  print_result(blackScore, whiteScore);
  free(input);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <read_line@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%edx
lea    -0x24(%rbp),%rcx
lea    -0x28(%rbp),%r8
call   1070 <calculete_score@plt>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1040 <print_result@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0xea5(%rip),%rdi
lea    0x1c(%rsp),%rsi
call   1050 <scanf@plt>
movq   $0x0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
lea    0x10(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1060 <read_line@plt>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    0x10(%rsp),%rdi
mov    0x1c(%rsp),%edx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %rax,%rsi
call   1070 <calculete_score@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1040 <print_result@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d%*c\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2)
store i8* null, i8** %3
store i64 0, i64* %4
%9 = call i64 @read_line(i8** %3, i64* %4)
store i64 %9, i64* %5
store i32 0, i32* %6
store i32 0, i32* %7
%10 = load i8*, i8** %3
%11 = load i64, i64* %5
%12 = load i32, i32* %2
%13 = call i32 @calculete_score(i8* %10, i64 %11, i32 %12, i32* %6, i32* %7)
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = call i32 @print_result(i32 %14, i32 %15)
%17 = load i8*, i8** %3
%18 = call i32 @free(i8* %17)
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d%*c\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%9 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%10 = call i64 @read_line(i8** %2, i64* %3)
%11 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%12 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%13 = load i8*, i8** %2
%14 = load i32, i32* %1
%15 = call i32 @calculete_score(i8* %13, i64 %10, i32 %14, i32* %4, i32* %5)
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = call i32 @print_result(i32 %16, i32 %17)
%19 = load i8*, i8** %2
%20 = call i32 @free(i8* %19)
%21 = load i32, i32* @EXIT_SUCCESS
ret i32 %21
}