#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*/ assert(int);
int /*<<< orphan*/ printf(char *, ...);
int solve(int, int);
void search_space() {
  int solutions[300] = {0};
  int steps[300] = {0};
  for (int s = 1; s <= 200; s++) {
    int jumps = solve(s, false);
    if (jumps > 0) {
      assert(jumps < 300);
      solutions[jumps]++;
      steps[jumps] = s;
    }
  }
  printf("## Unique solutions for number of jumps.\n");
  for (int jumps = 0; jumps < 300; jumps++) {
    if (solutions[jumps] == 1 && steps[jumps] > 0) {
      printf("steps=%d, jumps=%02d\n", steps[jumps], jumps);
    }
  }
}


x86 assembly (clang, -O0):
<search_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x970,%rsp
lea    -0x4b0(%rbp),%rdi
xor    %esi,%esi
mov    $0x4b0,%edx
call   1050 <memset@plt>
lea    -0x960(%rbp),%rdi
xor    %esi,%esi
mov    $0x4b0,%edx
call   1050 <memset@plt>
movl   $0x1,-0x964(%rbp)
cmpl   $0xc8,-0x964(%rbp)
jg     1207 <search_space+0xc7>
mov    -0x964(%rbp),%edi
xor    %esi,%esi
call   1030 <solve@plt>
mov    %eax,-0x968(%rbp)
cmpl   $0x0,-0x968(%rbp)
jle    11ee <search_space+0xae>
cmpl   $0x12c,-0x968(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
movslq -0x968(%rbp),%rax
mov    -0x4b0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x4b0(%rbp,%rax,4)
mov    -0x964(%rbp),%ecx
movslq -0x968(%rbp),%rax
mov    %ecx,-0x960(%rbp,%rax,4)
jmp    11f3 <search_space+0xb3>
mov    -0x964(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x964(%rbp)
jmp    117b <search_space+0x3b>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x96c(%rbp)
cmpl   $0x12c,-0x96c(%rbp)
jge    1294 <search_space+0x154>
movslq -0x96c(%rbp),%rax
cmpl   $0x1,-0x4b0(%rbp,%rax,4)
01
jne    127b <search_space+0x13b>
movslq -0x96c(%rbp),%rax
cmpl   $0x0,-0x960(%rbp,%rax,4)
jle    127b <search_space+0x13b>
movslq -0x96c(%rbp),%rax
mov    -0x960(%rbp,%rax,4),%esi
mov    -0x96c(%rbp),%edx
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1280 <search_space+0x140>
mov    -0x96c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x96c(%rbp)
jmp    121f <search_space+0xdf>
add    $0x970,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<search_space>:
push   %rbp
push   %r14
push   %rbx
sub    $0x960,%rsp
lea    0x4b0(%rsp),%rdi
mov    $0x4b0,%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    %rsp,%rdi
mov    $0x4b0,%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    $0x1,%ebx
jmp    119b <search_space+0x4b>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
cmp    $0xc9,%ebx
je     11c9 <search_space+0x79>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <solve@plt>
test   %eax,%eax
jle    1190 <search_space+0x40>
mov    %eax,%ebp
xor    %edi,%edi
cmp    $0x12c,%eax
setb   %dil
call   1070 <assert@plt>
mov    %ebp,%eax
addl   $0x1,0x4b0(%rsp,%rax,4)
01
mov    %ebx,(%rsp,%rax,4)
jmp    1190 <search_space+0x40>
lea    0xe46(%rip),%rdi
call   1040 <puts@plt>
lea    0xe24(%rip),%r14
xor    %ebx,%ebx
jmp    11ed <search_space+0x9d>
add    $0x1,%rbx
cmp    $0x12c,%rbx
je     120c <search_space+0xbc>
cmpl   $0x1,0x4b0(%rsp,%rbx,4)
01
jne    11e0 <search_space+0x90>
mov    (%rsp,%rbx,4),%esi
test   %esi,%esi
jle    11e0 <search_space+0x90>
mov    %r14,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11e0 <search_space+0x90>
add    $0x960,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"## Unique solutions for number of jumps.\0A\00"
@.str.1 = [22 x i8] c"steps=%d, jumps=%02d\0A\00"
define void @search_space() {
%1 = alloca [300 x i32]
%2 = alloca [300 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [300 x i32]* %1 to i8*
%7 = bitcast [300 x i32]* %2 to i8*
store i32 1, i32* %3
br label %8
8: ; preds = %31, %0
%9 = load i32, i32* %3
%10 = icmp sle i32 %9, 200
br i1 %10, label %11, label %34
11: ; preds = %8
%12 = load i32, i32* %3
%13 = call i32 @solve(i32 %12, i32 0)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %11
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 300
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [300 x i32], [300 x i32]* %1, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = add nsw i32 %24, 1
store i32 %25, i32* %23
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [300 x i32], [300 x i32]* %2, i64 0, i64 %28
store i32 %26, i32* %29
br label %30
30: ; preds = %16, %11
br label %31
31: ; preds = %30
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %8
34: ; preds = %8
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %36
36: ; preds = %59, %34
%37 = load i32, i32* %5
%38 = icmp slt i32 %37, 300
br i1 %38, label %39, label %62
39: ; preds = %36
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [300 x i32], [300 x i32]* %1, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %58
45: ; preds = %39
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [300 x i32], [300 x i32]* %2, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %58
51: ; preds = %45
%52 = load i32, i32* %5
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [300 x i32], [300 x i32]* %2, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = load i32, i32* %5
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %55, i32 %56)
br label %58
58: ; preds = %51, %45, %39
br label %59
59: ; preds = %58
%60 = load i32, i32* %5
%61 = add nsw i32 %60, 1
store i32 %61, i32* %5
br label %36
62: ; preds = %36
ret void
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"steps=%d, jumps=%02d\0A\00"
@str = [41 x i8] c"## Unique solutions for number of jumps.\00"
define void @search_space() {
%1 = alloca [300 x i32]
%2 = alloca [300 x i32]
%3 = bitcast [300 x i32]* %1 to i8*
%4 = bitcast [300 x i32]* %2 to i8*
br label %7
5: ; preds = %20
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %24
7: ; preds = %0, %20
%8 = phi i32 [ 1, %0 ], [ %21, %20 ]
%9 = tail call i32 @solve(i32 %8, i32 0)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = icmp ult i32 %9, 300
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = zext i32 %9 to i64
%16 = getelementptr inbounds [300 x i32], [300 x i32]* %1, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
store i32 %18, i32* %16
%19 = getelementptr inbounds [300 x i32], [300 x i32]* %2, i64 0, i64 %15
store i32 %8, i32* %19
br label %20
20: ; preds = %11, %7
%21 = add nuw nsw i32 %8, 1
%22 = icmp eq i32 %21, 201
br i1 %22, label %5, label %7
23: ; preds = %36
ret void
24: ; preds = %5, %36
%25 = phi i64 [ 0, %5 ], [ %37, %36 ]
%26 = getelementptr inbounds [300 x i32], [300 x i32]* %1, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %36
29: ; preds = %24
%30 = getelementptr inbounds [300 x i32], [300 x i32]* %2, i64 0, i64 %25
%31 = load i32, i32* %30
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = trunc i64 %25 to i32
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %31, i32 %34)
br label %36
36: ; preds = %24, %29, %33
%37 = add nuw nsw i64 %25, 1
%38 = icmp eq i64 %37, 300
br i1 %38, label %23, label %24
}