#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 */
typedef int uint32_t;

/* Variables and functions */
int concat(int, int);
int intlen(int);
scalar_t__ is_pandigital(int);
uint32_t pandigital_multiple(uint32_t i) {
  uint32_t cat = i;
  uint32_t length = 0;
  for (uint32_t j = 2; length < 9; j++) {
    cat = concat(cat, j * i);
    length = intlen(cat);
  }
  return is_pandigital(cat) ? cat : 0;
}


x86 assembly (clang, -O0):
<pandigital_multiple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    1184 <pandigital_multiple+0x54>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
imul   -0x4(%rbp),%esi
call   1040 <concat@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <intlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114f <pandigital_multiple+0x1f>
mov    -0x8(%rbp),%edi
call   1050 <is_pandigital@plt>
cmp    $0x0,%rax
je     11a1 <pandigital_multiple+0x71>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11ab <pandigital_multiple+0x7b>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    11ab <pandigital_multiple+0x7b>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pandigital_multiple>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
lea    (%r14,%r14,1),%ebp
mov    %edi,%ebx
nopl   (%rax)
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <concat@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <intlen@plt>
add    %r14d,%ebp
cmp    $0x9,%eax
jl     1140 <pandigital_multiple+0x10>
mov    %ebx,%edi
call   1050 <is_pandigital@plt>
xor    %ecx,%ecx
test   %rax,%rax
cmove  %ecx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @pandigital_multiple(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
store i32 %6, i32* %3
store i32 0, i32* %4
store i32 2, i32* %5
br label %7
7: ; preds = %18, %1
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 9
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = load i32, i32* %2
%14 = mul nsw i32 %12, %13
%15 = call i32 @concat(i32 %11, i32 %14)
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = call i32 @intlen(i32 %16)
store i32 %17, i32* %4
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %7
21: ; preds = %7
%22 = load i32, i32* %3
%23 = call i64 @is_pandigital(i32 %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i32, i32* %3
br label %28
27: ; preds = %21
br label %28
28: ; preds = %27, %25
%29 = phi i32 [ %26, %25 ], [ 0, %27 ]
ret i32 %29
}

LLVM IR (-O2):
define i32 @pandigital_multiple(i32 %0) {
br label %6
2: ; preds = %6
%3 = tail call i64 @is_pandigital(i32 %10)
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 0, i32 %10
ret i32 %5
6: ; preds = %1, %6
%7 = phi i32 [ 2, %1 ], [ %12, %6 ]
%8 = phi i32 [ %0, %1 ], [ %10, %6 ]
%9 = mul nsw i32 %7, %0
%10 = tail call i32 @concat(i32 %8, i32 %9)
%11 = tail call i32 @intlen(i32 %10)
%12 = add nuw nsw i32 %7, 1
%13 = icmp slt i32 %11, 9
br i1 %13, label %6, label %2
}