#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 count;
int n;
int /*<<< orphan*/ printf(char *);
int main(void) {
  register count = 13;
  register n = (count + 7) / 8;
  switch (count % 8) {
  case 0:
    do {
      printf("0\n");
    case 7:
      printf("7\n");
    case 6:
      printf("6\n");
    case 5:
      printf("5\n");
    case 4:
      printf("4\n");
    case 3:
      printf("3\n");
    case 2:
      printf("2\n");
    case 1:
      printf("1\n");
      printf("loop\n");
    } while (--n > 0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xd,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    %ecx,%eax
add    $0x7,%eax
add    $0xe,%ecx
test   %eax,%eax
cmovs  %ecx,%eax
sar    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%edx
add    $0x7,%edx
test   %eax,%eax
mov    %eax,%ecx
cmovs  %edx,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x7,%eax
ja     11fb <main+0xeb>
mov    -0x18(%rbp),%rax
lea    0xe96(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1178 <main+0x68>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jg     1178 <main+0x68>
jmp    11fb <main+0xeb>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xede(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xed1(%rip),%r15
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%r12
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xeb7(%rip),%r13
mov    %r13,%rdi
call   1030 <puts@plt>
lea    0xeaa(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%rbp
mov    %rbp,%rdi
call   1030 <puts@plt>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"0\0A\00"
@.str.1 = [3 x i8] c"7\0A\00"
@.str.2 = [3 x i8] c"6\0A\00"
@.str.3 = [3 x i8] c"5\0A\00"
@.str.4 = [3 x i8] c"4\0A\00"
@.str.5 = [3 x i8] c"3\0A\00"
@.str.6 = [3 x i8] c"2\0A\00"
@.str.7 = [3 x i8] c"1\0A\00"
@.str.8 = [6 x i8] c"loop\0A\00"
@count = global i32 0
@n = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 13, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 7
%6 = sdiv i32 %5, 8
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = srem i32 %7, 8
switch i32 %8, label %32 [
i32 0, label %9
i32 7, label %12
i32 6, label %14
i32 5, label %16
i32 4, label %18
i32 3, label %20
i32 2, label %22
i32 1, label %24
]
9: ; preds = %0
br label %10
10: ; preds = %27, %9
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %0, %10
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %0, %12
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %0, %14
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %0, %16
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %0, %18
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %22
22: ; preds = %0, %20
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %24
24: ; preds = %0, %22
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %27
27: ; preds = %24
%28 = load i32, i32* %3
%29 = add nsw i32 %28, -1
store i32 %29, i32* %3
%30 = icmp sgt i32 %29, 0
br i1 %30, label %10, label %31
31: ; preds = %27
br label %32
32: ; preds = %31, %0
ret i32 0
}

LLVM IR (-O2):
@count = global i32 0
@n = global i32 0
@str = [2 x i8] c"5\00"
@str.9 = [2 x i8] c"4\00"
@str.10 = [2 x i8] c"3\00"
@str.11 = [2 x i8] c"2\00"
@str.12 = [2 x i8] c"1\00"
@str.13 = [5 x i8] c"loop\00"
@str.14 = [2 x i8] c"0\00"
@str.15 = [2 x i8] c"7\00"
@str.16 = [2 x i8] c"6\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.12, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.13, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.14, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.15, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.16, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.12, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.13, i64 0, i64 0))
ret i32 0
}