#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*/ puts(char *);
int main(void) {
  unsigned short int x;
  x = 0;
  while (x++ < 20) {
    printf("%3u", x);
    if (0 == (x % 5)) {
      puts("");
    } else {
      printf("%s", "\t");
    }
  }
  puts("");
  for (x = 1; x <= 20; x++) {
    printf("%3u", x);
    if (0 == x % 5) {
      puts("");
    } else {
      printf("%s", "\t");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x0,-0x6(%rbp)
mov    -0x6(%rbp),%ax
mov    %ax,%cx
add    $0x1,%cx
mov    %cx,-0x6(%rbp)
movzwl %ax,%eax
cmp    $0x14,%eax
jge    11a3 <main+0x83>
movzwl -0x6(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movzwl -0x6(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    %edx,%eax
jne    1189 <main+0x69>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
jmp    119e <main+0x7e>
lea    0xe74(%rip),%rdi
lea    0xe70(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1135 <main+0x15>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
movw   $0x1,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
cmp    $0x14,%eax
jg     1226 <main+0x106>
movzwl -0x6(%rbp),%esi
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movzwl -0x6(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    %edx,%eax
jne    11fb <main+0xdb>
lea    0xe17(%rip),%rdi
call   1030 <puts@plt>
jmp    1210 <main+0xf0>
lea    0xe02(%rip),%rdi
lea    0xdfe(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1215 <main+0xf5>
mov    -0x6(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x6(%rbp)
jmp    11b5 <main+0x95>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
mov    $0xff,%bpl
lea    0xeca(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
movzbl %bl,%eax
imul   $0xcd,%eax,%eax
shr    $0xa,%eax
lea    (%rax,%rax,4),%r15d
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
add    %bpl,%r15b
sete   %dil
add    $0x9,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
add    $0xff,%bpl
cmp    $0x15,%ebx
jne    1140 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebx
lea    0xe71(%rip),%r14
nop
movzwl %bx,%r15d
imul   $0xcccd,%r15d,%eax
shr    $0x12,%eax
lea    (%rax,%rax,4),%ebp
neg    %ebp
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
add    %bp,%r15w
sete   %dil
add    $0x9,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    $0x15,%ebx
jne    1190 <main+0x70>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%3u\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [2 x i8] c"\09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
store i32 0, i32* %1
store i16 0, i16* %2
br label %3
3: ; preds = %20, %0
%4 = load i16, i16* %2
%5 = add i16 %4, 1
store i16 %5, i16* %2
%6 = zext i16 %4 to i32
%7 = icmp slt i32 %6, 20
br i1 %7, label %8, label %21
8: ; preds = %3
%9 = load i16, i16* %2
%10 = zext i16 %9 to i32
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i16, i16* %2
%13 = zext i16 %12 to i32
%14 = srem i32 %13, 5
%15 = icmp eq i32 0, %14
br i1 %15, label %16, label %18
16: ; preds = %8
%17 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %20
18: ; preds = %8
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
br label %3
21: ; preds = %3
%22 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
store i16 1, i16* %2
br label %23
23: ; preds = %40, %21
%24 = load i16, i16* %2
%25 = zext i16 %24 to i32
%26 = icmp sle i32 %25, 20
br i1 %26, label %27, label %43
27: ; preds = %23
%28 = load i16, i16* %2
%29 = zext i16 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = load i16, i16* %2
%32 = zext i16 %31 to i32
%33 = srem i32 %32, 5
%34 = icmp eq i32 0, %33
br i1 %34, label %35, label %37
35: ; preds = %27
%36 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %39
37: ; preds = %27
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %37, %35
br label %40
40: ; preds = %39
%41 = load i16, i16* %2
%42 = add i16 %41, 1
store i16 %42, i16* %2
br label %23
43: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%3u\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %9, %1 ]
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = trunc i32 %2 to i8
%5 = urem i8 %4, 5
%6 = icmp eq i8 %5, 0
%7 = select i1 %6, i32 10, i32 9
%8 = tail call i32 @putchar(i32 %7)
%9 = add nuw nsw i32 %2, 1
%10 = icmp eq i32 %9, 21
br i1 %10, label %11, label %1
11: ; preds = %1
%12 = tail call i32 @putchar(i32 10)
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ 1, %11 ], [ %21, %13 ]
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = trunc i32 %14 to i16
%17 = urem i16 %16, 5
%18 = icmp eq i16 %17, 0
%19 = select i1 %18, i32 10, i32 9
%20 = tail call i32 @putchar(i32 %19)
%21 = add nuw nsw i32 %14, 1
%22 = icmp eq i32 %21, 21
br i1 %22, label %23, label %13
23: ; preds = %13
ret i32 0
}