#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 */
struct tree_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ count_valid_patterns(struct tree_node const *const, int *,
                                        int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void print_summary(const struct tree_node *const root_node) {
  int pattern_count[9];
  int sum = 0;
  int valid_sum = 0;
  int i;
  for (i = 0; i < 9; i++) {
    pattern_count[i] = 0;
  }
  count_valid_patterns(root_node, pattern_count, 0);
  for (i = 0; i < 9; i++) {
    if (pattern_count[i] > 0) {
      printf("Number of patterns for length %d: %d\t                    "
             "Minutes to brute-force*: %d\n",
             i + 1, pattern_count[i], pattern_count[i] / 5);
    }
    sum += pattern_count[i];
    if (i > 2)
      valid_sum += pattern_count[i];
  }
  printf("-------------------------------------------\n");
  printf("Number of all available patterns: %d\n", sum);
  printf("Number of valid patterns (length >= 4): %d (Brute-force* %d mins)\n",
         valid_sum, valid_sum / 5);
  printf("(* assuming 5 tries in 30 seconds and then a 30 second timeout, no "
         "limit on number of tires)\n");
  return;
}


x86 assembly (clang, -O0):
<print_summary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x9,-0x3c(%rbp)
jge    1165 <print_summary+0x45>
movslq -0x3c(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1141 <print_summary+0x21>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1030 <count_valid_patterns@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x9,-0x3c(%rbp)
jge    1201 <print_summary+0xe1>
movslq -0x3c(%rbp),%rax
cmpl   $0x0,-0x30(%rbp,%rax,4)
jle    11c8 <print_summary+0xa8>
mov    -0x3c(%rbp),%esi
add    $0x1,%esi
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x40(%rbp)
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    -0x40(%rbp),%edx
mov    %eax,%ecx
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x2,-0x3c(%rbp)
jle    11ee <print_summary+0xce>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    11f3 <print_summary+0xd3>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    117b <print_summary+0x5b>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%esi
mov    -0x38(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_summary>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x20(%rsp)
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <count_valid_patterns@plt>
mov    (%rsp),%edx
test   %edx,%edx
jle    1188 <print_summary+0x58>
mov    %edx,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x22,%rcx
lea    0xe87(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%edx
mov    %edx,0x34(%rsp)
mov    0x4(%rsp),%edx
test   %edx,%edx
jle    11ba <print_summary+0x8a>
mov    %edx,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x22,%rcx
lea    0xe56(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%edx
mov    %edx,0x30(%rsp)
mov    0x8(%rsp),%ebx
test   %ebx,%ebx
jle    11ee <print_summary+0xbe>
mov    %ebx,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x22,%rcx
lea    0xe24(%rip),%rdi
mov    $0x3,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%ebx
mov    0xc(%rsp),%r12d
test   %r12d,%r12d
jle    1223 <print_summary+0xf3>
mov    %r12d,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x22,%rcx
lea    0xdf1(%rip),%rdi
mov    $0x4,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%r12d
mov    0x10(%rsp),%r13d
test   %r13d,%r13d
jle    1258 <print_summary+0x128>
mov    %r13d,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x22,%rcx
lea    0xdbc(%rip),%rdi
mov    $0x5,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%r13d
mov    0x14(%rsp),%ebp
test   %ebp,%ebp
jle    1288 <print_summary+0x158>
mov    %ebp,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x22,%rcx
lea    0xd8a(%rip),%rdi
mov    $0x6,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%ebp
mov    0x18(%rsp),%r14d
test   %r14d,%r14d
jle    12bd <print_summary+0x18d>
mov    %r14d,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x22,%rcx
lea    0xd57(%rip),%rdi
mov    $0x7,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%r14d
mov    0x1c(%rsp),%r15d
test   %r15d,%r15d
jle    12f2 <print_summary+0x1c2>
mov    %r15d,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x22,%rcx
lea    0xd22(%rip),%rdi
mov    $0x8,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%r15d
mov    0x20(%rsp),%edx
test   %edx,%edx
jle    1320 <print_summary+0x1f0>
mov    %edx,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x22,%rcx
lea    0xcf0(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%edx
mov    %r12,%rcx
add    %r13d,%r12d
add    %ebp,%r12d
add    %r14d,%r12d
add    %r15d,%r12d
mov    0x30(%rsp),%eax
add    0x34(%rsp),%eax
add    %eax,%ebx
add    %ecx,%ebx
add    %r13d,%ebx
add    %ebp,%ebx
add    %r14d,%ebx
add    %r15d,%ebx
add    %edx,%ebx
add    %edx,%r12d
lea    0xd6d(%rip),%rdi
call   1040 <puts@plt>
lea    0xcf8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movslq %r12d,%rsi
imul   $0x66666667,%rsi,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x21,%rdx
add    %eax,%edx
lea    0xcf7(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd58(%rip),%rdi
call   1040 <puts@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tree_node = type { i32 }
@.str = [86 x i8] c"Number of patterns for length %d: %d\09 Minutes to brute-force*: %d\0A\00"
@.str.1 = [45 x i8] c"-------------------------------------------\0A\00"
@.str.2 = [38 x i8] c"Number of all available patterns: %d\0A\00"
@.str.3 = [67 x i8] c"Number of valid patterns (length >= 4): %d (Brute-force* %d mins)\0A\00"
@.str.4 = [94 x i8] c"(* assuming 5 tries in 30 seconds and then a 30 second timeout, no limit on number of tires)\0A\00"
define void @print_summary(%struct.tree_node* %0) {
%2 = alloca %struct.tree_node*
%3 = alloca [9 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store %struct.tree_node* %0, %struct.tree_node** %2
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %14, %1
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 9
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 %12
store i32 0, i32* %13
br label %14
14: ; preds = %10
%15 = load i32, i32* %6
%16 = add nsw i32 %15, 1
store i32 %16, i32* %6
br label %7
17: ; preds = %7
%18 = load %struct.tree_node*, %struct.tree_node** %2
%19 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 0
%20 = call i32 @count_valid_patterns(%struct.tree_node* %18, i32* %19, i32 0)
store i32 0, i32* %6
br label %21
21: ; preds = %60, %17
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 9
br i1 %23, label %24, label %63
24: ; preds = %21
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %43
30: ; preds = %24
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = sdiv i32 %40, 5
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i32 %32, i32 %36, i32 %41)
br label %43
43: ; preds = %30, %24
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = load i32, i32* %4
%49 = add nsw i32 %48, %47
store i32 %49, i32* %4
%50 = load i32, i32* %6
%51 = icmp sgt i32 %50, 2
br i1 %51, label %52, label %59
52: ; preds = %43
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = load i32, i32* %5
%58 = add nsw i32 %57, %56
store i32 %58, i32* %5
br label %59
59: ; preds = %52, %43
br label %60
60: ; preds = %59
%61 = load i32, i32* %6
%62 = add nsw i32 %61, 1
store i32 %62, i32* %6
br label %21
63: ; preds = %21
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%65 = load i32, i32* %4
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %65)
%67 = load i32, i32* %5
%68 = load i32, i32* %5
%69 = sdiv i32 %68, 5
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.3, i64 0, i64 0), i32 %67, i32 %69)
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.tree_node = type { i32 }
@.str = [86 x i8] c"Number of patterns for length %d: %d\09 Minutes to brute-force*: %d\0A\00"
@.str.2 = [38 x i8] c"Number of all available patterns: %d\0A\00"
@.str.3 = [67 x i8] c"Number of valid patterns (length >= 4): %d (Brute-force* %d mins)\0A\00"
@str = [44 x i8] c"-------------------------------------------\00"
@str.5 = [93 x i8] c"(* assuming 5 tries in 30 seconds and then a 30 second timeout, no limit on number of tires)\00"
define void @print_summary(%struct.tree_node* %0) {
%2 = alloca [9 x i32]
%3 = bitcast [9 x i32]* %2 to i8*
%4 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%5 = call i32 @count_valid_patterns(%struct.tree_node* %0, i32* %4, i32 0)
%6 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%7 = load i32, i32* %6
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = udiv i32 %7, 5
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i32 1, i32 %7, i32 %10)
%12 = load i32, i32* %6
br label %13
13: ; preds = %1, %9
%14 = phi i32 [ %12, %9 ], [ %7, %1 ]
%15 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 1
%16 = load i32, i32* %15
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = udiv i32 %16, 5
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i32 2, i32 %16, i32 %19)
%21 = load i32, i32* %15
br label %22
22: ; preds = %18, %13
%23 = phi i32 [ %21, %18 ], [ %16, %13 ]
%24 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 2
%25 = load i32, i32* %24
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %22
%28 = udiv i32 %25, 5
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i32 3, i32 %25, i32 %28)
%30 = load i32, i32* %24
br label %31
31: ; preds = %27, %22
%32 = phi i32 [ %30, %27 ], [ %25, %22 ]
%33 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 3
%34 = load i32, i32* %33
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %31
%37 = udiv i32 %34, 5
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i32 4, i32 %34, i32 %37)
%39 = load i32, i32* %33
br label %40
40: ; preds = %36, %31
%41 = phi i32 [ %39, %36 ], [ %34, %31 ]
%42 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 4
%43 = load i32, i32* %42
%44 = icmp sgt i32 %43, 0
br i1 %44, label %45, label %49
45: ; preds = %40
%46 = udiv i32 %43, 5
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i32 5, i32 %43, i32 %46)
%48 = load i32, i32* %42
br label %49
49: ; preds = %45, %40
%50 = phi i32 [ %48, %45 ], [ %43, %40 ]
%51 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 5
%52 = load i32, i32* %51
%53 = icmp sgt i32 %52, 0
br i1 %53, label %54, label %58
54: ; preds = %49
%55 = udiv i32 %52, 5
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i32 6, i32 %52, i32 %55)
%57 = load i32, i32* %51
br label %58
58: ; preds = %54, %49
%59 = phi i32 [ %57, %54 ], [ %52, %49 ]
%60 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 6
%61 = load i32, i32* %60
%62 = icmp sgt i32 %61, 0
br i1 %62, label %63, label %67
63: ; preds = %58
%64 = udiv i32 %61, 5
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i32 7, i32 %61, i32 %64)
%66 = load i32, i32* %60
br label %67
67: ; preds = %63, %58
%68 = phi i32 [ %66, %63 ], [ %61, %58 ]
%69 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 7
%70 = load i32, i32* %69
%71 = icmp sgt i32 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %67
%73 = udiv i32 %70, 5
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i32 8, i32 %70, i32 %73)
%75 = load i32, i32* %69
br label %76
76: ; preds = %72, %67
%77 = phi i32 [ %75, %72 ], [ %70, %67 ]
%78 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 8
%79 = load i32, i32* %78
%80 = icmp sgt i32 %79, 0
br i1 %80, label %81, label %85
81: ; preds = %76
%82 = udiv i32 %79, 5
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i32 9, i32 %79, i32 %82)
%84 = load i32, i32* %78
br label %85
85: ; preds = %81, %76
%86 = phi i32 [ %84, %81 ], [ %79, %76 ]
%87 = add nsw i32 %50, %41
%88 = add nsw i32 %59, %87
%89 = add nsw i32 %68, %88
%90 = add nsw i32 %77, %89
%91 = add nsw i32 %23, %14
%92 = add nsw i32 %32, %91
%93 = add nsw i32 %41, %92
%94 = add nsw i32 %50, %93
%95 = add nsw i32 %59, %94
%96 = add nsw i32 %68, %95
%97 = add nsw i32 %77, %96
%98 = add nsw i32 %86, %97
%99 = add nsw i32 %86, %90
%100 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %98)
%102 = sdiv i32 %99, 5
%103 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.3, i64 0, i64 0), i32 %99, i32 %102)
%104 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @str.5, i64 0, i64 0))
ret void
}