#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 */
scalar_t__ next_permutation(char *);
scalar_t__ pair_qualifies(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  int count = 0;
  char die1[10 + 1] = "0000111111";
  do {
    char die2[10 + 1];
    strcpy(die2, die1);
    do {
      if (pair_qualifies(die1, die2))
        count++;
    } while (next_permutation(die2));
  } while (next_permutation(die1));
  printf("%d\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xea0(%rip),%ax
mov    %ax,-0xb(%rbp)
mov    0xe98(%rip),%al
mov    %al,-0x9(%rbp)
lea    -0x1e(%rbp),%rdi
lea    -0x13(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x13(%rbp),%rdi
lea    -0x1e(%rbp),%rsi
call   1060 <pair_qualifies@plt>
cmp    $0x0,%rax
je     11a2 <main+0x62>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a7 <main+0x67>
lea    -0x1e(%rbp),%rdi
call   1030 <next_permutation@plt>
cmp    $0x0,%rax
jne    1182 <main+0x42>
jmp    11bf <main+0x7f>
lea    -0x13(%rbp),%rdi
call   1030 <next_permutation@plt>
cmp    $0x0,%rax
jne    1175 <main+0x35>
mov    -0x8(%rbp),%esi
lea    0xe2f(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movabs $0x3131313130303030,%rax
31 31 31
mov    %rax,0x8(%rsp)
movl   $0x313131,0xf(%rsp)
xor    %ebx,%ebx
lea    0x15(%rsp),%r14
lea    0x8(%rsp),%r15
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <pair_qualifies@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
mov    %r14,%rdi
call   1030 <next_permutation@plt>
test   %rax,%rax
jne    1180 <main+0x40>
mov    %r15,%rdi
call   1030 <next_permutation@plt>
test   %rax,%rax
jne    1170 <main+0x30>
lea    0xe58(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.die1 = [11 x i8] c"0000111111\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [11 x i8]
%4 = alloca [11 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
%5 = bitcast [11 x i8]* %3 to i8*
br label %6
6: ; preds = %24, %0
%7 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%9 = call i32 @strcpy(i8* %7, i8* %8)
br label %10
10: ; preds = %19, %6
%11 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%13 = call i64 @pair_qualifies(i8* %11, i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %10
br label %19
19: ; preds = %18
%20 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%21 = call i64 @next_permutation(i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %10, label %23
23: ; preds = %19
br label %24
24: ; preds = %23
%25 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%26 = call i64 @next_permutation(i8* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %6, label %28
28: ; preds = %24
%29 = load i32, i32* %2
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
ret i32 0
}

LLVM IR (-O2):
@__const.main.die1 = [11 x i8] c"0000111111\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = alloca [11 x i8]
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %16, %0
%6 = phi i32 [ 0, %0 ], [ %13, %16 ]
%7 = call i32 @strcpy(i8* %4, i8* %3)
br label %8
8: ; preds = %8, %5
%9 = phi i32 [ %6, %5 ], [ %13, %8 ]
%10 = call i64 @pair_qualifies(i8* %3, i8* %4)
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
%13 = add nsw i32 %9, %12
%14 = call i64 @next_permutation(i8* %4)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %8
16: ; preds = %8
%17 = call i64 @next_permutation(i8* %3)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %5
19: ; preds = %16
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}