#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*/ printf(char *, ...);
void main() {
  int man[13] = {0};
  int order[13];
  int cursor, idx, step, i;
  cursor = idx = step = i = 0;
  while (1) {
    while (1) {
      if (cursor == 13)
        cursor = 0;
      if (man[cursor] == 0)
        step++;
      if (step == 3) {
        step = 0;
        break;
      }
      cursor++;
    }
    man[cursor] = 1;
    order[idx++] = cursor % 13;
    cursor++;
    if (idx == 13)
      break;
  }
  printf("the number of man by order:\n");
  for (; i < 13; i++)
    printf("order[%d] = %d\n", i, order[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x34,%edx
call   1040 <memset@plt>
movl   $0x0,-0x90(%rbp)
movl   $0x0,-0x8c(%rbp)
movl   $0x0,-0x88(%rbp)
movl   $0x0,-0x84(%rbp)
jmp    1168 <main+0x48>
cmpl   $0xd,-0x84(%rbp)
jne    117f <main+0x5f>
movl   $0x0,-0x84(%rbp)
movslq -0x84(%rbp),%rax
cmpl   $0x0,-0x40(%rbp,%rax,4)
jne    11a0 <main+0x80>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
cmpl   $0x3,-0x8c(%rbp)
jne    11bc <main+0x9c>
movl   $0x0,-0x8c(%rbp)
jmp    11d0 <main+0xb0>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1168 <main+0x48>
movslq -0x84(%rbp),%rax
movl   $0x1,-0x40(%rbp,%rax,4)
mov    -0x84(%rbp),%eax
mov    $0xd,%ecx
cltd
idiv   %ecx
mov    -0x88(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x88(%rbp)
cltq
mov    %edx,-0x80(%rbp,%rax,4)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
cmpl   $0xd,-0x88(%rbp)
jne    1225 <main+0x105>
jmp    122a <main+0x10a>
jmp    1163 <main+0x43>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xd,-0x90(%rbp)
jge    1278 <main+0x158>
mov    -0x90(%rbp),%esi
movslq -0x90(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%edx
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    1238 <main+0x118>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movl   $0x0,0x70(%rsp)
xor    %eax,%eax
xor    %ecx,%ecx
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0xd,%edx
cmove  %eax,%edx
movslq %edx,%rsi
cmpl   $0x1,0x40(%rsp,%rsi,4)
adc    $0x0,%edi
lea    0x1(%rsi),%edx
cmp    $0x3,%edi
jne    1160 <main+0x40>
movl   $0x1,0x40(%rsp,%rsi,4)
imul   $0x4ec4ec4f,%rsi,%rdi
mov    %rdi,%rbx
shr    $0x3f,%rbx
sar    $0x22,%rdi
add    %ebx,%edi
lea    (%rdi,%rdi,2),%ebx
lea    (%rdi,%rbx,4),%edi
sub    %edi,%esi
mov    %esi,(%rsp,%rcx,4)
add    $0x1,%rcx
cmp    $0xd,%rcx
jne    1150 <main+0x30>
lea    0xe5f(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%edx
lea    0xe40(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rsp),%edx
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2c(%rsp),%edx
mov    %rbx,%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x30(%rsp),%edx
mov    %rbx,%rdi
mov    $0xc,%esi
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"the number of man by order:\0A\00"
@.str.1 = [16 x i8] c"order[%d] = %d\0A\00"
define void @main() {
%1 = alloca [13 x i32]
%2 = alloca [13 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast [13 x i32]* %1 to i8*
store i32 0, i32* %6
store i32 0, i32* %5
store i32 0, i32* %4
store i32 0, i32* %3
br label %8
8: ; preds = %0, %44
br label %9
9: ; preds = %8, %26
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 13
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 0, i32* %3
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %22
22: ; preds = %19, %13
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 0, i32* %5
br label %29
26: ; preds = %22
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %9
29: ; preds = %25
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 %31
store i32 1, i32* %32
%33 = load i32, i32* %3
%34 = srem i32 %33, 13
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
%37 = sext i32 %35 to i64
%38 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 %37
store i32 %34, i32* %38
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
%41 = load i32, i32* %4
%42 = icmp eq i32 %41, 13
br i1 %42, label %43, label %44
43: ; preds = %29
br label %45
44: ; preds = %29
br label %8
45: ; preds = %43
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %47
47: ; preds = %57, %45
%48 = load i32, i32* %6
%49 = icmp slt i32 %48, 13
br i1 %49, label %50, label %60
50: ; preds = %47
%51 = load i32, i32* %6
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %51, i32 %55)
br label %57
57: ; preds = %50
%58 = load i32, i32* %6
%59 = add nsw i32 %58, 1
store i32 %59, i32* %6
br label %47
60: ; preds = %47
ret void
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"order[%d] = %d\0A\00"
@str = [28 x i8] c"the number of man by order:\00"
define void @main() {
%1 = alloca [13 x i32]
%2 = alloca [13 x i32]
%3 = bitcast [13 x i32]* %1 to i8*
%4 = bitcast [13 x i32]* %2 to i8*
br label %5
5: ; preds = %21, %0
%6 = phi i64 [ %24, %21 ], [ 0, %0 ]
%7 = phi i32 [ %20, %21 ], [ 0, %0 ]
br label %8
8: ; preds = %8, %5
%9 = phi i32 [ %7, %5 ], [ %20, %8 ]
%10 = phi i32 [ 0, %5 ], [ %18, %8 ]
%11 = icmp eq i32 %9, 13
%12 = select i1 %11, i32 0, i32 %9
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
%18 = add nuw nsw i32 %10, %17
%19 = icmp eq i32 %18, 3
%20 = add nsw i32 %12, 1
br i1 %19, label %21, label %8
21: ; preds = %8
%22 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 %13
store i32 1, i32* %22
%23 = srem i32 %12, 13
%24 = add nuw nsw i64 %6, 1
%25 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 %6
store i32 %23, i32* %25
%26 = icmp eq i64 %24, 13
br i1 %26, label %27, label %5
27: ; preds = %21
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%29 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 0
%30 = load i32, i32* %29
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %30)
%32 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 1
%33 = load i32, i32* %32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %33)
%35 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 2
%36 = load i32, i32* %35
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %36)
%38 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 3
%39 = load i32, i32* %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %39)
%41 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 4
%42 = load i32, i32* %41
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %42)
%44 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 5
%45 = load i32, i32* %44
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 %45)
%47 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 6
%48 = load i32, i32* %47
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %48)
%50 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 7
%51 = load i32, i32* %50
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %51)
%53 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 8
%54 = load i32, i32* %53
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 %54)
%56 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 9
%57 = load i32, i32* %56
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 9, i32 %57)
%59 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 10
%60 = load i32, i32* %59
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 %60)
%62 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 11
%63 = load i32, i32* %62
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 11, i32 %63)
%65 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 12
%66 = load i32, i32* %65
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 12, i32 %66)
ret void
}