#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*/ lineck(char *);
int colnck(char *matrix) {
  char *ptr, line[10] = {0};
  int c, it = 0;
  while (it < 9) {
    ptr = matrix + it;
    c = 0;
    while (*ptr != 0) {
      line[c++] = *ptr;
      ptr += 10;
    }
    it++;
    if (!lineck(line))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<colnck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x22(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <memset@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x9,-0x2c(%rbp)
jge    11c7 <colnck+0xa7>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     119b <colnck+0x7b>
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x28(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
cltq
mov    %cl,-0x22(%rbp,%rax,1)
mov    -0x18(%rbp),%rax
add    $0xa,%rax
mov    %rax,-0x18(%rbp)
jmp    1163 <colnck+0x43>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
lea    -0x22(%rbp),%rdi
call   1030 <lineck@plt>
cmp    $0x0,%eax
jne    11c2 <colnck+0xa2>
movl   $0x0,-0x4(%rbp)
jmp    11ce <colnck+0xae>
jmp    1143 <colnck+0x23>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<colnck>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r15
movw   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xa(%rdi),%r12
xor    %ebx,%ebx
lea    0x8(%rsp),%r14
jmp    1154 <colnck+0x44>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <lineck@plt>
add    $0x1,%r12
test   %eax,%eax
je     1183 <colnck+0x73>
cmp    $0x9,%rbx
je     1187 <colnck+0x77>
mov    (%r15,%rbx,1),%al
test   %al,%al
je     1140 <colnck+0x30>
mov    %r12,%rcx
mov    %r14,%rdx
nopl   0x0(%rax,%rax,1)
mov    %al,(%rdx)
movzbl (%rcx),%eax
add    $0x1,%rdx
add    $0xa,%rcx
test   %al,%al
jne    1170 <colnck+0x60>
jmp    1140 <colnck+0x30>
xor    %eax,%eax
jmp    118c <colnck+0x7c>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @colnck(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [10 x i8]
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
%8 = bitcast [10 x i8]* %5 to i8*
store i32 0, i32* %7
br label %9
9: ; preds = %38, %1
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 9
br i1 %11, label %12, label %39
12: ; preds = %9
%13 = load i8*, i8** %3
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8* %16, i8** %4
store i32 0, i32* %6
br label %17
17: ; preds = %22, %12
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %31
22: ; preds = %17
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 %27
store i8 %24, i8* %28
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i64 10
store i8* %30, i8** %4
br label %17
31: ; preds = %17
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
%34 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%35 = call i32 @lineck(i8* %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %38, label %37
37: ; preds = %31
store i32 0, i32* %2
br label %40
38: ; preds = %31
br label %9
39: ; preds = %9
store i32 1, i32* %2
br label %40
40: ; preds = %39, %37
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
define i32 @colnck(i8* nocapture %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %20, %1
%5 = phi i64 [ %21, %20 ], [ 0, %1 ]
%6 = icmp eq i64 %5, 9
br i1 %6, label %24, label %7
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %0, i64 %5
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %20, label %11
11: ; preds = %7, %11
%12 = phi i64 [ %15, %11 ], [ 0, %7 ]
%13 = phi i8 [ %18, %11 ], [ %9, %7 ]
%14 = phi i8* [ %17, %11 ], [ %8, %7 ]
%15 = add nuw i64 %12, 1
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %12
store i8 %13, i8* %16
%17 = getelementptr inbounds i8, i8* %14, i64 10
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %11
20: ; preds = %11, %7
%21 = add nuw nsw i64 %5, 1
%22 = call i32 @lineck(i8* %3)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %4
24: ; preds = %4, %20
%25 = phi i32 [ 0, %20 ], [ 1, %4 ]
ret i32 %25
}