#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*/ free(char *);
char *mpz_get_str(int /*<<< orphan*/ *, 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 strlen(char *);
int main(int argc, char **argv) {
  mpz_t c;
  char *s;
  int a, b, i, n, m = 0;
  mpz_init(c);
  for (a = 1; a < 100; a++) {
    for (b = 1; b < 100; b++) {
      n = 0;
      mpz_ui_pow_ui(c, a, b);
      s = mpz_get_str(NULL, 10, c);
      for (i = 0; i < strlen(s); i++)
        n += s[i] - '0';
      if (n > m)
        m = n;
      free(s);
    }
  }
  printf("%d\n", m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <mpz_init@plt>
movl   $0x1,-0x24(%rbp)
cmpl   $0x64,-0x24(%rbp)
jge    1253 <main+0xf3>
movl   $0x1,-0x28(%rbp)
cmpl   $0x64,-0x28(%rbp)
jge    1240 <main+0xe0>
movl   $0x0,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1080 <mpz_ui_pow_ui@plt>
mov    -0x14(%rbp),%edx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xa,%esi
call   1070 <mpz_get_str@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
cmp    %ecx,%eax
jge    1217 <main+0xb7>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11d8 <main+0x78>
mov    -0x30(%rbp),%eax
cmp    -0x34(%rbp),%eax
jle    1229 <main+0xc9>
mov    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119d <main+0x3d>
jmp    1245 <main+0xe5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118c <main+0x2c>
mov    -0x34(%rbp),%esi
lea    0xda3(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
call   1060 <mpz_init@plt>
mov    $0x1,%r14d
xor    %r15d,%r15d
jmp    118e <main+0x2e>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14d
cmp    $0x64,%r14d
je     1210 <main+0xb0>
mov    $0x1,%r12d
jmp    11b9 <main+0x59>
cs nopw 0x0(%rax,%rax,1)
cmp    %r15d,%ebp
cmovg  %ebp,%r15d
mov    %r13,%rdi
call   1030 <free@plt>
add    $0x1,%r12d
cmp    $0x64,%r12d
je     1180 <main+0x20>
mov    %r14d,%esi
mov    %r12d,%edx
call   1080 <mpz_ui_pow_ui@plt>
xor    %ebp,%ebp
xor    %edi,%edi
mov    $0xa,%esi
call   1070 <mpz_get_str@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11a0 <main+0x40>
xor    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x0(%r13,%rbx,1),%eax
add    %eax,%ebp
add    $0xffffffd0,%ebp
add    $0x1,%rbx
mov    %r13,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     11f0 <main+0x90>
jmp    11a0 <main+0x40>
lea    0xde9(%rip),%rdi
mov    %r15d,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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