#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*/ printCMIX30(int, int, int);
int /*<<< orphan*/ printCMIX36(int, int, int);
int /*<<< orphan*/ printNEXT(int, int, int);
int /*<<< orphan*/ printSMIX(int, int, int, int);
int /*<<< orphan*/ printTIX2(int, int, int);
int /*<<< orphan*/ printTIX3(int, int, int);
int /*<<< orphan*/ printTIX4(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ tabs(int);
void print_core(int shift, int k, int s, int java) {
  int i, cc;
  i = 0;
  cc = 0;
  printf("\n");
  printf("/* k=%d s=%d */\n", k, s);
  do {
    int z;
    tabs(shift);
    printf("case %d:\n", cc);
    if (!java) {
      tabs(shift + 1);
      printf("q = p;\n");
    }
    switch (k) {
    case 2:
      printTIX2(shift + 1, i, java);
      break;
    case 3:
      printTIX3(shift + 1, i, java);
      break;
    case 4:
      printTIX4(shift + 1, i, java);
      break;
    }
    for (z = 0; z < k; z++) {
      i = (i + s - 3) % s;
      switch (s) {
      case 30:
        printCMIX30(shift + 1, i, java);
        break;
      case 36:
        printCMIX36(shift + 1, i, java);
        break;
      }
      printSMIX(shift + 1, i, s, java);
    }
    cc++;
    if (i == 0)
      cc = 0;
    printNEXT(shift + 1, cc, java);
    tabs(shift + 1);
    printf("/* fall through */\n");
  } while (i != 0);
}


x86 assembly (clang, -O0):
<print_core>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <tabs@plt>
mov    -0x18(%rbp),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x0,-0x10(%rbp)
jne    1210 <print_core+0x80>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1050 <tabs@plt>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x2,%eax
je     1246 <print_core+0xb6>
jmp    1224 <print_core+0x94>
mov    -0x20(%rbp),%eax
sub    $0x3,%eax
je     125c <print_core+0xcc>
jmp    1235 <print_core+0xa5>
mov    -0x20(%rbp),%eax
sub    $0x4,%eax
je     1272 <print_core+0xe2>
jmp    1283 <print_core+0xf3>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <printTIX2@plt>
jmp    1283 <print_core+0xf3>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1080 <printTIX3@plt>
jmp    1283 <print_core+0xf3>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <printTIX4@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1318 <print_core+0x188>
mov    -0x14(%rbp),%esi
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
mov    %esi,%eax
lea    -0x3(%rax,%rdx,1),%eax
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x1e,%eax
je     12cf <print_core+0x13f>
jmp    12be <print_core+0x12e>
mov    -0x24(%rbp),%eax
sub    $0x24,%eax
je     12e5 <print_core+0x155>
jmp    12f6 <print_core+0x166>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   10a0 <printCMIX30@plt>
jmp    12f6 <print_core+0x166>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1090 <printCMIX36@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x14(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   10b0 <printSMIX@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    128a <print_core+0xfa>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1332 <print_core+0x1a2>
movl   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1070 <printNEXT@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1050 <tabs@plt>
lea    0xcce(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
jne    11d4 <print_core+0x44>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_core>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r12d
mov    %edx,%ebx
mov    %esi,%ebp
mov    %esi,0x8(%rsp)
mov    %edi,%r14d
mov    $0xa,%edi
call   1050 <putchar@plt>
lea    0xe23(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r14,0x10(%rsp)
lea    0x1(%r14),%ebp
lea    -0x3(%rbx),%r14d
xor    %r15d,%r15d
xor    %r13d,%r13d
jmp    1239 <print_core+0x89>
nopl   (%rax)
mov    0xc(%rsp),%r13d
add    $0x1,%r13d
test   %r15d,%r15d
mov    %r13d,%esi
cmove  %r15d,%esi
mov    %ebp,%edi
mov    %r12d,%edx
call   1090 <printNEXT@plt>
mov    %ebp,%edi
call   1070 <tabs@plt>
lea    0xdf7(%rip),%rdi
call   1060 <puts@plt>
test   %r15d,%r15d
je     132b <print_core+0x17b>
mov    0x10(%rsp),%rdi
call   1070 <tabs@plt>
lea    0xdc7(%rip),%rdi
mov    %r13d,0xc(%rsp)
mov    %r13d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
test   %r12d,%r12d
jne    1271 <print_core+0xc1>
mov    %ebp,%edi
call   1070 <tabs@plt>
lea    0xdaf(%rip),%rdi
call   1060 <puts@plt>
mov    0x8(%rsp),%r13d
cmp    $0x4,%r13d
je     12c0 <print_core+0x110>
cmp    $0x3,%r13d
je     12a0 <print_core+0xf0>
cmp    $0x2,%r13d
jne    12ad <print_core+0xfd>
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r12d,%edx
call   1040 <printTIX2@plt>
test   %r13d,%r13d
jg     1306 <print_core+0x156>
jmp    1200 <print_core+0x50>
nop
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r12d,%edx
call   10a0 <printTIX3@plt>
test   %r13d,%r13d
jg     1306 <print_core+0x156>
jmp    1200 <print_core+0x50>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r12d,%edx
call   1030 <printTIX4@plt>
test   %r13d,%r13d
jg     1306 <print_core+0x156>
jmp    1200 <print_core+0x50>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r12d,%edx
call   10b0 <printCMIX36@plt>
mov    %ebp,%edi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
call   10d0 <printSMIX@plt>
add    $0xffffffff,%r13d
je     1200 <print_core+0x50>
add    %r14d,%r15d
mov    %r15d,%eax
cltd
idiv   %ebx
mov    %edx,%r15d
cmp    $0x24,%ebx
je     12e0 <print_core+0x130>
cmp    $0x1e,%ebx
jne    12ed <print_core+0x13d>
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r12d,%edx
call   10c0 <printCMIX30@plt>
jmp    12ed <print_core+0x13d>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [17 x i8] c"/* k=%d s=%d */\0A\00"
@.str.2 = [10 x i8] c"case %d:\0A\00"
@.str.3 = [8 x i8] c"q = p;\0A\00"
@.str.4 = [20 x i8] c"/* fall through */\0A\00"
define void @print_core(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %14)
br label %16
16: ; preds = %99, %4
%17 = load i32, i32* %5
%18 = call i32 @tabs(i32 %17)
%19 = load i32, i32* %10
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %8
%22 = icmp ne i32 %21, 0
br i1 %22, label %28, label %23
23: ; preds = %16
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
%26 = call i32 @tabs(i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %23, %16
%29 = load i32, i32* %6
switch i32 %29, label %48 [
i32 2, label %30
i32 3, label %36
i32 4, label %42
]
30: ; preds = %28
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
%33 = load i32, i32* %9
%34 = load i32, i32* %8
%35 = call i32 @printTIX2(i32 %32, i32 %33, i32 %34)
br label %48
36: ; preds = %28
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
%39 = load i32, i32* %9
%40 = load i32, i32* %8
%41 = call i32 @printTIX3(i32 %38, i32 %39, i32 %40)
br label %48
42: ; preds = %28
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
%45 = load i32, i32* %9
%46 = load i32, i32* %8
%47 = call i32 @printTIX4(i32 %44, i32 %45, i32 %46)
br label %48
48: ; preds = %28, %42, %36, %30
store i32 0, i32* %11
br label %49
49: ; preds = %80, %48
%50 = load i32, i32* %11
%51 = load i32, i32* %6
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %83
53: ; preds = %49
%54 = load i32, i32* %9
%55 = load i32, i32* %7
%56 = add nsw i32 %54, %55
%57 = sub nsw i32 %56, 3
%58 = load i32, i32* %7
%59 = srem i32 %57, %58
store i32 %59, i32* %9
%60 = load i32, i32* %7
switch i32 %60, label %73 [
i32 30, label %61
i32 36, label %67
]
61: ; preds = %53
%62 = load i32, i32* %5
%63 = add nsw i32 %62, 1
%64 = load i32, i32* %9
%65 = load i32, i32* %8
%66 = call i32 @printCMIX30(i32 %63, i32 %64, i32 %65)
br label %73
67: ; preds = %53
%68 = load i32, i32* %5
%69 = add nsw i32 %68, 1
%70 = load i32, i32* %9
%71 = load i32, i32* %8
%72 = call i32 @printCMIX36(i32 %69, i32 %70, i32 %71)
br label %73
73: ; preds = %53, %67, %61
%74 = load i32, i32* %5
%75 = add nsw i32 %74, 1
%76 = load i32, i32* %9
%77 = load i32, i32* %7
%78 = load i32, i32* %8
%79 = call i32 @printSMIX(i32 %75, i32 %76, i32 %77, i32 %78)
br label %80
80: ; preds = %73
%81 = load i32, i32* %11
%82 = add nsw i32 %81, 1
store i32 %82, i32* %11
br label %49
83: ; preds = %49
%84 = load i32, i32* %10
%85 = add nsw i32 %84, 1
store i32 %85, i32* %10
%86 = load i32, i32* %9
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %89
88: ; preds = %83
store i32 0, i32* %10
br label %89
89: ; preds = %88, %83
%90 = load i32, i32* %5
%91 = add nsw i32 %90, 1
%92 = load i32, i32* %10
%93 = load i32, i32* %8
%94 = call i32 @printNEXT(i32 %91, i32 %92, i32 %93)
%95 = load i32, i32* %5
%96 = add nsw i32 %95, 1
%97 = call i32 @tabs(i32 %96)
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %99
99: ; preds = %89
%100 = load i32, i32* %9
%101 = icmp ne i32 %100, 0
br i1 %101, label %16, label %102
102: ; preds = %99
ret void
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"/* k=%d s=%d */\0A\00"
@.str.2 = [10 x i8] c"case %d:\0A\00"
@str = [7 x i8] c"q = p;\00"
@str.5 = [19 x i8] c"/* fall through */\00"
define void @print_core(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @putchar(i32 10)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %2)
%7 = icmp eq i32 %3, 0
%8 = add nsw i32 %0, 1
%9 = icmp sgt i32 %1, 0
%10 = add i32 %2, -3
br label %11
11: ; preds = %40, %4
%12 = phi i32 [ 0, %4 ], [ %41, %40 ]
%13 = phi i32 [ 0, %4 ], [ %42, %40 ]
%14 = tail call i32 @tabs(i32 %0)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %13)
br i1 %7, label %16, label %19
16: ; preds = %11
%17 = tail call i32 @tabs(i32 %8)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %19
19: ; preds = %16, %11
switch i32 %1, label %26 [
i32 2, label %20
i32 3, label %22
i32 4, label %24
]
20: ; preds = %19
%21 = tail call i32 @printTIX2(i32 %8, i32 %12, i32 %3)
br label %26
22: ; preds = %19
%23 = tail call i32 @printTIX3(i32 %8, i32 %12, i32 %3)
br label %26
24: ; preds = %19
%25 = tail call i32 @printTIX4(i32 %8, i32 %12, i32 %3)
br label %26
26: ; preds = %19, %24, %22, %20
br i1 %9, label %27, label %40
27: ; preds = %26, %36
%28 = phi i32 [ %38, %36 ], [ 0, %26 ]
%29 = phi i32 [ %31, %36 ], [ %12, %26 ]
%30 = add i32 %10, %29
%31 = srem i32 %30, %2
switch i32 %2, label %36 [
i32 30, label %32
i32 36, label %34
]
32: ; preds = %27
%33 = tail call i32 @printCMIX30(i32 %8, i32 %31, i32 %3)
br label %36
34: ; preds = %27
%35 = tail call i32 @printCMIX36(i32 %8, i32 %31, i32 %3)
br label %36
36: ; preds = %27, %34, %32
%37 = tail call i32 @printSMIX(i32 %8, i32 %31, i32 %2, i32 %3)
%38 = add nuw nsw i32 %28, 1
%39 = icmp eq i32 %38, %1
br i1 %39, label %40, label %27
40: ; preds = %36, %26
%41 = phi i32 [ %12, %26 ], [ %31, %36 ]
%42 = add nuw nsw i32 %13, 1
%43 = icmp eq i32 %41, 0
%44 = select i1 %43, i32 0, i32 %42
%45 = tail call i32 @printNEXT(i32 %8, i32 %44, i32 %3)
%46 = tail call i32 @tabs(i32 %8)
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
br i1 %43, label %48, label %11
48: ; preds = %40
ret void
}