#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 *, int);
int strlen(char *);
int main(void) {
  char fat100[] = "933262154439441526816992388562667004907159682643816214685929"
                  "638952175999932299156089414639761565182862536979208272237582"
                  "51185210916864000000000000000000000000";
  int soma = 0, i;
  for (i = 0; i < strlen(fat100); i++) {
    soma += (fat100[i] - 48);
  }
  printf("Soma: %d\n", soma);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xb0(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x9f,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0xb4(%rbp)
movl   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
mov    %eax,-0xbc(%rbp)
lea    -0xb0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xbc(%rbp),%eax
cmp    %ecx,%eax
jge    11c8 <main+0x98>
movslq -0xb8(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%eax
ff
sub    $0x30,%eax
add    -0xb4(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    116e <main+0x3e>
mov    -0xb4(%rbp),%esi
lea    0xeca(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xa0,%rsp
lea    0xebd(%rip),%rsi
mov    %rsp,%rbx
mov    $0x9f,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1190 <main+0x60>
xor    %ebx,%ebx
mov    %rsp,%r14
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
movsbl (%rsp,%rbx,1),%eax
add    %eax,%r15d
add    $0xffffffd0,%r15d
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1170 <main+0x40>
jmp    1193 <main+0x63>
xor    %r15d,%r15d
lea    0xf05(%rip),%rdi
mov    %r15d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.fat100 = [159 x i8] c"93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000\00"
@.str = [10 x i8] c"Soma: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [159 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [159 x i8]* %2 to i8*
store i32 0, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %20, %0
%7 = load i32, i32* %4
%8 = getelementptr inbounds [159 x i8], [159 x i8]* %2, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = icmp slt i32 %7, %9
br i1 %10, label %11, label %23
11: ; preds = %6
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [159 x i8], [159 x i8]* %2, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = sub nsw i32 %16, 48
%18 = load i32, i32* %3
%19 = add nsw i32 %18, %17
store i32 %19, i32* %3
br label %20
20: ; preds = %11
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %6
23: ; preds = %6
%24 = load i32, i32* %3
%25 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %24)
ret i32 0
}

LLVM IR (-O2):
@__const.main.fat100 = [159 x i8] c"93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000\00"
@.str = [10 x i8] c"Soma: %d\0A\00"
define i32 @main() {
%1 = alloca [159 x i8]
%2 = getelementptr inbounds [159 x i8], [159 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen(i8* %2)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %17
5: ; preds = %0, %5
%6 = phi i64 [ %13, %5 ], [ 0, %0 ]
%7 = phi i32 [ %12, %5 ], [ 0, %0 ]
%8 = getelementptr inbounds [159 x i8], [159 x i8]* %1, i64 0, i64 %6
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = add i32 %7, -48
%12 = add i32 %11, %10
%13 = add nuw nsw i64 %6, 1
%14 = call i32 @strlen(i8* %2)
%15 = sext i32 %14 to i64
%16 = icmp slt i64 %13, %15
br i1 %16, label %5, label %17
17: ; preds = %5, %0
%18 = phi i32 [ 0, %0 ], [ %12, %5 ]
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %18)
ret i32 0
}