#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 /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strlen(char *);
int main(void) {
  char inputStrings[10][51];
  int i = 0, totalStrLen = 0;
  for (i = 0; i < 10; i++) {
    printf("Please enter string #%d: ", i + 1);
    scanf("%s", inputStrings[i]);
    totalStrLen += strlen(inputStrings[i]);
  }
  printf("The total length of all 10 strings is: %d\n", totalStrLen);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x214(%rbp)
movl   $0x0,-0x218(%rbp)
movl   $0x0,-0x214(%rbp)
cmpl   $0xa,-0x214(%rbp)
jge    11e4 <main+0xb4>
mov    -0x214(%rbp),%esi
add    $0x1,%esi
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
movslq -0x214(%rbp),%rax
lea    -0x210(%rbp),%rsi
imul   $0x33,%rax,%rax
add    %rax,%rsi
lea    0xe7c(%rip),%rdi
call   1050 <scanf@plt>
movslq -0x214(%rbp),%rax
lea    -0x210(%rbp),%rdi
imul   $0x33,%rax,%rax
add    %rax,%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
movslq -0x218(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x218(%rbp)
mov    -0x214(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x214(%rbp)
jmp    1160 <main+0x30>
mov    -0x218(%rbp),%esi
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x208,%rsp
lea    0xebb(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
lea    0xec1(%rip),%r15
mov    %rsp,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
lea    0x33(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %eax,%ebx
mov    %r14,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
lea    0x66(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %eax,%ebx
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
lea    0x99(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %eax,%ebx
mov    %r14,%rdi
mov    $0x5,%esi
call   1040 <printf@plt>
lea    0xcc(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %eax,%ebx
mov    %r14,%rdi
mov    $0x6,%esi
call   1040 <printf@plt>
lea    0xff(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %eax,%ebx
mov    %r14,%rdi
mov    $0x7,%esi
call   1040 <printf@plt>
lea    0x132(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %eax,%ebx
mov    %r14,%rdi
mov    $0x8,%esi
call   1040 <printf@plt>
lea    0x165(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %eax,%ebx
mov    %r14,%rdi
mov    $0x9,%esi
call   1040 <printf@plt>
lea    0x198(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %eax,%ebx
mov    %r14,%rdi
mov    $0xa,%esi
call   1040 <printf@plt>
lea    0x1cb(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
add    %eax,%ebx
lea    0xd30(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Please enter string #%d: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [43 x i8] c"The total length of all 10 strings is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [51 x i8]]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %26, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %29
8: ; preds = %5
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %2, i64 0, i64 %13
%15 = getelementptr inbounds [51 x i8], [51 x i8]* %14, i64 0, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %2, i64 0, i64 %18
%20 = getelementptr inbounds [51 x i8], [51 x i8]* %19, i64 0, i64 0
%21 = call i64 @strlen(i8* %20)
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = add nsw i64 %23, %21
%25 = trunc i64 %24 to i32
store i32 %25, i32* %4
br label %26
26: ; preds = %8
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %5
29: ; preds = %5
%30 = load i32, i32* %4
%31 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Please enter string #%d: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [43 x i8] c"The total length of all 10 strings is: %d\0A\00"
define i32 @main() {
%1 = alloca [10 x [51 x i8]]
%2 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %1, i64 0, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i64 @strlen(i8* %2)
%6 = trunc i64 %5 to i32
%7 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 2)
%8 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %1, i64 0, i64 1, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = call i64 @strlen(i8* %8)
%11 = trunc i64 %10 to i32
%12 = add i32 %6, %11
%13 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 3)
%14 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %1, i64 0, i64 2, i64 0
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = call i64 @strlen(i8* %14)
%17 = trunc i64 %16 to i32
%18 = add i32 %12, %17
%19 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 4)
%20 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %1, i64 0, i64 3, i64 0
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = call i64 @strlen(i8* %20)
%23 = trunc i64 %22 to i32
%24 = add i32 %18, %23
%25 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 5)
%26 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %1, i64 0, i64 4, i64 0
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = call i64 @strlen(i8* %26)
%29 = trunc i64 %28 to i32
%30 = add i32 %24, %29
%31 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 6)
%32 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %1, i64 0, i64 5, i64 0
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %32)
%34 = call i64 @strlen(i8* %32)
%35 = trunc i64 %34 to i32
%36 = add i32 %30, %35
%37 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 7)
%38 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %1, i64 0, i64 6, i64 0
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %38)
%40 = call i64 @strlen(i8* %38)
%41 = trunc i64 %40 to i32
%42 = add i32 %36, %41
%43 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 8)
%44 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %1, i64 0, i64 7, i64 0
%45 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %44)
%46 = call i64 @strlen(i8* %44)
%47 = trunc i64 %46 to i32
%48 = add i32 %42, %47
%49 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 9)
%50 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %1, i64 0, i64 8, i64 0
%51 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %50)
%52 = call i64 @strlen(i8* %50)
%53 = trunc i64 %52 to i32
%54 = add i32 %48, %53
%55 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 10)
%56 = getelementptr inbounds [10 x [51 x i8]], [10 x [51 x i8]]* %1, i64 0, i64 9, i64 0
%57 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %56)
%58 = call i64 @strlen(i8* %56)
%59 = trunc i64 %58 to i32
%60 = add i32 %54, %59
%61 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %60)
ret i32 0
}