#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 *, long long);
long long tm(long long, long long);
int main(void) {
  long long t0;
  long long x0 = 775146;
  long long x1 = 600851475143;
  long long x2 = 55;
  long long x3 = 57;
_1:
  t0 = tm(x1, x0 - 1);
  x0--;
  if ((t0) != 0)
    goto _1;
  else
    goto _3;
_3:
  t0 = x0 - 1;
  x3 = x0;
  x2 = t0;
_4:
  if ((tm(x3, x2)) != 0)
    goto _5;
  else
    goto _1;
_5:
  t0 = x2 - 2;
  x2--;
  if ((t0) != 0)
    goto _4;
  else
    goto _6;
_6:
  printf("%lld ", x3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0xbd3ea,-0x18(%rbp)
movabs $0x8be589eac7,%rax
mov    %rax,-0x20(%rbp)
movq   $0x37,-0x28(%rbp)
movq   $0x39,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
sub    $0x1,%rsi
call   1040 <tm@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1186 <main+0x66>
jmp    1155 <main+0x35>
jmp    118b <main+0x6b>
mov    -0x18(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <tm@plt>
cmp    $0x0,%rax
je     11c3 <main+0xa3>
jmp    11c8 <main+0xa8>
jmp    1155 <main+0x35>
mov    -0x28(%rbp),%rax
sub    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11f0 <main+0xd0>
jmp    11a7 <main+0x87>
jmp    11f5 <main+0xd5>
mov    -0x30(%rbp),%rsi
lea    0xe00(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0xbd3ea,%r15d
movabs $0x8be589eac7,%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rbx
add    $0xffffffffffffffff,%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <tm@plt>
test   %rax,%rax
jne    1140 <main+0x20>
add    $0xfffffffffffffffe,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <tm@plt>
test   %rax,%rax
je     1140 <main+0x20>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
jne    1160 <main+0x40>
lea    0xe7f(%rip),%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%lld \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i32 0, i32* %1
store i64 775146, i64* %3
store i64 600851475143, i64* %4
store i64 55, i64* %5
store i64 57, i64* %6
br label %7
7: ; preds = %29, %16, %0
%8 = load i64, i64* %4
%9 = load i64, i64* %3
%10 = sub nsw i64 %9, 1
%11 = call i64 @tm(i64 %8, i64 %10)
store i64 %11, i64* %2
%12 = load i64, i64* %3
%13 = add nsw i64 %12, -1
store i64 %13, i64* %3
%14 = load i64, i64* %2
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %7
br label %7
17: ; preds = %7
br label %18
18: ; preds = %17
%19 = load i64, i64* %3
%20 = sub nsw i64 %19, 1
store i64 %20, i64* %2
%21 = load i64, i64* %3
store i64 %21, i64* %6
%22 = load i64, i64* %2
store i64 %22, i64* %5
br label %23
23: ; preds = %37, %18
%24 = load i64, i64* %6
%25 = load i64, i64* %5
%26 = call i64 @tm(i64 %24, i64 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %23
br label %30
29: ; preds = %23
br label %7
30: ; preds = %28
%31 = load i64, i64* %5
%32 = sub nsw i64 %31, 2
store i64 %32, i64* %2
%33 = load i64, i64* %5
%34 = add nsw i64 %33, -1
store i64 %34, i64* %5
%35 = load i64, i64* %2
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %30
br label %23
38: ; preds = %30
br label %39
39: ; preds = %38
%40 = load i64, i64* %6
%41 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%lld \00"
define i32 @main() {
br label %1
1: ; preds = %6, %0
%2 = phi i64 [ 775146, %0 ], [ %3, %6 ]
%3 = add nsw i64 %2, -1
%4 = tail call i64 @tm(i64 600851475143, i64 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %9, %1
br label %1
7: ; preds = %1
%8 = add nsw i64 %2, -2
br label %9
9: ; preds = %13, %7
%10 = phi i64 [ %8, %7 ], [ %14, %13 ]
%11 = tail call i64 @tm(i64 %3, i64 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %6, label %13
13: ; preds = %9
%14 = add nsw i64 %10, -1
%15 = icmp eq i64 %10, 2
br i1 %15, label %16, label %9
16: ; preds = %13
%17 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %3)
ret i32 0
}