#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*/ calc_six_rotations(char, char);
int /*<<< orphan*/ flip_piece(char);
void calc_pieces(void) {
  char piece, index;
  for (piece = 0; piece < 10; piece++) {
    for (index = 0; index < 50; index++) {
      calc_six_rotations(piece, index);
      flip_piece(piece);
      calc_six_rotations(piece, index);
    }
  }
}


x86 assembly (clang, -O0):
<calc_pieces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
jge    1190 <calc_pieces+0x70>
movb   $0x0,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x32,%eax
jge    117e <calc_pieces+0x5e>
mov    -0x1(%rbp),%al
movsbl %al,%edi
movsbl -0x2(%rbp),%esi
call   1040 <calc_six_rotations@plt>
movsbl -0x1(%rbp),%edi
call   1030 <flip_piece@plt>
mov    -0x1(%rbp),%al
movsbl %al,%edi
movsbl -0x2(%rbp),%esi
call   1040 <calc_six_rotations@plt>
mov    -0x2(%rbp),%al
add    $0x1,%al
mov    %al,-0x2(%rbp)
jmp    113d <calc_pieces+0x1d>
jmp    1183 <calc_pieces+0x63>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
jmp    112c <calc_pieces+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_pieces>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %bl,%ebx
xor    %edi,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
xor    %edi,%edi
call   1030 <flip_piece@plt>
xor    %edi,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
add    $0x1,%bl
cmp    $0x32,%bl
jne    1130 <calc_pieces+0x10>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl %bl,%ebx
mov    $0x1,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
mov    $0x1,%edi
call   1030 <flip_piece@plt>
mov    $0x1,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
add    $0x1,%bl
cmp    $0x32,%bl
jne    1160 <calc_pieces+0x40>
xor    %ebx,%ebx
nop
movsbl %bl,%ebx
mov    $0x2,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
mov    $0x2,%edi
call   1030 <flip_piece@plt>
mov    $0x2,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
add    $0x1,%bl
cmp    $0x32,%bl
jne    1190 <calc_pieces+0x70>
xor    %ebx,%ebx
nop
movsbl %bl,%ebx
mov    $0x3,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
mov    $0x3,%edi
call   1030 <flip_piece@plt>
mov    $0x3,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
add    $0x1,%bl
cmp    $0x32,%bl
jne    11c0 <calc_pieces+0xa0>
xor    %ebx,%ebx
nop
movsbl %bl,%ebx
mov    $0x4,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
mov    $0x4,%edi
call   1030 <flip_piece@plt>
mov    $0x4,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
add    $0x1,%bl
cmp    $0x32,%bl
jne    11f0 <calc_pieces+0xd0>
xor    %ebx,%ebx
nop
movsbl %bl,%ebx
mov    $0x5,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
mov    $0x5,%edi
call   1030 <flip_piece@plt>
mov    $0x5,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
add    $0x1,%bl
cmp    $0x32,%bl
jne    1220 <calc_pieces+0x100>
xor    %ebx,%ebx
nop
movsbl %bl,%ebx
mov    $0x6,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
mov    $0x6,%edi
call   1030 <flip_piece@plt>
mov    $0x6,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
add    $0x1,%bl
cmp    $0x32,%bl
jne    1250 <calc_pieces+0x130>
xor    %ebx,%ebx
nop
movsbl %bl,%ebx
mov    $0x7,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
mov    $0x7,%edi
call   1030 <flip_piece@plt>
mov    $0x7,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
add    $0x1,%bl
cmp    $0x32,%bl
jne    1280 <calc_pieces+0x160>
xor    %ebx,%ebx
nop
movsbl %bl,%ebx
mov    $0x8,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
mov    $0x8,%edi
call   1030 <flip_piece@plt>
mov    $0x8,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
add    $0x1,%bl
cmp    $0x32,%bl
jne    12b0 <calc_pieces+0x190>
xor    %ebx,%ebx
nop
movsbl %bl,%ebx
mov    $0x9,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
mov    $0x9,%edi
call   1030 <flip_piece@plt>
mov    $0x9,%edi
mov    %ebx,%esi
call   1040 <calc_six_rotations@plt>
add    $0x1,%bl
cmp    $0x32,%bl
jne    12e0 <calc_pieces+0x1c0>
pop    %rbx
ret

LLVM IR (-O0):
define void @calc_pieces() {
%1 = alloca i8
%2 = alloca i8
store i8 0, i8* %1
br label %3
3: ; preds = %25, %0
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %28
7: ; preds = %3
store i8 0, i8* %2
br label %8
8: ; preds = %21, %7
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp slt i32 %10, 50
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = load i8, i8* %1
%14 = load i8, i8* %2
%15 = call i32 @calc_six_rotations(i8 signext %13, i8 signext %14)
%16 = load i8, i8* %1
%17 = call i32 @flip_piece(i8 signext %16)
%18 = load i8, i8* %1
%19 = load i8, i8* %2
%20 = call i32 @calc_six_rotations(i8 signext %18, i8 signext %19)
br label %21
21: ; preds = %12
%22 = load i8, i8* %2
%23 = add i8 %22, 1
store i8 %23, i8* %2
br label %8
24: ; preds = %8
br label %25
25: ; preds = %24
%26 = load i8, i8* %1
%27 = add i8 %26, 1
store i8 %27, i8* %1
br label %3
28: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @calc_pieces() {
br label %1
1: ; preds = %0, %1
%2 = phi i8 [ 0, %0 ], [ %6, %1 ]
%3 = tail call i32 @calc_six_rotations(i8 signext 0, i8 signext %2)
%4 = tail call i32 @flip_piece(i8 signext 0)
%5 = tail call i32 @calc_six_rotations(i8 signext 0, i8 signext %2)
%6 = add nuw nsw i8 %2, 1
%7 = icmp eq i8 %6, 50
br i1 %7, label %8, label %1
8: ; preds = %1, %8
%9 = phi i8 [ %13, %8 ], [ 0, %1 ]
%10 = tail call i32 @calc_six_rotations(i8 signext 1, i8 signext %9)
%11 = tail call i32 @flip_piece(i8 signext 1)
%12 = tail call i32 @calc_six_rotations(i8 signext 1, i8 signext %9)
%13 = add nuw nsw i8 %9, 1
%14 = icmp eq i8 %13, 50
br i1 %14, label %15, label %8
15: ; preds = %8, %15
%16 = phi i8 [ %20, %15 ], [ 0, %8 ]
%17 = tail call i32 @calc_six_rotations(i8 signext 2, i8 signext %16)
%18 = tail call i32 @flip_piece(i8 signext 2)
%19 = tail call i32 @calc_six_rotations(i8 signext 2, i8 signext %16)
%20 = add nuw nsw i8 %16, 1
%21 = icmp eq i8 %20, 50
br i1 %21, label %22, label %15
22: ; preds = %15, %22
%23 = phi i8 [ %27, %22 ], [ 0, %15 ]
%24 = tail call i32 @calc_six_rotations(i8 signext 3, i8 signext %23)
%25 = tail call i32 @flip_piece(i8 signext 3)
%26 = tail call i32 @calc_six_rotations(i8 signext 3, i8 signext %23)
%27 = add nuw nsw i8 %23, 1
%28 = icmp eq i8 %27, 50
br i1 %28, label %29, label %22
29: ; preds = %22, %29
%30 = phi i8 [ %34, %29 ], [ 0, %22 ]
%31 = tail call i32 @calc_six_rotations(i8 signext 4, i8 signext %30)
%32 = tail call i32 @flip_piece(i8 signext 4)
%33 = tail call i32 @calc_six_rotations(i8 signext 4, i8 signext %30)
%34 = add nuw nsw i8 %30, 1
%35 = icmp eq i8 %34, 50
br i1 %35, label %36, label %29
36: ; preds = %29, %36
%37 = phi i8 [ %41, %36 ], [ 0, %29 ]
%38 = tail call i32 @calc_six_rotations(i8 signext 5, i8 signext %37)
%39 = tail call i32 @flip_piece(i8 signext 5)
%40 = tail call i32 @calc_six_rotations(i8 signext 5, i8 signext %37)
%41 = add nuw nsw i8 %37, 1
%42 = icmp eq i8 %41, 50
br i1 %42, label %43, label %36
43: ; preds = %36, %43
%44 = phi i8 [ %48, %43 ], [ 0, %36 ]
%45 = tail call i32 @calc_six_rotations(i8 signext 6, i8 signext %44)
%46 = tail call i32 @flip_piece(i8 signext 6)
%47 = tail call i32 @calc_six_rotations(i8 signext 6, i8 signext %44)
%48 = add nuw nsw i8 %44, 1
%49 = icmp eq i8 %48, 50
br i1 %49, label %50, label %43
50: ; preds = %43, %50
%51 = phi i8 [ %55, %50 ], [ 0, %43 ]
%52 = tail call i32 @calc_six_rotations(i8 signext 7, i8 signext %51)
%53 = tail call i32 @flip_piece(i8 signext 7)
%54 = tail call i32 @calc_six_rotations(i8 signext 7, i8 signext %51)
%55 = add nuw nsw i8 %51, 1
%56 = icmp eq i8 %55, 50
br i1 %56, label %57, label %50
57: ; preds = %50, %57
%58 = phi i8 [ %62, %57 ], [ 0, %50 ]
%59 = tail call i32 @calc_six_rotations(i8 signext 8, i8 signext %58)
%60 = tail call i32 @flip_piece(i8 signext 8)
%61 = tail call i32 @calc_six_rotations(i8 signext 8, i8 signext %58)
%62 = add nuw nsw i8 %58, 1
%63 = icmp eq i8 %62, 50
br i1 %63, label %64, label %57
64: ; preds = %57, %64
%65 = phi i8 [ %69, %64 ], [ 0, %57 ]
%66 = tail call i32 @calc_six_rotations(i8 signext 9, i8 signext %65)
%67 = tail call i32 @flip_piece(i8 signext 9)
%68 = tail call i32 @calc_six_rotations(i8 signext 9, i8 signext %65)
%69 = add nuw nsw i8 %65, 1
%70 = icmp eq i8 %69, 50
br i1 %70, label %71, label %64
71: ; preds = %64
ret void
}