#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*/ printf(char *);
int /*<<< orphan*/ printres(long long);
scalar_t__ tryi(long long);
int main() {
  long long i, maxi = ((long long)1) << 20;
  for (i = 0; i < maxi; i++) {
    if (tryi(i))
      break;
  }
  printf("\n");
  if (i == maxi)
    printf("No solution\n");
  else
    printres(i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x100000,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    118b <main+0x5b>
mov    -0x10(%rbp),%rdi
call   1040 <tryi@plt>
cmp    $0x0,%rax
je     1175 <main+0x45>
jmp    118b <main+0x5b>
jmp    117a <main+0x4a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    114f <main+0x1f>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    11b6 <main+0x86>
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
jmp    11bf <main+0x8f>
mov    -0x10(%rbp),%rdi
call   1050 <printres@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1050 <tryi@plt>
test   %rax,%rax
jne    1182 <main+0x42>
add    $0x1,%rbx
cmp    $0x100000,%rbx
jne    1150 <main+0x10>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe85(%rip),%rdi
call   1040 <puts@plt>
jmp    1194 <main+0x54>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1060 <printres@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [13 x i8] c"No solution\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 1048576, i64* %3
store i64 0, i64* %2
br label %4
4: ; preds = %14, %0
%5 = load i64, i64* %2
%6 = load i64, i64* %3
%7 = icmp slt i64 %5, %6
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = load i64, i64* %2
%10 = call i64 @tryi(i64 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
br label %17
13: ; preds = %8
br label %14
14: ; preds = %13
%15 = load i64, i64* %2
%16 = add nsw i64 %15, 1
store i64 %16, i64* %2
br label %4
17: ; preds = %12, %4
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = load i64, i64* %2
%20 = load i64, i64* %3
%21 = icmp eq i64 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %27
24: ; preds = %17
%25 = load i64, i64* %2
%26 = call i32 @printres(i64 %25)
br label %27
27: ; preds = %24, %22
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"No solution\00"
define i32 @main() {
br label %1
1: ; preds = %0, %5
%2 = phi i64 [ 0, %0 ], [ %6, %5 ]
%3 = tail call i64 @tryi(i64 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = add nuw nsw i64 %2, 1
%7 = icmp eq i64 %6, 1048576
br i1 %7, label %8, label %1
8: ; preds = %5
%9 = tail call i32 @putchar(i32 10)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %14
11: ; preds = %1
%12 = tail call i32 @putchar(i32 10)
%13 = tail call i32 @printres(i64 %2)
br label %14
14: ; preds = %11, %8
ret i32 0
}