#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 INT_MAX;
int count_different_trits(unsigned int, unsigned int, int);
unsigned int crazy(int, unsigned int);
unsigned int get_register_a_value_for_crazy(unsigned int, unsigned int,
                                            unsigned int);
int rotate_right(int);
unsigned int
get_best_register_a_value_for_crazy(unsigned int source,
                                    unsigned int destination,
                                    unsigned int current_register_a_value,
                                    int *rotations, int *crazy_C2_first) {
  unsigned int value;
  int i;
  int not_modifiable_mask = 29524 - 1;
  int min_costs = INT_MAX;
  if ((value = get_register_a_value_for_crazy(
           source, destination, current_register_a_value)) == 0xFFFF) {
    return 0xFFFF;
  }
  if (value == 0 || value == 29524 || value == 59048 || value == 59048 - 1 ||
      value == 59048 - 2) {
    if (rotations != 0)
      *rotations = 10;
    if (crazy_C2_first != 0)
      *crazy_C2_first = 0;
    return value;
  }
  for (i = 0; i < 10; i++) {
    unsigned int constant = get_register_a_value_for_crazy(
        source, destination, current_register_a_value);
    int diff = count_different_trits(constant, current_register_a_value, 29524);
    int diff2 = count_different_trits(
        constant, crazy(59048, current_register_a_value), 29524);
    int diff_needs_wrap = count_different_trits(
        constant, current_register_a_value, not_modifiable_mask);
    int diff2_needs_wrap = count_different_trits(
        constant, crazy(59048, current_register_a_value), not_modifiable_mask);
    int rots_diff = i + (diff_needs_wrap == 0 ? 0 : 10);
    int costs_diff = diff * 9 + rots_diff * 3;
    int rots_diff2 = i + (diff2_needs_wrap == 0 ? 0 : 10);
    int costs_diff2 = diff2 * 9 + rots_diff2 * 3 + 2;
    if (costs_diff == 0) {
      costs_diff = 6;
    }
    if (costs_diff < min_costs) {
      min_costs = costs_diff;
      if (rotations != 0)
        *rotations = rots_diff;
      value = constant;
      if (crazy_C2_first != 0)
        *crazy_C2_first = 0;
    }
    if (costs_diff2 < min_costs && crazy_C2_first != 0) {
      min_costs = costs_diff2;
      if (rotations != 0)
        *rotations = rots_diff2;
      value = constant;
      *crazy_C2_first = 1;
    }
    current_register_a_value = rotate_right(current_register_a_value);
    if (not_modifiable_mask > 0)
      not_modifiable_mask = rotate_right(not_modifiable_mask) - 1;
  }
  return value;
}


x86 assembly (clang, -O0):
<get_best_register_a_value_for_crazy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x7353,-0x2c(%rbp)
mov    0x2e81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <get_register_a_value_for_crazy@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffff,%eax
jne    1194 <get_best_register_a_value_for_crazy+0x54>
movl   $0xffff,-0x4(%rbp)
jmp    13b6 <get_best_register_a_value_for_crazy+0x276>
cmpl   $0x0,-0x24(%rbp)
je     11d2 <get_best_register_a_value_for_crazy+0x92>
cmpl   $0x7354,-0x24(%rbp)
je     11d2 <get_best_register_a_value_for_crazy+0x92>
cmpl   $0xe6a8,-0x24(%rbp)
je     11d2 <get_best_register_a_value_for_crazy+0x92>
cmpl   $0xe6a7,-0x24(%rbp)
je     11d2 <get_best_register_a_value_for_crazy+0x92>
cmpl   $0xe6a6,-0x24(%rbp)
jne    1207 <get_best_register_a_value_for_crazy+0xc7>
cmpq   $0x0,-0x18(%rbp)
je     11e7 <get_best_register_a_value_for_crazy+0xa7>
mov    -0x18(%rbp),%rax
movl   $0xa,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     11fc <get_best_register_a_value_for_crazy+0xbc>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13b6 <get_best_register_a_value_for_crazy+0x276>
movl   $0x0,-0x28(%rbp)
cmpl   $0xa,-0x28(%rbp)
jge    13b0 <get_best_register_a_value_for_crazy+0x270>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <get_register_a_value_for_crazy@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    $0x7354,%edx
call   1050 <count_different_trits@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x10(%rbp),%esi
mov    $0xe6a8,%edi
call   1030 <crazy@plt>
mov    -0x5c(%rbp),%edi
mov    %eax,%esi
mov    $0x7354,%edx
call   1050 <count_different_trits@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   1050 <count_different_trits@plt>
mov    %eax,-0x40(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%esi
mov    $0xe6a8,%edi
call   1030 <crazy@plt>
mov    -0x58(%rbp),%edi
mov    %eax,%esi
mov    -0x2c(%rbp),%edx
call   1050 <count_different_trits@plt>
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x40(%rbp),%esi
mov    $0xa,%ecx
xor    %edx,%edx
cmp    $0x0,%esi
cmove  %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x48(%rbp)
imul   $0x9,-0x38(%rbp),%eax
imul   $0x3,-0x48(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x44(%rbp),%esi
mov    $0xa,%ecx
xor    %edx,%edx
cmp    $0x0,%esi
cmove  %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x50(%rbp)
imul   $0x9,-0x3c(%rbp),%eax
imul   $0x3,-0x50(%rbp),%ecx
add    %ecx,%eax
add    $0x2,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jne    12f3 <get_best_register_a_value_for_crazy+0x1b3>
movl   $0x6,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1339 <get_best_register_a_value_for_crazy+0x1f9>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1319 <get_best_register_a_value_for_crazy+0x1d9>
mov    -0x48(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x34(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1334 <get_best_register_a_value_for_crazy+0x1f4>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
jmp    1339 <get_best_register_a_value_for_crazy+0x1f9>
mov    -0x54(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    137a <get_best_register_a_value_for_crazy+0x23a>
cmpq   $0x0,-0x20(%rbp)
je     137a <get_best_register_a_value_for_crazy+0x23a>
mov    -0x54(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     136a <get_best_register_a_value_for_crazy+0x22a>
mov    -0x50(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x34(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%edi
call   1060 <rotate_right@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    139d <get_best_register_a_value_for_crazy+0x25d>
mov    -0x2c(%rbp),%edi
call   1060 <rotate_right@plt>
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13a2 <get_best_register_a_value_for_crazy+0x262>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    120e <get_best_register_a_value_for_crazy+0xce>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_best_register_a_value_for_crazy>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,%rbx
mov    %rcx,0x18(%rsp)
mov    %edx,%ebp
mov    0x2e89(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    %edi,0x20(%rsp)
mov    %esi,0x24(%rsp)
call   1040 <get_register_a_value_for_crazy@plt>
cmp    $0xe6a5,%eax
mov    %rax,0x10(%rsp)
jle    1192 <get_best_register_a_value_for_crazy+0x52>
lea    -0xe6a6(%rax),%ecx
cmp    $0x3,%ecx
jb     119d <get_best_register_a_value_for_crazy+0x5d>
cmp    $0xffff,%eax
je     11b8 <get_best_register_a_value_for_crazy+0x78>
jmp    11cc <get_best_register_a_value_for_crazy+0x8c>
test   %eax,%eax
je     119d <get_best_register_a_value_for_crazy+0x5d>
cmp    $0x7354,%eax
jne    11cc <get_best_register_a_value_for_crazy+0x8c>
mov    0x18(%rsp),%rcx
test   %rcx,%rcx
je     11ad <get_best_register_a_value_for_crazy+0x6d>
movl   $0xa,(%rcx)
test   %rbx,%rbx
je     11b8 <get_best_register_a_value_for_crazy+0x78>
movl   $0x0,(%rbx)
mov    0x10(%rsp),%rax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x7353,%r15d
xor    %r14d,%r14d
mov    %rbx,0x28(%rsp)
jmp    11ea <get_best_register_a_value_for_crazy+0xaa>
nopl   0x0(%rax)
add    $0x1,%r14d
cmp    $0xa,%r14d
je     11b8 <get_best_register_a_value_for_crazy+0x78>
mov    0x20(%rsp),%edi
mov    0x24(%rsp),%esi
mov    %ebp,%edx
call   1040 <get_register_a_value_for_crazy@plt>
mov    %eax,%r12d
mov    %eax,%edi
mov    %ebp,%esi
mov    $0x7354,%edx
call   1050 <count_different_trits@plt>
mov    %eax,%ebx
mov    $0xe6a8,%edi
mov    %ebp,%esi
call   1030 <crazy@plt>
mov    %r12d,%edi
mov    %eax,%esi
mov    $0x7354,%edx
call   1050 <count_different_trits@plt>
mov    %rax,0x30(%rsp)
mov    %r12d,%edi
mov    %ebp,%esi
mov    %r15d,%edx
call   1050 <count_different_trits@plt>
mov    %eax,%r13d
mov    $0xe6a8,%edi
mov    %ebp,%esi
call   1030 <crazy@plt>
mov    %r12d,%edi
mov    %eax,%esi
mov    %r15d,%edx
call   1050 <count_different_trits@plt>
test   %r13d,%r13d
je     1260 <get_best_register_a_value_for_crazy+0x120>
mov    $0xa,%r13d
add    %r14d,%r13d
lea    (%rbx,%rbx,8),%ecx
lea    0x0(%r13,%r13,2),%edx
add    %ecx,%edx
test   %eax,%eax
mov    0xc(%rsp),%esi
je     127a <get_best_register_a_value_for_crazy+0x13a>
mov    $0xa,%eax
mov    $0x6,%ecx
test   %edx,%edx
mov    0x28(%rsp),%rbx
je     128a <get_best_register_a_value_for_crazy+0x14a>
mov    %edx,%ecx
cmp    %esi,%ecx
jge    12b0 <get_best_register_a_value_for_crazy+0x170>
mov    0x18(%rsp),%rdx
test   %rdx,%rdx
je     129b <get_best_register_a_value_for_crazy+0x15b>
mov    %r13d,(%rdx)
test   %rbx,%rbx
je     12de <get_best_register_a_value_for_crazy+0x19e>
movl   $0x0,(%rbx)
mov    %ecx,%esi
mov    %r12d,%ecx
mov    %rcx,0x10(%rsp)
test   %rbx,%rbx
je     12e8 <get_best_register_a_value_for_crazy+0x1a8>
add    %r14d,%eax
mov    0x30(%rsp),%rcx
lea    (%rcx,%rcx,8),%ecx
lea    (%rax,%rax,2),%edx
add    %edx,%ecx
add    $0x2,%ecx
cmp    %esi,%ecx
jge    12e8 <get_best_register_a_value_for_crazy+0x1a8>
mov    0x18(%rsp),%rdx
test   %rdx,%rdx
je     12d8 <get_best_register_a_value_for_crazy+0x198>
mov    %eax,(%rdx)
movl   $0x1,(%rbx)
mov    %ecx,%esi
mov    %r12d,%eax
mov    %rax,0x10(%rsp)
mov    %esi,0xc(%rsp)
mov    %ebp,%edi
call   1060 <rotate_right@plt>
mov    %eax,%ebp
test   %r15d,%r15d
jle    11e0 <get_best_register_a_value_for_crazy+0xa0>
mov    %r15d,%edi
call   1060 <rotate_right@plt>
mov    %eax,%r15d
add    $0xffffffff,%r15d
jmp    11e0 <get_best_register_a_value_for_crazy+0xa0>

LLVM IR (-O0):
@INT_MAX = global i32 0
define i32 @get_best_register_a_value_for_crazy(i32 %0, i32 %1, i32 %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store i32 29523, i32* %14
%25 = load i32, i32* @INT_MAX
store i32 %25, i32* %15
%26 = load i32, i32* %7
%27 = load i32, i32* %8
%28 = load i32, i32* %9
%29 = call i32 @get_register_a_value_for_crazy(i32 %26, i32 %27, i32 %28)
store i32 %29, i32* %12
%30 = icmp eq i32 %29, 65535
br i1 %30, label %31, label %32
31: ; preds = %5
store i32 65535, i32* %6
br label %160
32: ; preds = %5
%33 = load i32, i32* %12
%34 = icmp eq i32 %33, 0
br i1 %34, label %47, label %35
35: ; preds = %32
%36 = load i32, i32* %12
%37 = icmp eq i32 %36, 29524
br i1 %37, label %47, label %38
38: ; preds = %35
%39 = load i32, i32* %12
%40 = icmp eq i32 %39, 59048
br i1 %40, label %47, label %41
41: ; preds = %38
%42 = load i32, i32* %12
%43 = icmp eq i32 %42, 59047
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = load i32, i32* %12
%46 = icmp eq i32 %45, 59046
br i1 %46, label %47, label %59
47: ; preds = %44, %41, %38, %35, %32
%48 = load i32*, i32** %10
%49 = icmp ne i32* %48, null
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = load i32*, i32** %10
store i32 10, i32* %51
br label %52
52: ; preds = %50, %47
%53 = load i32*, i32** %11
%54 = icmp ne i32* %53, null
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = load i32*, i32** %11
store i32 0, i32* %56
br label %57
57: ; preds = %55, %52
%58 = load i32, i32* %12
store i32 %58, i32* %6
br label %160
59: ; preds = %44
store i32 0, i32* %13
br label %60
60: ; preds = %155, %59
%61 = load i32, i32* %13
%62 = icmp slt i32 %61, 10
br i1 %62, label %63, label %158
63: ; preds = %60
%64 = load i32, i32* %7
%65 = load i32, i32* %8
%66 = load i32, i32* %9
%67 = call i32 @get_register_a_value_for_crazy(i32 %64, i32 %65, i32 %66)
store i32 %67, i32* %16
%68 = load i32, i32* %16
%69 = load i32, i32* %9
%70 = call i32 @count_different_trits(i32 %68, i32 %69, i32 29524)
store i32 %70, i32* %17
%71 = load i32, i32* %16
%72 = load i32, i32* %9
%73 = call i32 @crazy(i32 59048, i32 %72)
%74 = call i32 @count_different_trits(i32 %71, i32 %73, i32 29524)
store i32 %74, i32* %18
%75 = load i32, i32* %16
%76 = load i32, i32* %9
%77 = load i32, i32* %14
%78 = call i32 @count_different_trits(i32 %75, i32 %76, i32 %77)
store i32 %78, i32* %19
%79 = load i32, i32* %16
%80 = load i32, i32* %9
%81 = call i32 @crazy(i32 59048, i32 %80)
%82 = load i32, i32* %14
%83 = call i32 @count_different_trits(i32 %79, i32 %81, i32 %82)
store i32 %83, i32* %20
%84 = load i32, i32* %13
%85 = load i32, i32* %19
%86 = icmp eq i32 %85, 0
%87 = zext i1 %86 to i64
%88 = select i1 %86, i32 0, i32 10
%89 = add nsw i32 %84, %88
store i32 %89, i32* %21
%90 = load i32, i32* %17
%91 = mul nsw i32 %90, 9
%92 = load i32, i32* %21
%93 = mul nsw i32 %92, 3
%94 = add nsw i32 %91, %93
store i32 %94, i32* %22
%95 = load i32, i32* %13
%96 = load i32, i32* %20
%97 = icmp eq i32 %96, 0
%98 = zext i1 %97 to i64
%99 = select i1 %97, i32 0, i32 10
%100 = add nsw i32 %95, %99
store i32 %100, i32* %23
%101 = load i32, i32* %18
%102 = mul nsw i32 %101, 9
%103 = load i32, i32* %23
%104 = mul nsw i32 %103, 3
%105 = add nsw i32 %102, %104
%106 = add nsw i32 %105, 2
store i32 %106, i32* %24
%107 = load i32, i32* %22
%108 = icmp eq i32 %107, 0
br i1 %108, label %109, label %110
109: ; preds = %63
store i32 6, i32* %22
br label %110
110: ; preds = %109, %63
%111 = load i32, i32* %22
%112 = load i32, i32* %15
%113 = icmp slt i32 %111, %112
br i1 %113, label %114, label %128
114: ; preds = %110
%115 = load i32, i32* %22
store i32 %115, i32* %15
%116 = load i32*, i32** %10
%117 = icmp ne i32* %116, null
br i1 %117, label %118, label %121
118: ; preds = %114
%119 = load i32, i32* %21
%120 = load i32*, i32** %10
store i32 %119, i32* %120
br label %121
121: ; preds = %118, %114
%122 = load i32, i32* %16
store i32 %122, i32* %12
%123 = load i32*, i32** %11
%124 = icmp ne i32* %123, null
br i1 %124, label %125, label %127
125: ; preds = %121
%126 = load i32*, i32** %11
store i32 0, i32* %126
br label %127
127: ; preds = %125, %121
br label %128
128: ; preds = %127, %110
%129 = load i32, i32* %24
%130 = load i32, i32* %15
%131 = icmp slt i32 %129, %130
br i1 %131, label %132, label %145
132: ; preds = %128
%133 = load i32*, i32** %11
%134 = icmp ne i32* %133, null
br i1 %134, label %135, label %145
135: ; preds = %132
%136 = load i32, i32* %24
store i32 %136, i32* %15
%137 = load i32*, i32** %10
%138 = icmp ne i32* %137, null
br i1 %138, label %139, label %142
139: ; preds = %135
%140 = load i32, i32* %23
%141 = load i32*, i32** %10
store i32 %140, i32* %141
br label %142
142: ; preds = %139, %135
%143 = load i32, i32* %16
store i32 %143, i32* %12
%144 = load i32*, i32** %11
store i32 1, i32* %144
br label %145
145: ; preds = %142, %132, %128
%146 = load i32, i32* %9
%147 = call i32 @rotate_right(i32 %146)
store i32 %147, i32* %9
%148 = load i32, i32* %14
%149 = icmp sgt i32 %148, 0
br i1 %149, label %150, label %154
150: ; preds = %145
%151 = load i32, i32* %14
%152 = call i32 @rotate_right(i32 %151)
%153 = sub nsw i32 %152, 1
store i32 %153, i32* %14
br label %154
154: ; preds = %150, %145
br label %155
155: ; preds = %154
%156 = load i32, i32* %13
%157 = add nsw i32 %156, 1
store i32 %157, i32* %13
br label %60
158: ; preds = %60
%159 = load i32, i32* %12
store i32 %159, i32* %6
br label %160
160: ; preds = %158, %57, %31
%161 = load i32, i32* %6
ret i32 %161
}

LLVM IR (-O2):
@INT_MAX = global i32 0
define i32 @get_best_register_a_value_for_crazy(i32 %0, i32 %1, i32 %2, i32* writeonly %3, i32* writeonly %4) {
%6 = load i32, i32* @INT_MAX
%7 = tail call i32 @get_register_a_value_for_crazy(i32 %0, i32 %1, i32 %2)
switch i32 %7, label %8 [
i32 65535, label %71
i32 59048, label %12
i32 59047, label %12
i32 59046, label %12
i32 29524, label %12
i32 0, label %12
]
8: ; preds = %5
%9 = icmp eq i32* %3, null
%10 = icmp eq i32* %4, null
%11 = icmp ne i32* %4, null
br label %18
12: ; preds = %5, %5, %5, %5, %5
%13 = icmp eq i32* %3, null
br i1 %13, label %15, label %14
14: ; preds = %12
store i32 10, i32* %3
br label %15
15: ; preds = %14, %12
%16 = icmp eq i32* %4, null
br i1 %16, label %71, label %17
17: ; preds = %15
store i32 0, i32* %4
br label %71
18: ; preds = %8, %67
%19 = phi i32 [ %2, %8 ], [ %62, %67 ]
%20 = phi i32 [ %7, %8 ], [ %61, %67 ]
%21 = phi i32 [ 0, %8 ], [ %69, %67 ]
%22 = phi i32 [ 29523, %8 ], [ %68, %67 ]
%23 = phi i32 [ %6, %8 ], [ %60, %67 ]
%24 = tail call i32 @get_register_a_value_for_crazy(i32 %0, i32 %1, i32 %19)
%25 = tail call i32 @count_different_trits(i32 %24, i32 %19, i32 29524)
%26 = tail call i32 @crazy(i32 59048, i32 %19)
%27 = tail call i32 @count_different_trits(i32 %24, i32 %26, i32 29524)
%28 = tail call i32 @count_different_trits(i32 %24, i32 %19, i32 %22)
%29 = tail call i32 @crazy(i32 59048, i32 %19)
%30 = tail call i32 @count_different_trits(i32 %24, i32 %29, i32 %22)
%31 = icmp eq i32 %28, 0
%32 = select i1 %31, i32 0, i32 10
%33 = add nuw nsw i32 %32, %21
%34 = mul nsw i32 %25, 9
%35 = mul nuw nsw i32 %33, 3
%36 = add nsw i32 %35, %34
%37 = icmp eq i32 %30, 0
%38 = select i1 %37, i32 0, i32 10
%39 = add nuw nsw i32 %38, %21
%40 = mul nsw i32 %27, 9
%41 = mul nuw nsw i32 %39, 3
%42 = add i32 %40, 2
%43 = add i32 %42, %41
%44 = icmp eq i32 %36, 0
%45 = select i1 %44, i32 6, i32 %36
%46 = icmp slt i32 %45, %23
br i1 %46, label %47, label %51
47: ; preds = %18
br i1 %9, label %49, label %48
48: ; preds = %47
store i32 %33, i32* %3
br label %49
49: ; preds = %48, %47
br i1 %10, label %59, label %50
50: ; preds = %49
store i32 0, i32* %4
br label %51
51: ; preds = %50, %18
%52 = phi i32 [ %45, %50 ], [ %23, %18 ]
%53 = phi i32 [ %24, %50 ], [ %20, %18 ]
%54 = icmp slt i32 %43, %52
%55 = and i1 %11, %54
br i1 %55, label %56, label %59
56: ; preds = %51
br i1 %9, label %58, label %57
57: ; preds = %56
store i32 %39, i32* %3
br label %58
58: ; preds = %57, %56
store i32 1, i32* %4
br label %59
59: ; preds = %49, %58, %51
%60 = phi i32 [ %43, %58 ], [ %52, %51 ], [ %45, %49 ]
%61 = phi i32 [ %24, %58 ], [ %53, %51 ], [ %24, %49 ]
%62 = tail call i32 @rotate_right(i32 %19)
%63 = icmp sgt i32 %22, 0
br i1 %63, label %64, label %67
64: ; preds = %59
%65 = tail call i32 @rotate_right(i32 %22)
%66 = add nsw i32 %65, -1
br label %67
67: ; preds = %64, %59
%68 = phi i32 [ %66, %64 ], [ %22, %59 ]
%69 = add nuw nsw i32 %21, 1
%70 = icmp eq i32 %69, 10
br i1 %70, label %71, label %18
71: ; preds = %67, %5, %15, %17
%72 = phi i32 [ %7, %5 ], [ %7, %17 ], [ %7, %15 ], [ %61, %67 ]
ret i32 %72
}