#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_get_str(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_ui_pow_ui(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int max_sum = 0;
  for (int a = 90; a < 100; a++) {
    for (int b = 90; b < 100; b++) {
      mpz_t c;
      mpz_init(c);
      mpz_ui_pow_ui(c, a, b);
      int sum = 0;
      char digits[1024] = {0};
      mpz_get_str(digits, 10, c);
      for (char *p = digits; *p != '\0'; p++) {
        sum += (*p) - 48;
      }
      if (sum > max_sum) {
        max_sum = sum;
      }
    }
  }
  printf("%i", max_sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x5a,-0x18(%rbp)
cmpl   $0x64,-0x18(%rbp)
jge    1259 <main+0x109>
movl   $0x5a,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jge    1246 <main+0xf6>
mov    -0x20(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1070 <mpz_ui_pow_ui@plt>
movl   $0x0,-0x24(%rbp)
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
lea    -0x430(%rbp),%rdi
mov    -0x20(%rbp),%edx
mov    $0xa,%esi
call   1060 <mpz_get_str@plt>
lea    -0x430(%rbp),%rax
mov    %rax,-0x438(%rbp)
mov    -0x438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1221 <main+0xd1>
mov    -0x438(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x438(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x438(%rbp)
jmp    11e4 <main+0x94>
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1233 <main+0xe3>
mov    -0x24(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1238 <main+0xe8>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1188 <main+0x38>
jmp    124b <main+0xfb>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1177 <main+0x27>
mov    -0x14(%rbp),%esi
lea    0xd9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
xor    %r13d,%r13d
mov    $0x5a,%r15d
lea    0x1(%rsp),%r12
mov    %rsp,%r14
jmp    118a <main+0x3a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r15d
cmp    $0x64,%r15d
je     1205 <main+0xb5>
mov    $0x5a,%ebp
jmp    11af <main+0x5f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %r13d,%ebx
cmovg  %ebx,%r13d
add    $0x1,%ebp
cmp    $0x64,%ebp
je     1180 <main+0x30>
call   1050 <mpz_init@plt>
mov    %r15d,%esi
mov    %ebp,%edx
call   1070 <mpz_ui_pow_ui@plt>
xor    %ebx,%ebx
mov    $0x400,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %r14,%rdi
mov    $0xa,%esi
call   1060 <mpz_get_str@plt>
mov    (%rsp),%al
test   %al,%al
je     11a0 <main+0x50>
xor    %ebx,%ebx
mov    %r12,%rcx
nopl   0x0(%rax,%rax,1)
movsbl %al,%eax
add    %eax,%ebx
add    $0xffffffd0,%ebx
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    11f0 <main+0xa0>
jmp    11a0 <main+0x50>
lea    0xdf4(%rip),%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %2, %10
%6 = phi i32 [ 90, %2 ], [ %11, %10 ]
%7 = phi i32 [ 0, %2 ], [ %24, %10 ]
br label %13
8: ; preds = %10
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %24)
ret i32 0
10: ; preds = %21
%11 = add nuw nsw i32 %6, 1
%12 = icmp eq i32 %11, 100
br i1 %12, label %8, label %5
13: ; preds = %5, %21
%14 = phi i32 [ 90, %5 ], [ %25, %21 ]
%15 = phi i32 [ %7, %5 ], [ %24, %21 ]
%16 = call i32 @mpz_init(i32 undef)
%17 = call i32 @mpz_ui_pow_ui(i32 undef, i32 %6, i32 %14)
%18 = call i32 @mpz_get_str(i8* %4, i32 10, i32 undef)
%19 = load i8, i8* %4
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %27, %13
%22 = phi i32 [ 0, %13 ], [ %33, %27 ]
%23 = icmp sgt i32 %22, %15
%24 = select i1 %23, i32 %22, i32 %15
%25 = add nuw nsw i32 %14, 1
%26 = icmp eq i32 %25, 100
br i1 %26, label %10, label %13
27: ; preds = %13, %27
%28 = phi i8 [ %35, %27 ], [ %19, %13 ]
%29 = phi i8* [ %34, %27 ], [ %4, %13 ]
%30 = phi i32 [ %33, %27 ], [ 0, %13 ]
%31 = sext i8 %28 to i32
%32 = add i32 %30, -48
%33 = add i32 %32, %31
%34 = getelementptr inbounds i8, i8* %29, i64 1
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, 0
br i1 %36, label %21, label %27
}