#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 */
scalar_t__ exist_in_column(char **, char, int);
scalar_t__ exist_in_row(char **, char, int);
scalar_t__ exist_in_square(char **, char, int, int);
int test_value(char **tab, int i, int j, char n) {
  if (exist_in_row(tab, n, i) == 0) {
    if (exist_in_column(tab, n, j) == 0) {
      if (exist_in_square(tab, n, i, j) == 0)
        tab[i][j] = n;
      else
        return (0);
    } else
      return (0);
  } else
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<test_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x14(%rbp),%edx
movsbl %al,%esi
call   1040 <exist_in_row@plt>
cmp    $0x0,%rax
jne    11db <test_value+0xab>
mov    -0x10(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x18(%rbp),%edx
movsbl %al,%esi
call   1030 <exist_in_column@plt>
cmp    $0x0,%rax
jne    11ca <test_value+0x9a>
mov    -0x10(%rbp),%rdi
mov    -0x19(%rbp),%al
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
movsbl %al,%esi
call   1050 <exist_in_square@plt>
cmp    $0x0,%rax
jne    11b9 <test_value+0x89>
mov    -0x19(%rbp),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11c5 <test_value+0x95>
movl   $0x0,-0x4(%rbp)
jmp    11ee <test_value+0xbe>
jmp    11d6 <test_value+0xa6>
movl   $0x0,-0x4(%rbp)
jmp    11ee <test_value+0xbe>
jmp    11e7 <test_value+0xb7>
movl   $0x0,-0x4(%rbp)
jmp    11ee <test_value+0xbe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_value>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%rbp
mov    %ecx,%esi
mov    %r15d,%edx
call   1040 <exist_in_row@plt>
xor    %r12d,%r12d
test   %rax,%rax
jne    1199 <test_value+0x69>
movsbl %bl,%r13d
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r14d,%edx
call   1030 <exist_in_column@plt>
test   %rax,%rax
jne    1199 <test_value+0x69>
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1050 <exist_in_square@plt>
test   %rax,%rax
jne    1199 <test_value+0x69>
movslq %r15d,%rax
mov    0x0(%rbp,%rax,8),%rax
movslq %r14d,%rcx
mov    %bl,(%rax,%rcx,1)
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @test_value(i8** %0, i32 %1, i32 %2, i8 signext %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i8** %0, i8*** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8 %3, i8* %9
%10 = load i8**, i8*** %6
%11 = load i8, i8* %9
%12 = load i32, i32* %7
%13 = call i64 @exist_in_row(i8** %10, i8 signext %11, i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %42
15: ; preds = %4
%16 = load i8**, i8*** %6
%17 = load i8, i8* %9
%18 = load i32, i32* %8
%19 = call i64 @exist_in_column(i8** %16, i8 signext %17, i32 %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %40
21: ; preds = %15
%22 = load i8**, i8*** %6
%23 = load i8, i8* %9
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = call i64 @exist_in_square(i8** %22, i8 signext %23, i32 %24, i32 %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %38
28: ; preds = %21
%29 = load i8, i8* %9
%30 = load i8**, i8*** %6
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
store i8 %29, i8* %37
br label %39
38: ; preds = %21
store i32 0, i32* %5
br label %44
39: ; preds = %28
br label %41
40: ; preds = %15
store i32 0, i32* %5
br label %44
41: ; preds = %39
br label %43
42: ; preds = %4
store i32 0, i32* %5
br label %44
43: ; preds = %41
store i32 1, i32* %5
br label %44
44: ; preds = %43, %42, %40, %38
%45 = load i32, i32* %5
ret i32 %45
}

LLVM IR (-O2):
define i32 @test_value(i8** %0, i32 %1, i32 %2, i8 signext %3) {
%5 = tail call i64 @exist_in_row(i8** %0, i8 signext %3, i32 %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = tail call i64 @exist_in_column(i8** %0, i8 signext %3, i32 %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = tail call i64 @exist_in_square(i8** %0, i8 signext %3, i32 %1, i32 %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = sext i32 %1 to i64
%15 = getelementptr inbounds i8*, i8** %0, i64 %14
%16 = load i8*, i8** %15
%17 = sext i32 %2 to i64
%18 = getelementptr inbounds i8, i8* %16, i64 %17
store i8 %3, i8* %18
br label %19
19: ; preds = %4, %7, %10, %13
%20 = phi i32 [ 1, %13 ], [ 0, %10 ], [ 0, %7 ], [ 0, %4 ]
ret i32 %20
}