#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 count(int, int, int, int);
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int i, j, k, m, t;
  freopen("input.txt", "r", stdin);
  for (i = 1; i < 10; i++) {
    for (j = 0; j < 10; j++) {
      for (k = 0; k < 10; k++) {
        for (m = 0; m < 10; m++) {
          t = count(i, j, k, m);
          if ((9 * t) == count(m, k, j, i)) {
            printf("%d\n", t);
          }
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%edx
lea    0xeaa(%rip),%rdi
lea    0xead(%rip),%rsi
call   1050 <freopen@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    123a <main+0x10a>
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    1227 <main+0xf7>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    1214 <main+0xe4>
movl   $0x0,-0x20(%rbp)
cmpl   $0xa,-0x20(%rbp)
jge    1201 <main+0xd1>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1030 <count@plt>
mov    %eax,-0x24(%rbp)
imul   $0x9,-0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <count@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
jne    11ee <main+0xbe>
mov    -0x24(%rbp),%esi
lea    0xe23(%rip),%rdi
call   1040 <printf@plt>
jmp    11f3 <main+0xc3>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    119c <main+0x6c>
jmp    1206 <main+0xd6>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118b <main+0x5b>
jmp    1219 <main+0xe9>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117a <main+0x4a>
jmp    122c <main+0xfc>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1169 <main+0x39>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2ea6(%rip),%rax
mov    (%rax),%edx
lea    0xeb5(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1050 <freopen@plt>
mov    $0x1,%r15d
jmp    116a <main+0x3a>
nop
add    $0x1,%r15d
cmp    $0xa,%r15d
je     11d3 <main+0xa3>
xor    %r12d,%r12d
jmp    117a <main+0x4a>
nop
add    $0x1,%r12d
cmp    $0xa,%r12d
je     1160 <main+0x30>
xor    %r13d,%r13d
jmp    118a <main+0x5a>
nop
add    $0x1,%r13d
cmp    $0xa,%r13d
je     1170 <main+0x40>
xor    %ebp,%ebp
jmp    1198 <main+0x68>
xchg   %ax,%ax
add    $0x1,%ebp
cmp    $0xa,%ebp
je     1180 <main+0x50>
mov    %r15d,%edi
mov    %r12d,%esi
mov    %r13d,%edx
mov    %ebp,%ecx
call   1030 <count@plt>
mov    %eax,%ebx
lea    (%rbx,%rbx,8),%r14d
mov    %ebp,%edi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
call   1030 <count@plt>
cmp    %eax,%r14d
jne    1190 <main+0x60>
lea    0xe42(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* @stdin
%12 = call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %11)
store i32 1, i32* %6
br label %13
13: ; preds = %58, %2
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 10
br i1 %15, label %16, label %61
16: ; preds = %13
store i32 0, i32* %7
br label %17
17: ; preds = %54, %16
%18 = load i32, i32* %7
%19 = icmp slt i32 %18, 10
br i1 %19, label %20, label %57
20: ; preds = %17
store i32 0, i32* %8
br label %21
21: ; preds = %50, %20
%22 = load i32, i32* %8
%23 = icmp slt i32 %22, 10
br i1 %23, label %24, label %53
24: ; preds = %21
store i32 0, i32* %9
br label %25
25: ; preds = %46, %24
%26 = load i32, i32* %9
%27 = icmp slt i32 %26, 10
br i1 %27, label %28, label %49
28: ; preds = %25
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = load i32, i32* %9
%33 = call i32 @count(i32 %29, i32 %30, i32 %31, i32 %32)
store i32 %33, i32* %10
%34 = load i32, i32* %10
%35 = mul nsw i32 9, %34
%36 = load i32, i32* %9
%37 = load i32, i32* %8
%38 = load i32, i32* %7
%39 = load i32, i32* %6
%40 = call i32 @count(i32 %36, i32 %37, i32 %38, i32 %39)
%41 = icmp eq i32 %35, %40
br i1 %41, label %42, label %45
42: ; preds = %28
%43 = load i32, i32* %10
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %42, %28
br label %46
46: ; preds = %45
%47 = load i32, i32* %9
%48 = add nsw i32 %47, 1
store i32 %48, i32* %9
br label %25
49: ; preds = %25
br label %50
50: ; preds = %49
%51 = load i32, i32* %8
%52 = add nsw i32 %51, 1
store i32 %52, i32* %8
br label %21
53: ; preds = %21
br label %54
54: ; preds = %53
%55 = load i32, i32* %7
%56 = add nsw i32 %55, 1
store i32 %56, i32* %7
br label %17
57: ; preds = %17
br label %58
58: ; preds = %57
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 1
store i32 %60, i32* %6
br label %13
61: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdin
%4 = tail call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %5
5: ; preds = %2, %28
%6 = phi i32 [ 1, %2 ], [ %29, %28 ]
br label %7
7: ; preds = %5, %25
%8 = phi i32 [ 0, %5 ], [ %26, %25 ]
br label %9
9: ; preds = %7, %22
%10 = phi i32 [ 0, %7 ], [ %23, %22 ]
br label %11
11: ; preds = %9, %19
%12 = phi i32 [ 0, %9 ], [ %20, %19 ]
%13 = tail call i32 @count(i32 %6, i32 %8, i32 %10, i32 %12)
%14 = mul nsw i32 %13, 9
%15 = tail call i32 @count(i32 %12, i32 %10, i32 %8, i32 %6)
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %13)
br label %19
19: ; preds = %11, %17
%20 = add nuw nsw i32 %12, 1
%21 = icmp eq i32 %20, 10
br i1 %21, label %22, label %11
22: ; preds = %19
%23 = add nuw nsw i32 %10, 1
%24 = icmp eq i32 %23, 10
br i1 %24, label %25, label %9
25: ; preds = %22
%26 = add nuw nsw i32 %8, 1
%27 = icmp eq i32 %26, 10
br i1 %27, label %28, label %7
28: ; preds = %25
%29 = add nuw nsw i32 %6, 1
%30 = icmp eq i32 %29, 10
br i1 %30, label %31, label %5
31: ; preds = %28
ret i32 0
}