#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*/ dumpnode(int, unsigned int);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ puts(char *);
void dumpphrase(unsigned *sequence, int length, unsigned uniq) {
  printf("digraph phrase_%u {\n", uniq);
  int i;
  for (i = 0; i != length; ++i) {
    unsigned id = sequence[i];
    dumpnode(i, id);
    if (i + 1 != length)
      printf("%d -> %d;\n", i, i + 1);
  }
  printf("%u [color=blue];\n", length - 1);
  puts("}\n");
}


x86 assembly (clang, -O0):
<dumpphrase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     11b8 <dumpphrase+0x88>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <dumpnode@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
je     11a5 <dumpphrase+0x75>
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11aa <dumpphrase+0x7a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115a <dumpphrase+0x2a>
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5f(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpphrase>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r12
lea    0xeb8(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
je     11a6 <dumpphrase+0x76>
mov    (%r12),%esi
xor    %edi,%edi
call   1050 <dumpnode@plt>
cmp    $0x1,%r14d
je     11a6 <dumpphrase+0x76>
mov    %r14d,%r13d
add    $0xffffffffffffffff,%r13
lea    0xea0(%rip),%r15
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbp),%rbx
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%r12,%rbp,4),%esi
mov    %ebx,%edi
call   1050 <dumpnode@plt>
mov    %rbx,%rbp
cmp    %rbx,%r13
jne    1180 <dumpphrase+0x50>
add    $0xffffffff,%r14d
lea    0xe6f(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe70(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@.str = [21 x i8] c"digraph phrase_%u {\0A\00"
@.str.1 = [11 x i8] c"%d -> %d;\0A\00"
@.str.2 = [18 x i8] c"%u [color=blue];\0A\00"
@.str.3 = [3 x i8] c"}\0A\00"
define void @dumpphrase(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %2)
%5 = icmp eq i32 %1, 0
br i1 %5, label %22, label %6
6: ; preds = %3
%7 = zext i32 %1 to i64
%8 = load i32, i32* %0
%9 = tail call i32 @dumpnode(i32 0, i32 %8)
%10 = icmp eq i32 %1, 1
br i1 %10, label %22, label %11
11: ; preds = %6, %11
%12 = phi i64 [ %20, %11 ], [ 1, %6 ]
%13 = phi i32 [ %18, %11 ], [ 0, %6 ]
%14 = trunc i64 %12 to i32
%15 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %14)
%16 = getelementptr inbounds i32, i32* %0, i64 %12
%17 = load i32, i32* %16
%18 = trunc i64 %12 to i32
%19 = tail call i32 @dumpnode(i32 %18, i32 %17)
%20 = add nuw nsw i64 %12, 1
%21 = icmp eq i64 %20, %7
br i1 %21, label %22, label %11
22: ; preds = %11, %6, %3
%23 = add nsw i32 %1, -1
%24 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}