#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*/ assert(int);
void ascertainmentBiasSequence(unsigned char tip[32], int numStates) {
  assert(numStates <= 32 && numStates > 1);
  switch (numStates) {
  case 2:
    tip[0] = 1;
    tip[1] = 2;
    break;
  case 4:
    tip[0] = 1;
    tip[1] = 2;
    tip[2] = 4;
    tip[3] = 8;
    break;
  default: {
    int i;
    for (i = 0; i < numStates; i++) {
      tip[i] = i;
    }
  } break;
  }
}


x86 assembly (clang, -O0):
<ascertainmentBiasSequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x20,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jg     1138 <ascertainmentBiasSequence+0x28>
cmpl   $0x1,-0xc(%rbp)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
movzbl %al,%edi
and    $0x1,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x2,%eax
je     116b <ascertainmentBiasSequence+0x5b>
jmp    115a <ascertainmentBiasSequence+0x4a>
mov    -0x18(%rbp),%eax
sub    $0x4,%eax
je     117f <ascertainmentBiasSequence+0x6f>
jmp    11a3 <ascertainmentBiasSequence+0x93>
mov    -0x8(%rbp),%rax
movb   $0x1,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x2,0x1(%rax)
jmp    11d9 <ascertainmentBiasSequence+0xc9>
mov    -0x8(%rbp),%rax
movb   $0x1,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x2,0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0x4,0x2(%rax)
mov    -0x8(%rbp),%rax
movb   $0x8,0x3(%rax)
jmp    11d9 <ascertainmentBiasSequence+0xc9>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d4 <ascertainmentBiasSequence+0xc4>
mov    -0x10(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11aa <ascertainmentBiasSequence+0x9a>
jmp    11d9 <ascertainmentBiasSequence+0xc9>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascertainmentBiasSequence>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rbx
lea    -0x2(%r14),%eax
xor    %edi,%edi
cmp    $0x1f,%eax
setb   %dil
call   1030 <assert@plt>
cmp    $0x2,%r14d
je     114a <ascertainmentBiasSequence+0x3a>
cmp    $0x4,%r14d
jne    115f <ascertainmentBiasSequence+0x4f>
movw   $0x201,(%rbx)
movb   $0x4,0x2(%rbx)
mov    $0x8,%al
mov    $0x3,%ecx
jmp    1154 <ascertainmentBiasSequence+0x44>
movb   $0x1,(%rbx)
mov    $0x2,%al
mov    $0x1,%ecx
mov    %al,(%rbx,%rcx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
test   %r14d,%r14d
jle    1157 <ascertainmentBiasSequence+0x47>
mov    %r14d,%eax
cmp    $0x10,%r14d
jae    1174 <ascertainmentBiasSequence+0x64>
xor    %ecx,%ecx
jmp    12b0 <ascertainmentBiasSequence+0x1a0>
mov    %eax,%ecx
and    $0xfffffff0,%ecx
lea    -0x10(%rcx),%rsi
mov    %rsi,%rdi
shr    $0x4,%rdi
add    $0x1,%rdi
mov    %edi,%edx
and    $0x7,%edx
cmp    $0x70,%rsi
jae    11a2 <ascertainmentBiasSequence+0x92>
movdqa 0xe65(%rip),%xmm2
xor    %esi,%esi
jmp    1277 <ascertainmentBiasSequence+0x167>
and    $0xfffffffffffffff8,%rdi
movdqa 0xe52(%rip),%xmm2
xor    %esi,%esi
movdqa 0xe57(%rip),%xmm8
movdqa 0xe5e(%rip),%xmm9
movdqa 0xe66(%rip),%xmm3
movdqa 0xe6e(%rip),%xmm4
movdqa 0xe76(%rip),%xmm5
movdqa 0xe7e(%rip),%xmm6
movdqa 0xe86(%rip),%xmm7
movdqa 0xe8e(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movdqu %xmm2,(%rbx,%rsi,1)
movdqa %xmm2,%xmm0
paddb  %xmm8,%xmm0
movdqu %xmm0,0x10(%rbx,%rsi,1)
movdqa %xmm2,%xmm0
paddb  %xmm9,%xmm0
movdqu %xmm0,0x20(%rbx,%rsi,1)
movdqa %xmm2,%xmm0
paddb  %xmm3,%xmm0
movdqu %xmm0,0x30(%rbx,%rsi,1)
movdqa %xmm2,%xmm0
paddb  %xmm4,%xmm0
movdqu %xmm0,0x40(%rbx,%rsi,1)
movdqa %xmm2,%xmm0
paddb  %xmm5,%xmm0
movdqu %xmm0,0x50(%rbx,%rsi,1)
movdqa %xmm2,%xmm0
paddb  %xmm6,%xmm0
movdqu %xmm0,0x60(%rbx,%rsi,1)
movdqa %xmm2,%xmm0
paddb  %xmm7,%xmm0
movdqu %xmm0,0x70(%rbx,%rsi,1)
sub    $0xffffffffffffff80,%rsi
pxor   %xmm1,%xmm2
add    $0xfffffffffffffff8,%rdi
jne    1200 <ascertainmentBiasSequence+0xf0>
test   %rdx,%rdx
je     12a2 <ascertainmentBiasSequence+0x192>
add    %rbx,%rsi
shl    $0x4,%rdx
xor    %edi,%edi
movdqa 0xd83(%rip),%xmm1
nopl   (%rax)
movdqu %xmm2,(%rsi,%rdi,1)
paddb  %xmm1,%xmm2
add    $0x10,%rdi
cmp    %rdi,%rdx
jne    1290 <ascertainmentBiasSequence+0x180>
cmp    %rax,%rcx
je     1157 <ascertainmentBiasSequence+0x47>
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rbx,%rcx,1)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    12b0 <ascertainmentBiasSequence+0x1a0>
jmp    1157 <ascertainmentBiasSequence+0x47>

LLVM IR (-O0):
define void @ascertainmentBiasSequence(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 32
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br label %11
11: ; preds = %8, %2
%12 = phi i1 [ false, %2 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32, i32* %4
switch i32 %15, label %30 [
i32 2, label %16
i32 4, label %21
]
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 0
store i8 1, i8* %18
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 1
store i8 2, i8* %20
br label %46
21: ; preds = %11
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 0
store i8 1, i8* %23
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i64 1
store i8 2, i8* %25
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 2
store i8 4, i8* %27
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i64 3
store i8 8, i8* %29
br label %46
30: ; preds = %11
store i32 0, i32* %5
br label %31
31: ; preds = %42, %30
%32 = load i32, i32* %5
%33 = load i32, i32* %4
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %45
35: ; preds = %31
%36 = load i32, i32* %5
%37 = trunc i32 %36 to i8
%38 = load i8*, i8** %3
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
store i8 %37, i8* %41
br label %42
42: ; preds = %35
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %31
45: ; preds = %31
br label %46
46: ; preds = %45, %21, %16
ret void
}

LLVM IR (-O2):
define void @ascertainmentBiasSequence(i8* nocapture writeonly %0, i32 %1) {
%3 = add i32 %1, -2
%4 = icmp ult i32 %3, 31
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
switch i32 %1, label %7 [
i32 2, label %77
i32 4, label %78
]
7: ; preds = %2
%8 = icmp sgt i32 %1, 0
br i1 %8, label %9, label %91
9: ; preds = %7
%10 = zext i32 %1 to i64
%11 = icmp ult i32 %1, 16
br i1 %11, label %75, label %12
12: ; preds = %9
%13 = and i64 %10, 4294967280
%14 = add nsw i64 %13, -16
%15 = lshr exact i64 %14, 4
%16 = add nuw nsw i64 %15, 1
%17 = and i64 %16, 7
%18 = icmp ult i64 %14, 112
br i1 %18, label %59, label %19
19: ; preds = %12
%20 = and i64 %16, 2305843009213693944
br label %21
21: ; preds = %21, %19
%22 = phi i64 [ 0, %19 ], [ %55, %21 ]
%23 = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %19 ], [ %56, %21 ]
%24 = phi i64 [ 0, %19 ], [ %57, %21 ]
%25 = getelementptr inbounds i8, i8* %0, i64 %22
%26 = bitcast i8* %25 to <16 x i8>*
store <16 x i8> %23, <16 x i8>* %26
%27 = or i64 %22, 16
%28 = add <16 x i8> %23, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%29 = getelementptr inbounds i8, i8* %0, i64 %27
%30 = bitcast i8* %29 to <16 x i8>*
store <16 x i8> %28, <16 x i8>* %30
%31 = or i64 %22, 32
%32 = add <16 x i8> %23, <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%33 = getelementptr inbounds i8, i8* %0, i64 %31
%34 = bitcast i8* %33 to <16 x i8>*
store <16 x i8> %32, <16 x i8>* %34
%35 = or i64 %22, 48
%36 = add <16 x i8> %23, <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>
%37 = getelementptr inbounds i8, i8* %0, i64 %35
%38 = bitcast i8* %37 to <16 x i8>*
store <16 x i8> %36, <16 x i8>* %38
%39 = or i64 %22, 64
%40 = add <16 x i8> %23, <i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64>
%41 = getelementptr inbounds i8, i8* %0, i64 %39
%42 = bitcast i8* %41 to <16 x i8>*
store <16 x i8> %40, <16 x i8>* %42
%43 = or i64 %22, 80
%44 = add <16 x i8> %23, <i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80>
%45 = getelementptr inbounds i8, i8* %0, i64 %43
%46 = bitcast i8* %45 to <16 x i8>*
store <16 x i8> %44, <16 x i8>* %46
%47 = or i64 %22, 96
%48 = add <16 x i8> %23, <i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96>
%49 = getelementptr inbounds i8, i8* %0, i64 %47
%50 = bitcast i8* %49 to <16 x i8>*
store <16 x i8> %48, <16 x i8>* %50
%51 = or i64 %22, 112
%52 = add <16 x i8> %23, <i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112>
%53 = getelementptr inbounds i8, i8* %0, i64 %51
%54 = bitcast i8* %53 to <16 x i8>*
store <16 x i8> %52, <16 x i8>* %54
%55 = add nuw i64 %22, 128
%56 = xor <16 x i8> %23, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
%57 = add i64 %24, 8
%58 = icmp eq i64 %57, %20
br i1 %58, label %59, label %21
59: ; preds = %21, %12
%60 = phi i64 [ 0, %12 ], [ %55, %21 ]
%61 = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %12 ], [ %56, %21 ]
%62 = icmp eq i64 %17, 0
br i1 %62, label %73, label %63
63: ; preds = %59, %63
%64 = phi i64 [ %69, %63 ], [ %60, %59 ]
%65 = phi <16 x i8> [ %70, %63 ], [ %61, %59 ]
%66 = phi i64 [ %71, %63 ], [ 0, %59 ]
%67 = getelementptr inbounds i8, i8* %0, i64 %64
%68 = bitcast i8* %67 to <16 x i8>*
store <16 x i8> %65, <16 x i8>* %68
%69 = add nuw i64 %64, 16
%70 = add <16 x i8> %65, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%71 = add i64 %66, 1
%72 = icmp eq i64 %71, %17
br i1 %72, label %73, label %63
73: ; preds = %63, %59
%74 = icmp eq i64 %13, %10
br i1 %74, label %91, label %75
75: ; preds = %9, %73
%76 = phi i64 [ 0, %9 ], [ %13, %73 ]
br label %81
77: ; preds = %2
store i8 1, i8* %0
br label %87
78: ; preds = %2
store i8 1, i8* %0
%79 = getelementptr inbounds i8, i8* %0, i64 1
store i8 2, i8* %79
%80 = getelementptr inbounds i8, i8* %0, i64 2
store i8 4, i8* %80
br label %87
81: ; preds = %75, %81
%82 = phi i64 [ %85, %81 ], [ %76, %75 ]
%83 = trunc i64 %82 to i8
%84 = getelementptr inbounds i8, i8* %0, i64 %82
store i8 %83, i8* %84
%85 = add nuw nsw i64 %82, 1
%86 = icmp eq i64 %85, %10
br i1 %86, label %91, label %81
87: ; preds = %77, %78
%88 = phi i64 [ 3, %78 ], [ 1, %77 ]
%89 = phi i8 [ 8, %78 ], [ 2, %77 ]
%90 = getelementptr inbounds i8, i8* %0, i64 %88
store i8 %89, i8* %90
br label %91
91: ; preds = %81, %73, %87, %7
ret void
}