#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 OatHash(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
char *strncpy(char *, char *, int);
main() {
  char s[] = "a";
  char c;
  int hash, box, minblocks;
  int period = 12 - 1;
  char *boxes[12];
  for (c = 0; c < 12; c++) {
    boxes[c] = 0;
  }
  for (c = 'a'; c <= 'z'; c++) {
    *s = c;
    hash = OatHash(s);
    box = (int)(0.5 + period * hash / (double)8192);
    minblocks = box % 12;
    if (!boxes[minblocks]) {
      boxes[minblocks] = strncpy((char *)malloc(2), s, 2);
    }
  }
  printf("    \"ok\" xor => {\n");
  for (c = 0; c < 12; c++) {
    printf("\tsplayclass(\"%s\",\"hourly\"), # Box %d\n", boxes[c], c);
  }
  printf("\t};\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb7(%rip),%ax
mov    %ax,-0x6(%rbp)
movl   $0xb,-0x18(%rbp)
movb   $0x0,-0x7(%rbp)
movsbl -0x7(%rbp),%eax
cmp    $0xc,%eax
jge    1190 <main+0x50>
movsbq -0x7(%rbp),%rax
movq   $0x0,-0x80(%rbp,%rax,8)
mov    -0x7(%rbp),%al
add    $0x1,%al
mov    %al,-0x7(%rbp)
jmp    1168 <main+0x28>
movb   $0x61,-0x7(%rbp)
movsbl -0x7(%rbp),%eax
cmp    $0x7a,%eax
jg     1234 <main+0xf4>
mov    -0x7(%rbp),%al
mov    %al,-0x6(%rbp)
lea    -0x6(%rbp),%rdi
call   1050 <OatHash@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
imul   -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xe42(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe2e(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmpq   $0x0,-0x80(%rbp,%rax,8)
jne    1222 <main+0xe2>
mov    $0x2,%edi
call   1060 <malloc@plt>
mov    %rax,%rdi
lea    -0x6(%rbp),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
mov    %rcx,-0x80(%rbp,%rax,8)
jmp    1227 <main+0xe7>
mov    -0x7(%rbp),%al
add    $0x1,%al
mov    %al,-0x7(%rbp)
jmp    1194 <main+0x54>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x0,-0x7(%rbp)
movsbl -0x7(%rbp),%eax
cmp    $0xc,%eax
jge    127c <main+0x13c>
movsbq -0x7(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rsi
movsbl -0x7(%rbp),%edx
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x7(%rbp),%al
add    $0x1,%al
mov    %al,-0x7(%rbp)
jmp    1246 <main+0x106>
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
movw   $0x61,0xe(%rsp)
xorpd  %xmm0,%xmm0
movapd %xmm0,0x60(%rsp)
movapd %xmm0,0x50(%rsp)
movapd %xmm0,0x40(%rsp)
movapd %xmm0,0x30(%rsp)
movapd %xmm0,0x20(%rsp)
movapd %xmm0,0x10(%rsp)
mov    $0x61,%bl
lea    0xe(%rsp),%r14
jmp    11a8 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%bl
cmp    $0x7b,%bl
je     121f <main+0xcf>
mov    %bl,0xe(%rsp)
mov    %r14,%rdi
call   1060 <OatHash@plt>
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,2),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe37(%rip),%xmm0
addsd  0xe37(%rip),%xmm0
cvttsd2si %xmm0,%eax
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x21,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
movslq %eax,%r15
cmpq   $0x0,0x10(%rsp,%r15,8)
jne    11a0 <main+0x50>
mov    $0x2,%edi
call   1070 <malloc@plt>
mov    %rax,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
mov    %rax,0x10(%rsp,%r15,8)
jmp    11a0 <main+0x50>
lea    0xe10(%rip),%rdi
call   1040 <puts@plt>
mov    0x10(%rsp),%rsi
lea    0xdd9(%rip),%rbx
mov    %rbx,%rdi
xor    %edx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x30(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x38(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x40(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x48(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x50(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x58(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x9,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x60(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x68(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xb,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd22(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.s = [2 x i8] c"a\00"
@.str = [19 x i8] c" \22ok\22 xor => {\0A\00"
@.str.1 = [38 x i8] c"\09splayclass(\22%s\22,\22hourly\22), # Box %d\0A\00"
@.str.2 = [5 x i8] c"\09};\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i8]
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [12 x i8*]
store i32 0, i32* %1
%9 = bitcast [2 x i8]* %2 to i8*
store i32 11, i32* %7
store i8 0, i8* %3
br label %10
10: ; preds = %18, %0
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = icmp slt i32 %12, 12
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load i8, i8* %3
%16 = sext i8 %15 to i64
%17 = getelementptr inbounds [12 x i8*], [12 x i8*]* %8, i64 0, i64 %16
store i8* null, i8** %17
br label %18
18: ; preds = %14
%19 = load i8, i8* %3
%20 = add i8 %19, 1
store i8 %20, i8* %3
br label %10
21: ; preds = %10
store i8 97, i8* %3
br label %22
22: ; preds = %54, %21
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 122
br i1 %25, label %26, label %57
26: ; preds = %22
%27 = load i8, i8* %3
%28 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
store i8 %27, i8* %28
%29 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%30 = call i32 @OatHash(i8* %29)
store i32 %30, i32* %4
%31 = load i32, i32* %7
%32 = load i32, i32* %4
%33 = mul nsw i32 %31, %32
%34 = sitofp i32 %33 to double
%35 = fdiv double %34, 8.192000e+03
%36 = fadd double 5.000000e-01, %35
%37 = fptosi double %36 to i32
store i32 %37, i32* %5
%38 = load i32, i32* %5
%39 = srem i32 %38, 12
store i32 %39, i32* %6
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [12 x i8*], [12 x i8*]* %8, i64 0, i64 %41
%43 = load i8*, i8** %42
%44 = icmp ne i8* %43, null
br i1 %44, label %53, label %45
45: ; preds = %26
%46 = call i64 @malloc(i32 2)
%47 = inttoptr i64 %46 to i8*
%48 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%49 = call i8* @strncpy(i8* %47, i8* %48, i32 2)
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [12 x i8*], [12 x i8*]* %8, i64 0, i64 %51
store i8* %49, i8** %52
br label %53
53: ; preds = %45, %26
br label %54
54: ; preds = %53
%55 = load i8, i8* %3
%56 = add i8 %55, 1
store i8 %56, i8* %3
br label %22
57: ; preds = %22
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i8 0, i8* %3
br label %59
59: ; preds = %71, %57
%60 = load i8, i8* %3
%61 = sext i8 %60 to i32
%62 = icmp slt i32 %61, 12
br i1 %62, label %63, label %74
63: ; preds = %59
%64 = load i8, i8* %3
%65 = sext i8 %64 to i64
%66 = getelementptr inbounds [12 x i8*], [12 x i8*]* %8, i64 0, i64 %65
%67 = load i8*, i8** %66
%68 = load i8, i8* %3
%69 = sext i8 %68 to i32
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %67, i32 %69)
br label %71
71: ; preds = %63
%72 = load i8, i8* %3
%73 = add i8 %72, 1
store i8 %73, i8* %3
br label %59
74: ; preds = %59
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%76 = load i32, i32* %1
ret i32 %76
}

LLVM IR (-O2):
@.str.1 = [38 x i8] c"\09splayclass(\22%s\22,\22hourly\22), # Box %d\0A\00"
@str = [18 x i8] c" \22ok\22 xor => {\00"
@str.3 = [4 x i8] c"\09};\00"
define i32 @main() {
%1 = alloca i16
%2 = alloca [12 x i8*]
%3 = bitcast [12 x i8*]* %2 to i8*
%4 = bitcast i16* %1 to i8*
store i16 97, i16* %1
br label %5
5: ; preds = %0, %22
%6 = phi i8 [ %23, %22 ], [ 97, %0 ]
store i8 %6, i8* %4
%7 = call i32 @OatHash(i8* %4)
%8 = mul nsw i32 %7, 11
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 0x3F20000000000000
%11 = fadd double %10, 5.000000e-01
%12 = fptosi double %11 to i32
%13 = srem i32 %12, 12
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %22
18: ; preds = %5
%19 = call i64 @malloc(i32 2)
%20 = inttoptr i64 %19 to i8*
%21 = call i8* @strncpy(i8* %20, i8* %4, i32 2)
store i8* %21, i8** %15
br label %22
22: ; preds = %5, %18
%23 = add nuw nsw i8 %6, 1
%24 = icmp eq i8 %23, 123
br i1 %24, label %25, label %5
25: ; preds = %22
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%27 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 0
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %28, i32 0)
%30 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 1
%31 = load i8*, i8** %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %31, i32 1)
%33 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 2
%34 = load i8*, i8** %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %34, i32 2)
%36 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 3
%37 = load i8*, i8** %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %37, i32 3)
%39 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 4
%40 = load i8*, i8** %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %40, i32 4)
%42 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 5
%43 = load i8*, i8** %42
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %43, i32 5)
%45 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 6
%46 = load i8*, i8** %45
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %46, i32 6)
%48 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 7
%49 = load i8*, i8** %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %49, i32 7)
%51 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 8
%52 = load i8*, i8** %51
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %52, i32 8)
%54 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 9
%55 = load i8*, i8** %54
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %55, i32 9)
%57 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 10
%58 = load i8*, i8** %57
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %58, i32 10)
%60 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 11
%61 = load i8*, i8** %60
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %61, i32 11)
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}