#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 *, int /*<<< orphan*/);
void print_numbers(unsigned long int n) {
  unsigned long int i = 0;
  switch ((n + 1) % 4) {
  case 0:
    do {
      printf("%4lu ", i++);
    case 3:
      printf("%4lu ", i++);
    case 2:
      printf("%4lu ", i++);
    case 1:
      printf("%4lu\n", i++);
    } while (i < n);
  }
}


x86 assembly (clang, -O0):
<print_numbers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%eax
and    $0x3,%eax
mov    %rax,-0x18(%rbp)
sub    $0x3,%rax
ja     11dd <print_numbers+0xcd>
mov    -0x18(%rbp),%rax
lea    0xeb8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1156 <print_numbers+0x46>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    %eax,%esi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    %eax,%esi
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    %eax,%esi
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    %eax,%esi
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jb     1156 <print_numbers+0x46>
jmp    11dd <print_numbers+0xcd>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_numbers>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0x1(%rdi),%r15d
and    $0x3,%r15d
xor    %ebx,%ebx
lea    0xed7(%rip),%rax
movslq (%rax,%r15,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0x1(%r15),%rbx
lea    0xed3(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
lea    0x1(%rbx),%r15
lea    0xec0(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r15,%rbx
lea    0x1(%rbx),%r15
lea    0xeab(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r15,%rbx
lea    0x1(%rbx),%r15
lea    0xe9c(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
cmp    %r14,%r15
jb     1132 <print_numbers+0x22>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%4lu \00"
@.str.1 = [6 x i8] c"%4lu\0A\00"
define void @print_numbers(i64 %0) {
%2 = add i64 %0, 1
%3 = and i64 %2, 3
switch i64 %3, label %25 [
i64 0, label %4
i64 3, label %9
i64 2, label %14
i64 1, label %19
]
4: ; preds = %1, %19
%5 = phi i64 [ %21, %19 ], [ %3, %1 ]
%6 = add nuw i64 %5, 1
%7 = trunc i64 %5 to i32
%8 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %1, %4
%10 = phi i64 [ %6, %4 ], [ 0, %1 ]
%11 = add i64 %10, 1
%12 = trunc i64 %10 to i32
%13 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %1, %9
%15 = phi i64 [ %11, %9 ], [ 0, %1 ]
%16 = add i64 %15, 1
%17 = trunc i64 %15 to i32
%18 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %1, %14
%20 = phi i64 [ 0, %1 ], [ %16, %14 ]
%21 = add i64 %20, 1
%22 = trunc i64 %20 to i32
%23 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = icmp ult i64 %21, %0
br i1 %24, label %4, label %26
25: ; preds = %1
unreachable
26: ; preds = %19
ret void
}