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

/* Variables and functions */
int EOF;
int /*<<< orphan*/ _IONBF;
int /*<<< orphan*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  FILE *file;
  int c;
  int x = 0;
  int y = 0;
  int numbers[100][50];
  setvbuf(stdout, NULL, _IONBF, 0);
  file = fopen("number.txt", "r");
  if (file) {
    while ((c = getc(file)) != EOF) {
      numbers[x][y] = c - '0';
      y++;
      if (y == 50) {
        y = 0;
        x++;
      }
    }
  }
  uint64_t _12digits = 0;
  uint64_t result = 0;
  for (int i = 0; i < 100; i++) {
    uint64_t k = 1;
    for (int a = 10; a >= 0; a--) {
      _12digits += k * numbers[i][a];
      printf("%lld += %llu * %d\n", _12digits, k, numbers[i][a]);
      k = 10 * k;
    }
    result += _12digits;
    _12digits = 0;
  }
  printf("result: %lld", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
mov    0x2e69(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1040 <setvbuf@plt>
lea    0xe75(%rip),%rdi
lea    0xe79(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1215 <main+0xd5>
jmp    11ab <main+0x6b>
mov    -0x18(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e2a(%rip),%rcx
cmp    (%rcx),%eax
je     1210 <main+0xd0>
mov    -0x1c(%rbp),%edx
sub    $0x30,%edx
movslq -0x20(%rbp),%rcx
lea    -0x4e50(%rbp),%rax
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x32,-0x24(%rbp)
jne    120b <main+0xcb>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ab <main+0x6b>
jmp    1215 <main+0xd5>
movl   $0x0,-0x4e54(%rbp)
movl   $0x0,-0x4e58(%rbp)
movl   $0x0,-0x4e5c(%rbp)
cmpl   $0x64,-0x4e5c(%rbp)
jge    1323 <main+0x1e3>
movl   $0x1,-0x4e60(%rbp)
movl   $0xa,-0x4e64(%rbp)
cmpl   $0x0,-0x4e64(%rbp)
jl     12f3 <main+0x1b3>
mov    -0x4e60(%rbp),%eax
movslq -0x4e5c(%rbp),%rdx
lea    -0x4e50(%rbp),%rcx
imul   $0xc8,%rdx,%rdx
add    %rdx,%rcx
movslq -0x4e64(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
add    -0x4e54(%rbp),%eax
mov    %eax,-0x4e54(%rbp)
mov    -0x4e54(%rbp),%esi
mov    -0x4e60(%rbp),%edx
movslq -0x4e5c(%rbp),%rcx
lea    -0x4e50(%rbp),%rax
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x4e64(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xd42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
imul   $0xa,-0x4e60(%rbp),%eax
mov    %eax,-0x4e60(%rbp)
mov    -0x4e64(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4e64(%rbp)
jmp    1254 <main+0x114>
mov    -0x4e54(%rbp),%eax
add    -0x4e58(%rbp),%eax
mov    %eax,-0x4e58(%rbp)
movl   $0x0,-0x4e54(%rbp)
mov    -0x4e5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e5c(%rbp)
jmp    1233 <main+0xf3>
mov    -0x4e58(%rbp),%esi
lea    0xcf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4e70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x4e20,%rsp
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1040 <setvbuf@plt>
lea    0xe8f(%rip),%rdi
lea    0xe93(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     11d3 <main+0x93>
mov    %rax,%r12
mov    %rax,%rdi
call   1060 <getc@plt>
mov    0x2e54(%rip),%r14
cmp    (%r14),%eax
je     11d3 <main+0x93>
xor    %r15d,%r15d
xor    %ebp,%ebp
xor    %ebx,%ebx
add    $0xffffffd0,%eax
mov    %ebx,%ecx
movslq %ebp,%rbp
imul   $0xc8,%rcx,%rcx
add    %rsp,%rcx
mov    %eax,(%rcx,%rbp,4)
add    $0x1,%ebp
xor    %eax,%eax
cmp    $0x32,%ebp
sete   %al
cmove  %r15d,%ebp
add    %eax,%ebx
mov    %r12,%rdi
call   1060 <getc@plt>
cmp    (%r14),%eax
jne    11a0 <main+0x60>
mov    $0x28,%r12d
lea    0xe2d(%rip),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rsp,%r12,1),%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x4(%rsp,%r12,1),%ecx
lea    (%rcx,%rcx,4),%eax
lea    (%rbx,%rax,2),%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x8(%rsp,%r12,1),%ecx
imul   $0x64,%ecx,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x64,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0xc(%rsp,%r12,1),%ecx
imul   $0x3e8,%ecx,%ebx
add    %ebp,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x3e8,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x10(%rsp,%r12,1),%ecx
imul   $0x2710,%ecx,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x2710,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x14(%rsp,%r12,1),%ecx
imul   $0x186a0,%ecx,%ebx
add    %ebp,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x186a0,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x18(%rsp,%r12,1),%ecx
imul   $0xf4240,%ecx,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0xf4240,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x1c(%rsp,%r12,1),%ecx
imul   $0x989680,%ecx,%ebx
add    %ebp,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x989680,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x20(%rsp,%r12,1),%ecx
imul   $0x5f5e100,%ecx,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x5f5e100,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x24(%rsp,%r12,1),%ecx
imul   $0x3b9aca00,%ecx,%ebx
add    %ebp,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x3b9aca00,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x28(%rsp,%r12,1),%ecx
imul   $0x540be400,%ecx,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x540be400,%edx
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebp,%r15d
add    $0xc8,%r12
cmp    $0x4e48,%r12
jne    11f0 <main+0xb0>
lea    0xcd4(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4e20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@_IONBF = global i32 0
@.str = [11 x i8] c"number.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.2 = [19 x i8] c"%lld += %llu * %d\0A\00"
@.str.3 = [13 x i8] c"result: %lld\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 [100 x [50 x i32]]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
%16 = load i32, i32* @stdout
%17 = load i32, i32* @_IONBF
%18 = call i32 @setvbuf(i32 %16, i32* null, i32 %17, i32 0)
%19 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %6
%20 = load i32*, i32** %6
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %46
22: ; preds = %2
br label %23
23: ; preds = %44, %22
%24 = load i32*, i32** %6
%25 = call i32 @getc(i32* %24)
store i32 %25, i32* %7
%26 = load i32, i32* @EOF
%27 = icmp ne i32 %25, %26
br i1 %27, label %28, label %45
28: ; preds = %23
%29 = load i32, i32* %7
%30 = sub nsw i32 %29, 48
%31 = load i32, i32* %8
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %10, i64 0, i64 %32
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [50 x i32], [50 x i32]* %33, i64 0, i64 %35
store i32 %30, i32* %36
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
%39 = load i32, i32* %9
%40 = icmp eq i32 %39, 50
br i1 %40, label %41, label %44
41: ; preds = %28
store i32 0, i32* %9
%42 = load i32, i32* %8
%43 = add nsw i32 %42, 1
store i32 %43, i32* %8
br label %44
44: ; preds = %41, %28
br label %23
45: ; preds = %23
br label %46
46: ; preds = %45, %2
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
br label %47
47: ; preds = %85, %46
%48 = load i32, i32* %13
%49 = icmp slt i32 %48, 100
br i1 %49, label %50, label %88
50: ; preds = %47
store i32 1, i32* %14
store i32 10, i32* %15
br label %51
51: ; preds = %78, %50
%52 = load i32, i32* %15
%53 = icmp sge i32 %52, 0
br i1 %53, label %54, label %81
54: ; preds = %51
%55 = load i32, i32* %14
%56 = load i32, i32* %13
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %10, i64 0, i64 %57
%59 = load i32, i32* %15
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [50 x i32], [50 x i32]* %58, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = mul nsw i32 %55, %62
%64 = load i32, i32* %11
%65 = add nsw i32 %64, %63
store i32 %65, i32* %11
%66 = load i32, i32* %11
%67 = load i32, i32* %14
%68 = load i32, i32* %13
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %10, i64 0, i64 %69
%71 = load i32, i32* %15
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [50 x i32], [50 x i32]* %70, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %66, i32 %67, i32 %74)
%76 = load i32, i32* %14
%77 = mul nsw i32 10, %76
store i32 %77, i32* %14
br label %78
78: ; preds = %54
%79 = load i32, i32* %15
%80 = add nsw i32 %79, -1
store i32 %80, i32* %15
br label %51
81: ; preds = %51
%82 = load i32, i32* %11
%83 = load i32, i32* %12
%84 = add nsw i32 %83, %82
store i32 %84, i32* %12
store i32 0, i32* %11
br label %85
85: ; preds = %81
%86 = load i32, i32* %13
%87 = add nsw i32 %86, 1
store i32 %87, i32* %13
br label %47
88: ; preds = %47
%89 = load i32, i32* %12
%90 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %89)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@_IONBF = global i32 0
@.str = [11 x i8] c"number.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.2 = [19 x i8] c"%lld += %llu * %d\0A\00"
@.str.3 = [13 x i8] c"result: %lld\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x [50 x i32]]
%4 = bitcast [100 x [50 x i32]]* %3 to i8*
%5 = load i32, i32* @stdout
%6 = load i32, i32* @_IONBF
%7 = tail call i32 @setvbuf(i32 %5, i32* null, i32 %6, i32 0)
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %30, label %10
10: ; preds = %2
%11 = tail call i32 @getc(i32* %8)
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %30, label %14
14: ; preds = %10, %14
%15 = phi i32 [ %27, %14 ], [ %11, %10 ]
%16 = phi i32 [ %26, %14 ], [ 0, %10 ]
%17 = phi i32 [ %25, %14 ], [ 0, %10 ]
%18 = add nsw i32 %15, -48
%19 = zext i32 %17 to i64
%20 = sext i32 %16 to i64
%21 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %19, i64 %20
store i32 %18, i32* %21
%22 = add nsw i32 %16, 1
%23 = icmp eq i32 %22, 50
%24 = zext i1 %23 to i32
%25 = add nuw nsw i32 %17, %24
%26 = select i1 %23, i32 0, i32 %22
%27 = tail call i32 @getc(i32* %8)
%28 = load i32, i32* @EOF
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %14
30: ; preds = %14, %10, %2
br label %31
31: ; preds = %30, %31
%32 = phi i64 [ %88, %31 ], [ 0, %30 ]
%33 = phi i32 [ %87, %31 ], [ 0, %30 ]
%34 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %32, i64 10
%35 = load i32, i32* %34
%36 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %35, i32 1, i32 %35)
%37 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %32, i64 9
%38 = load i32, i32* %37
%39 = mul nsw i32 %38, 10
%40 = add nsw i32 %39, %35
%41 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %40, i32 10, i32 %38)
%42 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %32, i64 8
%43 = load i32, i32* %42
%44 = mul nsw i32 %43, 100
%45 = add nsw i32 %44, %40
%46 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %45, i32 100, i32 %43)
%47 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %32, i64 7
%48 = load i32, i32* %47
%49 = mul nsw i32 %48, 1000
%50 = add nsw i32 %49, %45
%51 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %50, i32 1000, i32 %48)
%52 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %32, i64 6
%53 = load i32, i32* %52
%54 = mul nsw i32 %53, 10000
%55 = add nsw i32 %54, %50
%56 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %55, i32 10000, i32 %53)
%57 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %32, i64 5
%58 = load i32, i32* %57
%59 = mul nsw i32 %58, 100000
%60 = add nsw i32 %59, %55
%61 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %60, i32 100000, i32 %58)
%62 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %32, i64 4
%63 = load i32, i32* %62
%64 = mul nsw i32 %63, 1000000
%65 = add nsw i32 %64, %60
%66 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %65, i32 1000000, i32 %63)
%67 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %32, i64 3
%68 = load i32, i32* %67
%69 = mul nsw i32 %68, 10000000
%70 = add nsw i32 %69, %65
%71 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %70, i32 10000000, i32 %68)
%72 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %32, i64 2
%73 = load i32, i32* %72
%74 = mul nsw i32 %73, 100000000
%75 = add nsw i32 %74, %70
%76 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %75, i32 100000000, i32 %73)
%77 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %32, i64 1
%78 = load i32, i32* %77
%79 = mul nsw i32 %78, 1000000000
%80 = add nsw i32 %79, %75
%81 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %80, i32 1000000000, i32 %78)
%82 = getelementptr inbounds [100 x [50 x i32]], [100 x [50 x i32]]* %3, i64 0, i64 %32, i64 0
%83 = load i32, i32* %82
%84 = mul nsw i32 %83, 1410065408
%85 = add nsw i32 %84, %80
%86 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %85, i32 1410065408, i32 %83)
%87 = add nsw i32 %85, %33
%88 = add nuw nsw i64 %32, 1
%89 = icmp eq i64 %88, 100
br i1 %89, label %90, label %31
90: ; preds = %31
%91 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %87)
ret i32 0
}