#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 */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ mpz_add(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_get_str(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_pow_ui(int /*<<< orphan*/, int /*<<< orphan*/,
                              unsigned long);
int /*<<< orphan*/ mpz_set_ui(int /*<<< orphan*/, unsigned long);
int /*<<< orphan*/ printf(char *, ...);
unsigned int strlen(char *);
int main(int argc, char *argv[]) {
  char str[(1000 * 1000)] = {0};
  unsigned len = 0;
  mpz_t counter;
  mpz_t result;
  mpz_t loc;
  mpz_init(counter);
  mpz_init(result);
  mpz_init(loc);
  for (unsigned long i = 1; i <= 1000; i++) {
    mpz_set_ui(counter, i);
    mpz_pow_ui(loc, counter, i);
    mpz_add(result, result, loc);
  }
  mpz_get_str(str, 10, result);
  mpz_clear(counter);
  mpz_clear(loc);
  mpz_clear(result);
  len = strlen(str) - 10;
  for (unsigned i = len; i < strlen(str); i++)
    printf("%c", str[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0xf4250(%rbp),%rdi
xor    %esi,%esi
mov    $0xf4240,%edx
call   1050 <memset@plt>
movl   $0x0,-0xf4254(%rbp)
mov    -0xf4258(%rbp),%edi
call   1060 <mpz_init@plt>
mov    -0xf425c(%rbp),%edi
call   1060 <mpz_init@plt>
mov    -0xf4260(%rbp),%edi
call   1060 <mpz_init@plt>
movq   $0x1,-0xf4268(%rbp)
cmpq   $0x3e8,-0xf4268(%rbp)
ja     125b <main+0xcb>
mov    -0xf4258(%rbp),%edi
mov    -0xf4268(%rbp),%rsi
call   10a0 <mpz_set_ui@plt>
mov    -0xf4260(%rbp),%edi
mov    -0xf4258(%rbp),%esi
mov    -0xf4268(%rbp),%rdx
call   1090 <mpz_pow_ui@plt>
mov    -0xf425c(%rbp),%edi
mov    -0xf425c(%rbp),%esi
mov    -0xf4260(%rbp),%edx
call   1080 <mpz_add@plt>
mov    -0xf4268(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf4268(%rbp)
jmp    11f2 <main+0x62>
lea    -0xf4250(%rbp),%rdi
mov    -0xf425c(%rbp),%edx
mov    $0xa,%esi
call   1070 <mpz_get_str@plt>
mov    -0xf4258(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0xf4260(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0xf425c(%rbp),%edi
call   10b0 <mpz_clear@plt>
lea    -0xf4250(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0xa,%eax
mov    %eax,-0xf4254(%rbp)
mov    -0xf4254(%rbp),%eax
mov    %eax,-0xf426c(%rbp)
mov    -0xf426c(%rbp),%eax
mov    %eax,-0xf4270(%rbp)
lea    -0xf4250(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xf4270(%rbp),%eax
cmp    %ecx,%eax
jae    130c <main+0x17c>
mov    -0xf426c(%rbp),%eax
movsbl -0xf4250(%rbp,%rax,1),%esi
ff
lea    0xd0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xf426c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf426c(%rbp)
jmp    12b4 <main+0x124>
lea    0xcf0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xf4270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xf4248,%rsp
mov    %rsp,%rdi
mov    $0xf4240,%edx
xor    %esi,%esi
call   1050 <memset@plt>
call   1060 <mpz_init@plt>
call   1060 <mpz_init@plt>
call   1060 <mpz_init@plt>
mov    $0x1,%ebx
nopl   (%rax)
mov    %rbx,%rsi
call   10a0 <mpz_set_ui@plt>
mov    %rbx,%rdx
call   1090 <mpz_pow_ui@plt>
call   1080 <mpz_add@plt>
add    $0x1,%rbx
cmp    $0x3e9,%rbx
jne    11c0 <main+0x30>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0xa,%esi
call   1070 <mpz_get_str@plt>
call   10b0 <mpz_clear@plt>
call   10b0 <mpz_clear@plt>
call   10b0 <mpz_clear@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebx
add    $0xfffffff6,%ebx
mov    %r14,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebx
jae    123c <main+0xac>
mov    %ebx,%ebx
mov    %rsp,%r14
nop
movsbl (%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%eax
cmp    %rax,%rbx
jb     1220 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0xf4248,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000000 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [1000000 x i8]* %6 to i8*
store i32 0, i32* %7
%14 = load i32, i32* %8
%15 = call i32 @mpz_init(i32 %14)
%16 = load i32, i32* %9
%17 = call i32 @mpz_init(i32 %16)
%18 = load i32, i32* %10
%19 = call i32 @mpz_init(i32 %18)
store i64 1, i64* %11
br label %20
20: ; preds = %35, %2
%21 = load i64, i64* %11
%22 = icmp ule i64 %21, 1000
br i1 %22, label %23, label %38
23: ; preds = %20
%24 = load i32, i32* %8
%25 = load i64, i64* %11
%26 = call i32 @mpz_set_ui(i32 %24, i64 %25)
%27 = load i32, i32* %10
%28 = load i32, i32* %8
%29 = load i64, i64* %11
%30 = call i32 @mpz_pow_ui(i32 %27, i32 %28, i64 %29)
%31 = load i32, i32* %9
%32 = load i32, i32* %9
%33 = load i32, i32* %10
%34 = call i32 @mpz_add(i32 %31, i32 %32, i32 %33)
br label %35
35: ; preds = %23
%36 = load i64, i64* %11
%37 = add i64 %36, 1
store i64 %37, i64* %11
br label %20
38: ; preds = %20
%39 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %6, i64 0, i64 0
%40 = load i32, i32* %9
%41 = call i32 @mpz_get_str(i8* %39, i32 10, i32 %40)
%42 = load i32, i32* %8
%43 = call i32 @mpz_clear(i32 %42)
%44 = load i32, i32* %10
%45 = call i32 @mpz_clear(i32 %44)
%46 = load i32, i32* %9
%47 = call i32 @mpz_clear(i32 %46)
%48 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %6, i64 0, i64 0
%49 = call i32 @strlen(i8* %48)
%50 = sub i32 %49, 10
store i32 %50, i32* %7
%51 = load i32, i32* %7
store i32 %51, i32* %12
br label %52
52: ; preds = %64, %38
%53 = load i32, i32* %12
%54 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %6, i64 0, i64 0
%55 = call i32 @strlen(i8* %54)
%56 = icmp ult i32 %53, %55
br i1 %56, label %57, label %67
57: ; preds = %52
%58 = load i32, i32* %12
%59 = zext i32 %58 to i64
%60 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %6, i64 0, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %62)
br label %64
64: ; preds = %57
%65 = load i32, i32* %12
%66 = add i32 %65, 1
store i32 %66, i32* %12
br label %52
67: ; preds = %52
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1000000 x i8]
%4 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @mpz_init(i32 undef)
%6 = tail call i32 @mpz_init(i32 undef)
%7 = tail call i32 @mpz_init(i32 undef)
br label %19
8: ; preds = %19
%9 = call i32 @mpz_get_str(i8* %4, i32 10, i32 undef)
%10 = call i32 @mpz_clear(i32 undef)
%11 = call i32 @mpz_clear(i32 undef)
%12 = call i32 @mpz_clear(i32 undef)
%13 = call i32 @strlen(i8* %4)
%14 = add i32 %13, -10
%15 = call i32 @strlen(i8* %4)
%16 = icmp ult i32 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %8
%18 = zext i32 %14 to i64
br label %28
19: ; preds = %2, %19
%20 = phi i64 [ 1, %2 ], [ %24, %19 ]
%21 = tail call i32 @mpz_set_ui(i32 undef, i64 %20)
%22 = tail call i32 @mpz_pow_ui(i32 undef, i32 undef, i64 %20)
%23 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%24 = add nuw nsw i64 %20, 1
%25 = icmp eq i64 %24, 1001
br i1 %25, label %8, label %19
26: ; preds = %28, %8
%27 = call i32 @putchar(i32 10)
ret i32 0
28: ; preds = %17, %28
%29 = phi i64 [ %18, %17 ], [ %34, %28 ]
%30 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %3, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = call i32 @putchar(i32 %32)
%34 = add nuw nsw i64 %29, 1
%35 = call i32 @strlen(i8* %4)
%36 = zext i32 %35 to i64
%37 = icmp ult i64 %34, %36
br i1 %37, label %28, label %26
}