#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 *, unsigned long long);
int main() {
  unsigned long long int carry, num[1000], sum, temp;
  long long int i, j;
  for (i = 0; i < 1000; i++)
    num[i] = 0;
  num[1000 - 1] = 1;
  sum = 0;
  carry = 0;
  for (j = 100; j > 0; j--) {
    for (i = 1000 - 1; i >= 0; i--) {
      num[i] *= j;
      num[i] += carry;
      temp = num[i];
      num[i] = temp % 10;
      carry = temp / 10;
    }
  }
  printf("\nSum is : %llu", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f70,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x1f68(%rbp)
cmpq   $0x3e8,-0x1f68(%rbp)
jge    1168 <main+0x58>
mov    -0x1f68(%rbp),%rax
movq   $0x0,-0x1f50(%rbp,%rax,8)
mov    -0x1f68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1f68(%rbp)
jmp    112d <main+0x1d>
movq   $0x1,-0x18(%rbp)
movq   $0x0,-0x1f58(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x64,-0x1f70(%rbp)
cmpq   $0x0,-0x1f70(%rbp)
jle    126d <main+0x15d>
movq   $0x3e7,-0x1f68(%rbp)
cmpq   $0x0,-0x1f68(%rbp)
jl     1251 <main+0x141>
mov    -0x1f70(%rbp),%rcx
mov    -0x1f68(%rbp),%rax
imul   -0x1f50(%rbp,%rax,8),%rcx
ff ff
mov    %rcx,-0x1f50(%rbp,%rax,8)
ff
mov    -0x10(%rbp),%rcx
mov    -0x1f68(%rbp),%rax
add    -0x1f50(%rbp,%rax,8),%rcx
ff
mov    %rcx,-0x1f50(%rbp,%rax,8)
ff
mov    -0x1f68(%rbp),%rax
mov    -0x1f50(%rbp,%rax,8),%rax
ff
mov    %rax,-0x1f60(%rbp)
mov    -0x1f60(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x1f68(%rbp),%rax
mov    %rdx,-0x1f50(%rbp,%rax,8)
ff
mov    -0x1f60(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
mov    -0x1f68(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x1f68(%rbp)
jmp    11a7 <main+0x97>
jmp    1256 <main+0x146>
mov    -0x1f70(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x1f70(%rbp)
jmp    118e <main+0x7e>
mov    -0x1f58(%rbp),%rsi
lea    0xd85(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1f70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1f40,%rsp
mov    %rsp,%rdi
xor    %ebx,%ebx
mov    $0x1f40,%edx
xor    %esi,%esi
call   1040 <memset@plt>
movq   $0x1,0x1f38(%rsp)
mov    $0x64,%esi
movabs $0xcccccccccccccccd,%r8
cc cc cc
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x3e7,%edi
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rsp,%rdi,8),%rcx
imul   %rsi,%rcx
add    %rbx,%rcx
mov    %rcx,%rax
mul    %r8
mov    %rdx,%rbx
shr    $0x3,%rbx
lea    (%rbx,%rbx,1),%rax
lea    (%rax,%rax,4),%rax
sub    %rax,%rcx
mov    %rcx,(%rsp,%rdi,8)
add    $0xffffffffffffffff,%rdi
jb     1170 <main+0x50>
lea    -0x1(%rsi),%rax
cmp    $0x1,%rsi
mov    %rax,%rsi
ja     1160 <main+0x40>
lea    0xe4f(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1f40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\0ASum is : %llu\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca [1000 x i64]
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %6
br label %8
8: ; preds = %14, %0
%9 = load i64, i64* %6
%10 = icmp slt i64 %9, 1000
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load i64, i64* %6
%13 = getelementptr inbounds [1000 x i64], [1000 x i64]* %3, i64 0, i64 %12
store i64 0, i64* %13
br label %14
14: ; preds = %11
%15 = load i64, i64* %6
%16 = add nsw i64 %15, 1
store i64 %16, i64* %6
br label %8
17: ; preds = %8
%18 = getelementptr inbounds [1000 x i64], [1000 x i64]* %3, i64 0, i64 999
store i64 1, i64* %18
store i64 0, i64* %4
store i64 0, i64* %2
store i64 100, i64* %7
br label %19
19: ; preds = %50, %17
%20 = load i64, i64* %7
%21 = icmp sgt i64 %20, 0
br i1 %21, label %22, label %53
22: ; preds = %19
store i64 999, i64* %6
br label %23
23: ; preds = %46, %22
%24 = load i64, i64* %6
%25 = icmp sge i64 %24, 0
br i1 %25, label %26, label %49
26: ; preds = %23
%27 = load i64, i64* %7
%28 = load i64, i64* %6
%29 = getelementptr inbounds [1000 x i64], [1000 x i64]* %3, i64 0, i64 %28
%30 = load i64, i64* %29
%31 = mul i64 %30, %27
store i64 %31, i64* %29
%32 = load i64, i64* %2
%33 = load i64, i64* %6
%34 = getelementptr inbounds [1000 x i64], [1000 x i64]* %3, i64 0, i64 %33
%35 = load i64, i64* %34
%36 = add i64 %35, %32
store i64 %36, i64* %34
%37 = load i64, i64* %6
%38 = getelementptr inbounds [1000 x i64], [1000 x i64]* %3, i64 0, i64 %37
%39 = load i64, i64* %38
store i64 %39, i64* %5
%40 = load i64, i64* %5
%41 = urem i64 %40, 10
%42 = load i64, i64* %6
%43 = getelementptr inbounds [1000 x i64], [1000 x i64]* %3, i64 0, i64 %42
store i64 %41, i64* %43
%44 = load i64, i64* %5
%45 = udiv i64 %44, 10
store i64 %45, i64* %2
br label %46
46: ; preds = %26
%47 = load i64, i64* %6
%48 = add nsw i64 %47, -1
store i64 %48, i64* %6
br label %23
49: ; preds = %23
br label %50
50: ; preds = %49
%51 = load i64, i64* %7
%52 = add nsw i64 %51, -1
store i64 %52, i64* %7
br label %19
53: ; preds = %19
%54 = load i64, i64* %4
%55 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 %54)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"\0ASum is : %llu\00"
define i32 @main() {
%1 = alloca [1000 x i64]
%2 = bitcast [1000 x i64]* %1 to i8*
%3 = getelementptr inbounds [1000 x i64], [1000 x i64]* %1, i64 0, i64 999
store i64 1, i64* %3
br label %4
4: ; preds = %0, %18
%5 = phi i64 [ 100, %0 ], [ %19, %18 ]
%6 = phi i64 [ 0, %0 ], [ %15, %18 ]
br label %7
7: ; preds = %4, %7
%8 = phi i64 [ 999, %4 ], [ %16, %7 ]
%9 = phi i64 [ %6, %4 ], [ %15, %7 ]
%10 = getelementptr inbounds [1000 x i64], [1000 x i64]* %1, i64 0, i64 %8
%11 = load i64, i64* %10
%12 = mul i64 %11, %5
%13 = add i64 %12, %9
%14 = urem i64 %13, 10
store i64 %14, i64* %10
%15 = udiv i64 %13, 10
%16 = add nsw i64 %8, -1
%17 = icmp eq i64 %8, 0
br i1 %17, label %18, label %7
18: ; preds = %7
%19 = add nsw i64 %5, -1
%20 = icmp ugt i64 %5, 1
br i1 %20, label %4, label %21
21: ; preds = %18
%22 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 0)
ret i32 0
}