#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 rev(int);
int solve(int num) {
  for (int i = 1; i <= num / 2; i++) {
    if (rev(i) == num - i) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     1175 <solve+0x65>
mov    -0xc(%rbp),%edi
call   1030 <rev@plt>
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jne    1162 <solve+0x52>
movl   $0x1,-0x4(%rbp)
jmp    117c <solve+0x6c>
jmp    1167 <solve+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <solve+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
cmp    $0x2,%edi
jl     1172 <solve+0x62>
mov    %edi,%r14d
mov    $0x1,%ebx
mov    $0x1,%edi
call   1030 <rev@plt>
lea    -0x1(%r14),%ebp
cmp    %ebp,%eax
je     1172 <solve+0x62>
mov    %r14d,%r15d
shr    $0x1f,%r15d
add    %r14d,%r15d
sar    %r15d
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%r14d
cmp    %ebx,%r15d
je     116a <solve+0x5a>
lea    0x1(%r14),%ebx
mov    %ebx,%edi
call   1030 <rev@plt>
add    $0xffffffff,%ebp
cmp    %eax,%ebp
jne    1150 <solve+0x40>
xor    %ebx,%ebx
cmp    %r15d,%r14d
setl   %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @solve(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 1, i32* %4
br label %5
5: ; preds = %19, %1
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sdiv i32 %7, 2
%9 = icmp sle i32 %6, %8
br i1 %9, label %10, label %22
10: ; preds = %5
%11 = load i32, i32* %4
%12 = call i32 @rev(i32 %11)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = sub nsw i32 %13, %14
%16 = icmp eq i32 %12, %15
br i1 %16, label %17, label %18
17: ; preds = %10
store i32 1, i32* %2
br label %23
18: ; preds = %10
br label %19
19: ; preds = %18
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %5
22: ; preds = %5
store i32 0, i32* %2
br label %23
23: ; preds = %22, %17
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @solve(i32 %0) {
%2 = sdiv i32 %0, 2
%3 = icmp slt i32 %0, 2
br i1 %3, label %19, label %4
4: ; preds = %1
%5 = tail call i32 @rev(i32 1)
%6 = add nsw i32 %0, -1
%7 = icmp eq i32 %5, %6
br i1 %7, label %19, label %8
8: ; preds = %4, %12
%9 = phi i32 [ %10, %12 ], [ 1, %4 ]
%10 = add nuw nsw i32 %9, 1
%11 = icmp eq i32 %9, %2
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = tail call i32 @rev(i32 %10)
%14 = sub nsw i32 %0, %10
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %8
16: ; preds = %8, %12
%17 = icmp slt i32 %9, %2
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %16, %4, %1
%20 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %18, %16 ]
ret i32 %20
}