#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*/ combination_first(int, int, int *);
scalar_t__ combination_next(int, int, int *);
int ibc(int, int);
int ipow(int, int);
int /*<<< orphan*/ permutation_first(int, int, int *);
scalar_t__ permutation_next(int, int, int *);
int raid_test_combo(void) {
  int r;
  int count;
  int p[6];
  for (r = 1; r <= 6; ++r) {
    count = 0;
    combination_first(r, 6, p);
    do {
      ++count;
    } while (combination_next(r, 6, p));
    if (count != ibc(6, r)) {
      return -1;
    }
  }
  for (r = 1; r <= 6; ++r) {
    count = 0;
    permutation_first(r, 6, p);
    do {
      ++count;
    } while (permutation_next(r, 6, p));
    if (count != ipow(6, r)) {
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<raid_test_combo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x1,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jg     11f4 <raid_test_combo+0x94>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rdx
mov    $0x6,%esi
call   1040 <combination_first@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rdx
mov    $0x6,%esi
call   1060 <combination_next@plt>
cmp    $0x0,%rax
jne    1191 <raid_test_combo+0x31>
mov    -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x6,%edi
call   1050 <ibc@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
je     11e1 <raid_test_combo+0x81>
movl   $0xffffffff,-0x4(%rbp)
jmp    1287 <raid_test_combo+0x127>
jmp    11e6 <raid_test_combo+0x86>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116f <raid_test_combo+0xf>
movl   $0x1,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jg     1280 <raid_test_combo+0x120>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rdx
mov    $0x6,%esi
call   1070 <permutation_first@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rdx
mov    $0x6,%esi
call   1030 <permutation_next@plt>
cmp    $0x0,%rax
jne    121d <raid_test_combo+0xbd>
mov    -0xc(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x6,%edi
call   1080 <ipow@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
cmp    %ecx,%eax
je     126d <raid_test_combo+0x10d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1287 <raid_test_combo+0x127>
jmp    1272 <raid_test_combo+0x112>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11fb <raid_test_combo+0x9b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raid_test_combo>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rbx
mov    $0x1,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1040 <combination_first@plt>
xor    %ebp,%ebp
nop
add    $0x1,%ebp
mov    $0x1,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1060 <combination_next@plt>
test   %rax,%rax
jne    1180 <raid_test_combo+0x20>
mov    $0x6,%edi
mov    $0x1,%esi
call   1050 <ibc@plt>
mov    $0xffffffff,%r14d
cmp    %ebp,%eax
jne    1501 <raid_test_combo+0x3a1>
mov    %rsp,%rbx
mov    $0x2,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1040 <combination_first@plt>
xor    %ebp,%ebp
xchg   %ax,%ax
add    $0x1,%ebp
mov    $0x2,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1060 <combination_next@plt>
test   %rax,%rax
jne    11d0 <raid_test_combo+0x70>
mov    $0x6,%edi
mov    $0x2,%esi
call   1050 <ibc@plt>
cmp    %ebp,%eax
jne    1501 <raid_test_combo+0x3a1>
mov    %rsp,%rbx
mov    $0x3,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1040 <combination_first@plt>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    $0x3,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1060 <combination_next@plt>
test   %rax,%rax
jne    1220 <raid_test_combo+0xc0>
mov    $0x6,%edi
mov    $0x3,%esi
call   1050 <ibc@plt>
cmp    %ebp,%eax
jne    1501 <raid_test_combo+0x3a1>
mov    %rsp,%rbx
mov    $0x4,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1040 <combination_first@plt>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    $0x4,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1060 <combination_next@plt>
test   %rax,%rax
jne    1270 <raid_test_combo+0x110>
mov    $0x6,%edi
mov    $0x4,%esi
call   1050 <ibc@plt>
cmp    %ebp,%eax
jne    1501 <raid_test_combo+0x3a1>
mov    %rsp,%rbx
mov    $0x5,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1040 <combination_first@plt>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    $0x5,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1060 <combination_next@plt>
test   %rax,%rax
jne    12c0 <raid_test_combo+0x160>
mov    $0x6,%edi
mov    $0x5,%esi
call   1050 <ibc@plt>
cmp    %ebp,%eax
jne    1501 <raid_test_combo+0x3a1>
mov    %rsp,%rbx
mov    $0x6,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1040 <combination_first@plt>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    $0x6,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1060 <combination_next@plt>
test   %rax,%rax
jne    1310 <raid_test_combo+0x1b0>
mov    $0x6,%edi
mov    $0x6,%esi
call   1050 <ibc@plt>
cmp    %ebp,%eax
jne    1501 <raid_test_combo+0x3a1>
mov    %rsp,%rbx
mov    $0x1,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1070 <permutation_first@plt>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    $0x1,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1030 <permutation_next@plt>
test   %rax,%rax
jne    1360 <raid_test_combo+0x200>
mov    $0x6,%edi
mov    $0x1,%esi
call   1080 <ipow@plt>
cmp    %ebp,%eax
jne    1501 <raid_test_combo+0x3a1>
mov    %rsp,%rbx
mov    $0x2,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1070 <permutation_first@plt>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    $0x2,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1030 <permutation_next@plt>
test   %rax,%rax
jne    13b0 <raid_test_combo+0x250>
mov    $0x6,%edi
mov    $0x2,%esi
call   1080 <ipow@plt>
cmp    %ebp,%eax
jne    1501 <raid_test_combo+0x3a1>
mov    %rsp,%rbx
mov    $0x3,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1070 <permutation_first@plt>
xor    %ebp,%ebp
add    $0x1,%ebp
mov    $0x3,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1030 <permutation_next@plt>
test   %rax,%rax
jne    13f8 <raid_test_combo+0x298>
mov    $0x6,%edi
mov    $0x3,%esi
call   1080 <ipow@plt>
cmp    %ebp,%eax
jne    1501 <raid_test_combo+0x3a1>
mov    %rsp,%rbx
mov    $0x4,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1070 <permutation_first@plt>
xor    %ebp,%ebp
add    $0x1,%ebp
mov    $0x4,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1030 <permutation_next@plt>
test   %rax,%rax
jne    1440 <raid_test_combo+0x2e0>
mov    $0x6,%edi
mov    $0x4,%esi
call   1080 <ipow@plt>
cmp    %ebp,%eax
jne    1501 <raid_test_combo+0x3a1>
mov    %rsp,%rbx
mov    $0x5,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1070 <permutation_first@plt>
xor    %ebp,%ebp
add    $0x1,%ebp
mov    $0x5,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1030 <permutation_next@plt>
test   %rax,%rax
jne    1488 <raid_test_combo+0x328>
mov    $0x6,%edi
mov    $0x5,%esi
call   1080 <ipow@plt>
cmp    %ebp,%eax
jne    1501 <raid_test_combo+0x3a1>
mov    %rsp,%rbx
mov    $0x6,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1070 <permutation_first@plt>
xor    %ebp,%ebp
add    $0x1,%ebp
mov    $0x6,%edi
mov    $0x6,%esi
mov    %rbx,%rdx
call   1030 <permutation_next@plt>
test   %rax,%rax
jne    14cc <raid_test_combo+0x36c>
mov    $0x6,%edi
mov    $0x6,%esi
call   1080 <ipow@plt>
xor    %r14d,%r14d
cmp    %ebp,%eax
setne  %r14b
neg    %r14d
mov    %r14d,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @raid_test_combo() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [6 x i32]
store i32 1, i32* %2
br label %5
5: ; preds = %27, %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 6
br i1 %7, label %8, label %30
8: ; preds = %5
store i32 0, i32* %3
%9 = load i32, i32* %2
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%11 = call i32 @combination_first(i32 %9, i32 6, i32* %10)
br label %12
12: ; preds = %15, %8
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%18 = call i64 @combination_next(i32 %16, i32 6, i32* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %12, label %20
20: ; preds = %15
%21 = load i32, i32* %3
%22 = load i32, i32* %2
%23 = call i32 @ibc(i32 6, i32 %22)
%24 = icmp ne i32 %21, %23
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 -1, i32* %1
br label %57
26: ; preds = %20
br label %27
27: ; preds = %26
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %5
30: ; preds = %5
store i32 1, i32* %2
br label %31
31: ; preds = %53, %30
%32 = load i32, i32* %2
%33 = icmp sle i32 %32, 6
br i1 %33, label %34, label %56
34: ; preds = %31
store i32 0, i32* %3
%35 = load i32, i32* %2
%36 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%37 = call i32 @permutation_first(i32 %35, i32 6, i32* %36)
br label %38
38: ; preds = %41, %34
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %41
41: ; preds = %38
%42 = load i32, i32* %2
%43 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%44 = call i64 @permutation_next(i32 %42, i32 6, i32* %43)
%45 = icmp ne i64 %44, 0
br i1 %45, label %38, label %46
46: ; preds = %41
%47 = load i32, i32* %3
%48 = load i32, i32* %2
%49 = call i32 @ipow(i32 6, i32 %48)
%50 = icmp ne i32 %47, %49
br i1 %50, label %51, label %52
51: ; preds = %46
store i32 -1, i32* %1
br label %57
52: ; preds = %46
br label %53
53: ; preds = %52
%54 = load i32, i32* %2
%55 = add nsw i32 %54, 1
store i32 %55, i32* %2
br label %31
56: ; preds = %31
store i32 0, i32* %1
br label %57
57: ; preds = %56, %51, %25
%58 = load i32, i32* %1
ret i32 %58
}

LLVM IR (-O2):
define i32 @raid_test_combo() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @combination_first(i32 1, i32 6, i32* %3)
br label %57
5: ; preds = %62
%6 = call i32 @combination_first(i32 2, i32 6, i32* %3)
br label %7
7: ; preds = %7, %5
%8 = phi i32 [ 0, %5 ], [ %9, %7 ]
%9 = add nuw nsw i32 %8, 1
%10 = call i64 @combination_next(i32 2, i32 6, i32* %3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %7
12: ; preds = %7
%13 = call i32 @ibc(i32 6, i32 2)
%14 = icmp eq i32 %9, %13
br i1 %14, label %15, label %124
15: ; preds = %12
%16 = call i32 @combination_first(i32 3, i32 6, i32* %3)
br label %17
17: ; preds = %17, %15
%18 = phi i32 [ 0, %15 ], [ %19, %17 ]
%19 = add nuw nsw i32 %18, 1
%20 = call i64 @combination_next(i32 3, i32 6, i32* %3)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %17
22: ; preds = %17
%23 = call i32 @ibc(i32 6, i32 3)
%24 = icmp eq i32 %19, %23
br i1 %24, label %25, label %124
25: ; preds = %22
%26 = call i32 @combination_first(i32 4, i32 6, i32* %3)
br label %27
27: ; preds = %27, %25
%28 = phi i32 [ 0, %25 ], [ %29, %27 ]
%29 = add nuw nsw i32 %28, 1
%30 = call i64 @combination_next(i32 4, i32 6, i32* %3)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %27
32: ; preds = %27
%33 = call i32 @ibc(i32 6, i32 4)
%34 = icmp eq i32 %29, %33
br i1 %34, label %35, label %124
35: ; preds = %32
%36 = call i32 @combination_first(i32 5, i32 6, i32* %3)
br label %37
37: ; preds = %37, %35
%38 = phi i32 [ 0, %35 ], [ %39, %37 ]
%39 = add nuw nsw i32 %38, 1
%40 = call i64 @combination_next(i32 5, i32 6, i32* %3)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %37
42: ; preds = %37
%43 = call i32 @ibc(i32 6, i32 5)
%44 = icmp eq i32 %39, %43
br i1 %44, label %45, label %124
45: ; preds = %42
%46 = call i32 @combination_first(i32 6, i32 6, i32* %3)
br label %47
47: ; preds = %47, %45
%48 = phi i32 [ 0, %45 ], [ %49, %47 ]
%49 = add nuw nsw i32 %48, 1
%50 = call i64 @combination_next(i32 6, i32 6, i32* %3)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %47
52: ; preds = %47
%53 = call i32 @ibc(i32 6, i32 6)
%54 = icmp eq i32 %49, %53
br i1 %54, label %55, label %124
55: ; preds = %52
%56 = call i32 @permutation_first(i32 1, i32 6, i32* %3)
br label %116
57: ; preds = %57, %0
%58 = phi i32 [ 0, %0 ], [ %59, %57 ]
%59 = add nuw nsw i32 %58, 1
%60 = call i64 @combination_next(i32 1, i32 6, i32* %3)
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %57
62: ; preds = %57
%63 = call i32 @ibc(i32 6, i32 1)
%64 = icmp eq i32 %59, %63
br i1 %64, label %5, label %124
65: ; preds = %121
%66 = call i32 @permutation_first(i32 2, i32 6, i32* %3)
br label %67
67: ; preds = %67, %65
%68 = phi i32 [ 0, %65 ], [ %69, %67 ]
%69 = add nuw nsw i32 %68, 1
%70 = call i64 @permutation_next(i32 2, i32 6, i32* %3)
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %67
72: ; preds = %67
%73 = call i32 @ipow(i32 6, i32 2)
%74 = icmp eq i32 %69, %73
br i1 %74, label %75, label %124
75: ; preds = %72
%76 = call i32 @permutation_first(i32 3, i32 6, i32* %3)
br label %77
77: ; preds = %77, %75
%78 = phi i32 [ 0, %75 ], [ %79, %77 ]
%79 = add nuw nsw i32 %78, 1
%80 = call i64 @permutation_next(i32 3, i32 6, i32* %3)
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %77
82: ; preds = %77
%83 = call i32 @ipow(i32 6, i32 3)
%84 = icmp eq i32 %79, %83
br i1 %84, label %85, label %124
85: ; preds = %82
%86 = call i32 @permutation_first(i32 4, i32 6, i32* %3)
br label %87
87: ; preds = %87, %85
%88 = phi i32 [ 0, %85 ], [ %89, %87 ]
%89 = add nuw nsw i32 %88, 1
%90 = call i64 @permutation_next(i32 4, i32 6, i32* %3)
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %87
92: ; preds = %87
%93 = call i32 @ipow(i32 6, i32 4)
%94 = icmp eq i32 %89, %93
br i1 %94, label %95, label %124
95: ; preds = %92
%96 = call i32 @permutation_first(i32 5, i32 6, i32* %3)
br label %97
97: ; preds = %97, %95
%98 = phi i32 [ 0, %95 ], [ %99, %97 ]
%99 = add nuw nsw i32 %98, 1
%100 = call i64 @permutation_next(i32 5, i32 6, i32* %3)
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %97
102: ; preds = %97
%103 = call i32 @ipow(i32 6, i32 5)
%104 = icmp eq i32 %99, %103
br i1 %104, label %105, label %124
105: ; preds = %102
%106 = call i32 @permutation_first(i32 6, i32 6, i32* %3)
br label %107
107: ; preds = %107, %105
%108 = phi i32 [ 0, %105 ], [ %109, %107 ]
%109 = add nuw nsw i32 %108, 1
%110 = call i64 @permutation_next(i32 6, i32 6, i32* %3)
%111 = icmp eq i64 %110, 0
br i1 %111, label %112, label %107
112: ; preds = %107
%113 = call i32 @ipow(i32 6, i32 6)
%114 = icmp ne i32 %109, %113
%115 = sext i1 %114 to i32
br label %124
116: ; preds = %116, %55
%117 = phi i32 [ 0, %55 ], [ %118, %116 ]
%118 = add nuw nsw i32 %117, 1
%119 = call i64 @permutation_next(i32 1, i32 6, i32* %3)
%120 = icmp eq i64 %119, 0
br i1 %120, label %121, label %116
121: ; preds = %116
%122 = call i32 @ipow(i32 6, i32 1)
%123 = icmp eq i32 %118, %122
br i1 %123, label %65, label %124
124: ; preds = %112, %62, %12, %22, %32, %42, %52, %121, %72, %82, %92, %102
%125 = phi i32 [ -1, %121 ], [ -1, %72 ], [ -1, %82 ], [ -1, %92 ], [ -1, %102 ], [ -1, %52 ], [ -1, %42 ], [ -1, %32 ], [ -1, %22 ], [ -1, %12 ], [ -1, %62 ], [ %115, %112 ]
ret i32 %125
}