#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 concat_product(int, int);
scalar_t__ is_pandigital(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int n, i, test;
  int largest = 0;
  for (i = 1; i < 10000; i++) {
    n = 2;
    test = concat_product(i, n);
    while (test) {
      test = concat_product(i, n++);
      if (test > largest && is_pandigital(test)) {
        largest = test;
      }
    }
  }
  printf("%d\n", largest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x2710,-0xc(%rbp)
jge    11cb <main+0x9b>
movl   $0x2,-0x8(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <concat_product@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11b8 <main+0x88>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
call   1040 <concat_product@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11b3 <main+0x83>
mov    -0x10(%rbp),%edi
call   1050 <is_pandigital@plt>
cmp    $0x0,%rax
je     11b3 <main+0x83>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    116f <main+0x3f>
jmp    11bd <main+0x8d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <main+0x1d>
mov    -0x14(%rbp),%esi
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
xor    %r15d,%r15d
jmp    115d <main+0x2d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r14d
cmp    $0x2710,%r14d
je     11a8 <main+0x78>
mov    %r14d,%edi
mov    $0x2,%esi
call   1040 <concat_product@plt>
test   %eax,%eax
je     1150 <main+0x20>
mov    $0x2,%ebp
jmp    1187 <main+0x57>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
test   %ebx,%ebx
je     1150 <main+0x20>
mov    %r14d,%edi
mov    %ebp,%esi
call   1040 <concat_product@plt>
mov    %eax,%ebx
cmp    %r15d,%eax
jle    1180 <main+0x50>
mov    %ebx,%edi
call   1050 <is_pandigital@plt>
test   %rax,%rax
cmovne %ebx,%r15d
jmp    1180 <main+0x50>
lea    0xe51(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %19
%2 = phi i32 [ 0, %0 ], [ %20, %19 ]
%3 = phi i32 [ 1, %0 ], [ %21, %19 ]
%4 = tail call i32 @concat_product(i32 %3, i32 2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %19, label %6
6: ; preds = %1, %16
%7 = phi i32 [ %17, %16 ], [ %2, %1 ]
%8 = phi i32 [ %9, %16 ], [ 2, %1 ]
%9 = add nuw nsw i32 %8, 1
%10 = tail call i32 @concat_product(i32 %3, i32 %8)
%11 = icmp sgt i32 %10, %7
br i1 %11, label %12, label %16
12: ; preds = %6
%13 = tail call i64 @is_pandigital(i32 %10)
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, i32 %7, i32 %10
br label %16
16: ; preds = %12, %6
%17 = phi i32 [ %7, %6 ], [ %15, %12 ]
%18 = icmp eq i32 %10, 0
br i1 %18, label %19, label %6
19: ; preds = %16, %1
%20 = phi i32 [ %2, %1 ], [ %17, %16 ]
%21 = add nuw nsw i32 %3, 1
%22 = icmp eq i32 %21, 10000
br i1 %22, label %23, label %1
23: ; preds = %19
%24 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
ret i32 0
}