#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*/ putchar(unsigned int);
int /*<<< orphan*/ puts(char *);
void main(void) {
  unsigned int i, j;
  unsigned int q, r;
  unsigned int d[2000 + 1];
  for (j = 0; j < 2000 + 1; j++) {
    d[j] = 1;
  }
  for (i = 0; i < 2000 - 1; i++) {
    for (j = 0; j < 2000 + 1; j++) {
      d[j] *= 10;
    }
    q = 0;
    for (j = 2000; j > 0; j--) {
      d[j] += q;
      q = d[j] / (j + 1);
      r = d[j] % (j + 1);
      d[j] = r;
    }
    putchar('0' + q);
  }
  puts("");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f60,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x7d1,-0x8(%rbp)
jae    115b <main+0x3b>
mov    -0x8(%rbp),%eax
movl   $0x1,-0x1f60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <main+0x12>
movl   $0x0,-0x4(%rbp)
cmpl   $0x7cf,-0x4(%rbp)
jae    1231 <main+0x111>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7d1,-0x8(%rbp)
jae    11a3 <main+0x83>
mov    -0x8(%rbp),%eax
imul   $0xa,-0x1f60(%rbp,%rax,4),%ecx
0a
mov    %ecx,-0x1f60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1176 <main+0x56>
movl   $0x0,-0xc(%rbp)
movl   $0x7d0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jbe    1218 <main+0xf8>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
add    -0x1f60(%rbp,%rax,4),%ecx
mov    %ecx,-0x1f60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    -0x1f60(%rbp,%rax,4),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x1f60(%rbp,%rax,4),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%eax
mov    %ecx,-0x1f60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    11b1 <main+0x91>
mov    -0xc(%rbp),%edi
add    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <main+0x42>
lea    0xdc8(%rip),%rdi
call   1040 <puts@plt>
add    $0x1f60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1f50,%rsp
mov    $0x24,%eax
movdqa 0xedb(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nop
movdqa %xmm0,-0x90(%rsp,%rax,4)
ff ff
movdqa %xmm0,-0x80(%rsp,%rax,4)
movdqa %xmm0,-0x70(%rsp,%rax,4)
movdqa %xmm0,-0x60(%rsp,%rax,4)
movdqa %xmm0,-0x50(%rsp,%rax,4)
movdqa %xmm0,-0x40(%rsp,%rax,4)
movdqa %xmm0,-0x30(%rsp,%rax,4)
movdqa %xmm0,-0x20(%rsp,%rax,4)
movdqa %xmm0,-0x10(%rsp,%rax,4)
movdqa %xmm0,(%rsp,%rax,4)
add    $0x28,%rax
cmp    $0x7f4,%rax
jne    1130 <main+0x20>
movl   $0x1,0x1f40(%rsp)
xor    %ebx,%ebx
movdqa 0xe81(%rip),%xmm5
nop
mov    $0xc,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movdqa -0x30(%rsp,%rax,4),%xmm1
movdqa -0x20(%rsp,%rax,4),%xmm2
movdqa -0x10(%rsp,%rax,4),%xmm3
movdqa (%rsp,%rax,4),%xmm0
pshufd $0xf5,%xmm1,%xmm4
pmuludq %xmm5,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm5,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm1
pshufd $0xf5,%xmm2,%xmm4
pmuludq %xmm5,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm5,%xmm4
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm2
movdqa %xmm1,-0x30(%rsp,%rax,4)
movdqa %xmm2,-0x20(%rsp,%rax,4)
pshufd $0xf5,%xmm3,%xmm1
pmuludq %xmm5,%xmm3
pshufd $0xe8,%xmm3,%xmm2
pmuludq %xmm5,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm1,%xmm2
pshufd $0xf5,%xmm0,%xmm1
pmuludq %xmm5,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm5,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
movdqa %xmm2,-0x10(%rsp,%rax,4)
movdqa %xmm0,(%rsp,%rax,4)
add    $0x10,%rax
cmp    $0x7dc,%rax
jne    11a0 <main+0x90>
mov    0x1f40(%rsp),%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
mov    %eax,0x1f40(%rsp)
xor    %eax,%eax
mov    $0x7d0,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    (%rsp,%rcx,4),%eax
lea    0x1(%rcx),%esi
xor    %edx,%edx
div    %esi
mov    %edx,(%rsp,%rcx,4)
add    $0xffffffffffffffff,%rcx
jne    1270 <main+0x160>
add    $0x30,%eax
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    $0x7cf,%ebx
movdqa 0xd72(%rip),%xmm5
jne    1190 <main+0x80>
mov    $0xa,%edi
add    $0x1f50,%rsp
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2001 x i32]
store i32 0, i32* %2
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %2
%8 = icmp ult i32 %7, 2001
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds [2001 x i32], [2001 x i32]* %5, i64 0, i64 %11
store i32 1, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %2
%15 = add i32 %14, 1
store i32 %15, i32* %2
br label %6
16: ; preds = %6
store i32 0, i32* %1
br label %17
17: ; preds = %69, %16
%18 = load i32, i32* %1
%19 = icmp ult i32 %18, 1999
br i1 %19, label %20, label %72
20: ; preds = %17
store i32 0, i32* %2
br label %21
21: ; preds = %30, %20
%22 = load i32, i32* %2
%23 = icmp ult i32 %22, 2001
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = load i32, i32* %2
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds [2001 x i32], [2001 x i32]* %5, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = mul i32 %28, 10
store i32 %29, i32* %27
br label %30
30: ; preds = %24
%31 = load i32, i32* %2
%32 = add i32 %31, 1
store i32 %32, i32* %2
br label %21
33: ; preds = %21
store i32 0, i32* %3
store i32 2000, i32* %2
br label %34
34: ; preds = %62, %33
%35 = load i32, i32* %2
%36 = icmp ugt i32 %35, 0
br i1 %36, label %37, label %65
37: ; preds = %34
%38 = load i32, i32* %3
%39 = load i32, i32* %2
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds [2001 x i32], [2001 x i32]* %5, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = add i32 %42, %38
store i32 %43, i32* %41
%44 = load i32, i32* %2
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds [2001 x i32], [2001 x i32]* %5, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = load i32, i32* %2
%49 = add i32 %48, 1
%50 = udiv i32 %47, %49
store i32 %50, i32* %3
%51 = load i32, i32* %2
%52 = zext i32 %51 to i64
%53 = getelementptr inbounds [2001 x i32], [2001 x i32]* %5, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = load i32, i32* %2
%56 = add i32 %55, 1
%57 = urem i32 %54, %56
store i32 %57, i32* %4
%58 = load i32, i32* %4
%59 = load i32, i32* %2
%60 = zext i32 %59 to i64
%61 = getelementptr inbounds [2001 x i32], [2001 x i32]* %5, i64 0, i64 %60
store i32 %58, i32* %61
br label %62
62: ; preds = %37
%63 = load i32, i32* %2
%64 = add i32 %63, -1
store i32 %64, i32* %2
br label %34
65: ; preds = %34
%66 = load i32, i32* %3
%67 = add i32 48, %66
%68 = call i32 @putchar(i32 %67)
br label %69
69: ; preds = %65
%70 = load i32, i32* %1
%71 = add i32 %70, 1
store i32 %71, i32* %1
br label %17
72: ; preds = %17
%73 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = alloca [2001 x i32]
%2 = bitcast [2001 x i32]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %29, %3 ]
%5 = getelementptr inbounds [2001 x i32], [2001 x i32]* %1, i64 0, i64 %4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %6
%7 = getelementptr inbounds i32, i32* %5, i64 4
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %8
%9 = add nuw nsw i64 %4, 8
%10 = getelementptr inbounds [2001 x i32], [2001 x i32]* %1, i64 0, i64 %9
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %11
%12 = getelementptr inbounds i32, i32* %10, i64 4
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %13
%14 = add nuw nsw i64 %4, 16
%15 = getelementptr inbounds [2001 x i32], [2001 x i32]* %1, i64 0, i64 %14
%16 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %16
%17 = getelementptr inbounds i32, i32* %15, i64 4
%18 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %18
%19 = add nuw nsw i64 %4, 24
%20 = getelementptr inbounds [2001 x i32], [2001 x i32]* %1, i64 0, i64 %19
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %21
%22 = getelementptr inbounds i32, i32* %20, i64 4
%23 = bitcast i32* %22 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %23
%24 = add nuw nsw i64 %4, 32
%25 = getelementptr inbounds [2001 x i32], [2001 x i32]* %1, i64 0, i64 %24
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %26
%27 = getelementptr inbounds i32, i32* %25, i64 4
%28 = bitcast i32* %27 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %28
%29 = add nuw nsw i64 %4, 40
%30 = icmp eq i64 %29, 2000
br i1 %30, label %31, label %3
31: ; preds = %3
%32 = getelementptr inbounds [2001 x i32], [2001 x i32]* %1, i64 0, i64 2000
store i32 1, i32* %32
%33 = getelementptr inbounds [2001 x i32], [2001 x i32]* %1, i64 0, i64 2000
br label %34
34: ; preds = %31, %76
%35 = phi i32 [ %79, %76 ], [ 0, %31 ]
br label %36
36: ; preds = %36, %34
%37 = phi i64 [ 0, %34 ], [ %59, %36 ]
%38 = getelementptr inbounds [2001 x i32], [2001 x i32]* %1, i64 0, i64 %37
%39 = bitcast i32* %38 to <4 x i32>*
%40 = load <4 x i32>, <4 x i32>* %39
%41 = getelementptr inbounds i32, i32* %38, i64 4
%42 = bitcast i32* %41 to <4 x i32>*
%43 = load <4 x i32>, <4 x i32>* %42
%44 = mul <4 x i32> %40, <i32 10, i32 10, i32 10, i32 10>
%45 = mul <4 x i32> %43, <i32 10, i32 10, i32 10, i32 10>
%46 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> %44, <4 x i32>* %46
%47 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> %45, <4 x i32>* %47
%48 = or i64 %37, 8
%49 = getelementptr inbounds [2001 x i32], [2001 x i32]* %1, i64 0, i64 %48
%50 = bitcast i32* %49 to <4 x i32>*
%51 = load <4 x i32>, <4 x i32>* %50
%52 = getelementptr inbounds i32, i32* %49, i64 4
%53 = bitcast i32* %52 to <4 x i32>*
%54 = load <4 x i32>, <4 x i32>* %53
%55 = mul <4 x i32> %51, <i32 10, i32 10, i32 10, i32 10>
%56 = mul <4 x i32> %54, <i32 10, i32 10, i32 10, i32 10>
%57 = bitcast i32* %49 to <4 x i32>*
store <4 x i32> %55, <4 x i32>* %57
%58 = bitcast i32* %52 to <4 x i32>*
store <4 x i32> %56, <4 x i32>* %58
%59 = add nuw nsw i64 %37, 16
%60 = icmp eq i64 %59, 2000
br i1 %60, label %61, label %36
61: ; preds = %36
%62 = load i32, i32* %33
%63 = mul i32 %62, 10
store i32 %63, i32* %33
br label %64
64: ; preds = %61, %64
%65 = phi i64 [ %74, %64 ], [ 2000, %61 ]
%66 = phi i32 [ %72, %64 ], [ 0, %61 ]
%67 = getelementptr inbounds [2001 x i32], [2001 x i32]* %1, i64 0, i64 %65
%68 = load i32, i32* %67
%69 = add i32 %68, %66
%70 = trunc i64 %65 to i32
%71 = add i32 %70, 1
%72 = udiv i32 %69, %71
%73 = urem i32 %69, %71
store i32 %73, i32* %67
%74 = add nsw i64 %65, -1
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %64
76: ; preds = %64
%77 = add i32 %72, 48
%78 = tail call i32 @putchar(i32 %77)
%79 = add nuw nsw i32 %35, 1
%80 = icmp eq i32 %79, 1999
br i1 %80, label %81, label %34
81: ; preds = %76
%82 = tail call i32 @putchar(i32 10)
ret void
}