#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, int, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, b, c, i = 0;
  scanf("%d", &n);
  for (c = 0; c <= n / 5; ++c)
    for (b = 0; b <= (n - c * 5) / 2; ++b)
      printf("%03d%12d%12d%12d\n", ++i, n - b * 2 - c * 5, b, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jg     11e4 <main+0xc4>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
imul   $0x5,-0x10(%rbp),%ecx
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jg     11d1 <main+0xb1>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    %eax,%edx
imul   $0x5,-0x10(%rbp),%eax
sub    %eax,%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1172 <main+0x52>
jmp    11d6 <main+0xb6>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114d <main+0x2d>
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    0xece(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%edx
cmp    $0xfffffffc,%edx
jge    1153 <main+0x33>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r12d,%r12d
lea    0xea6(%rip),%r14
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    119c <main+0x7c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x1(%r15),%eax
movslq %edx,%rcx
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x21,%rcx
add    %esi,%ecx
mov    0x4(%rsp),%r12d
add    $0xfffffffb,%r12d
cmp    %ecx,%r15d
mov    %eax,%r15d
jge    1142 <main+0x22>
lea    (%r15,%r15,4),%r13d
mov    %edx,%eax
sub    %r13d,%eax
cmp    $0xffffffff,%eax
mov    %r12d,0x4(%rsp)
jl     1170 <main+0x50>
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
add    $0x1,%ebx
add    %r12d,%edx
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%ecx
mov    %r15d,%r8d
call   1030 <printf@plt>
mov    (%rsp),%edx
mov    %edx,%eax
sub    %r13d,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
add    $0xfffffffe,%r12d
cmp    %ecx,%ebx
jl     11c0 <main+0xa0>
jmp    1170 <main+0x50>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [18 x i8] c"%03d%12d%12d%12d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, -4
br i1 %5, label %33, label %6
6: ; preds = %0, %27
%7 = phi i32 [ %28, %27 ], [ %4, %0 ]
%8 = phi i32 [ %29, %27 ], [ 0, %0 ]
%9 = phi i32 [ %30, %27 ], [ 0, %0 ]
%10 = mul nuw nsw i32 %9, 5
%11 = sub nsw i32 %7, %10
%12 = icmp slt i32 %11, -1
br i1 %12, label %27, label %13
13: ; preds = %6, %13
%14 = phi i32 [ %23, %13 ], [ %7, %6 ]
%15 = phi i32 [ %17, %13 ], [ %8, %6 ]
%16 = phi i32 [ %22, %13 ], [ 0, %6 ]
%17 = add nsw i32 %15, 1
%18 = mul nsw i32 %16, -2
%19 = sub i32 %18, %10
%20 = add i32 %19, %14
%21 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %20, i32 %16, i32 %9)
%22 = add nuw nsw i32 %16, 1
%23 = load i32, i32* %1
%24 = sub nsw i32 %23, %10
%25 = sdiv i32 %24, 2
%26 = icmp slt i32 %16, %25
br i1 %26, label %13, label %27
27: ; preds = %13, %6
%28 = phi i32 [ %7, %6 ], [ %23, %13 ]
%29 = phi i32 [ %8, %6 ], [ %17, %13 ]
%30 = add nuw nsw i32 %9, 1
%31 = sdiv i32 %28, 5
%32 = icmp slt i32 %9, %31
br i1 %32, label %6, label %33
33: ; preds = %27, %0
ret i32 0
}