#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ mytoupper(char **, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(int argc, char *argv[]) {
  char a[5][10];
  int i = 0;
  for (i = 0; i < 5; i++) {
    fgets(a[i], 10, stdin);
    a[i][strlen(a[i]) - 1] = 0;
  }
  for (i = 0; i < 5; i++) {
    puts(a[i]);
  }
  mytoupper(a, 5);
  for (i = 0; i < 5; i++) {
    puts(a[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    11d5 <main+0x95>
movslq -0x54(%rbp),%rax
lea    -0x50(%rbp),%rdi
imul   $0xa,%rax,%rax
add    %rax,%rdi
mov    0x2e64(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1050 <fgets@plt>
movslq -0x54(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0xa,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
movslq -0x54(%rbp),%rax
lea    -0x50(%rbp),%rdi
imul   $0xa,%rax,%rax
add    %rax,%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1164 <main+0x24>
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    1208 <main+0xc8>
movslq -0x54(%rbp),%rax
lea    -0x50(%rbp),%rdi
imul   $0xa,%rax,%rax
add    %rax,%rdi
call   1030 <puts@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11dc <main+0x9c>
lea    -0x50(%rbp),%rdi
mov    $0x5,%esi
call   1060 <mytoupper@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    1249 <main+0x109>
movslq -0x54(%rbp),%rax
lea    -0x50(%rbp),%rdi
imul   $0xa,%rax,%rax
add    %rax,%rdi
call   1030 <puts@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    121d <main+0xdd>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    0x2e93(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
lea    0xa(%rsp),%r14
mov    0x0(%rbp),%edx
mov    %r14,%rdi
mov    $0xa,%esi
call   1050 <fgets@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,0x9(%rax,%rbx,1)
lea    0x14(%rsp),%r15
mov    0x0(%rbp),%edx
mov    %r15,%rdi
mov    $0xa,%esi
call   1050 <fgets@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,0x13(%rax,%rbx,1)
lea    0x1e(%rsp),%r12
mov    0x0(%rbp),%edx
mov    %r12,%rdi
mov    $0xa,%esi
call   1050 <fgets@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,0x1d(%rax,%rbx,1)
lea    0x28(%rsp),%r13
mov    0x0(%rbp),%edx
mov    %r13,%rdi
mov    $0xa,%esi
call   1050 <fgets@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,0x27(%rax,%rbx,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1060 <mytoupper@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x [10 x i8]]
%4 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %3, i64 0, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 10, i32 %5)
%7 = call i32 @strlen(i8* %4)
%8 = add nsw i32 %7, -1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %3, i64 0, i64 0, i64 %9
store i8 0, i8* %10
%11 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %3, i64 0, i64 1, i64 0
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %11, i32 10, i32 %12)
%14 = call i32 @strlen(i8* %11)
%15 = add nsw i32 %14, -1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %3, i64 0, i64 1, i64 %16
store i8 0, i8* %17
%18 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %3, i64 0, i64 2, i64 0
%19 = load i32, i32* @stdin
%20 = call i32 @fgets(i8* %18, i32 10, i32 %19)
%21 = call i32 @strlen(i8* %18)
%22 = add nsw i32 %21, -1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %3, i64 0, i64 2, i64 %23
store i8 0, i8* %24
%25 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %3, i64 0, i64 3, i64 0
%26 = load i32, i32* @stdin
%27 = call i32 @fgets(i8* %25, i32 10, i32 %26)
%28 = call i32 @strlen(i8* %25)
%29 = add nsw i32 %28, -1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %3, i64 0, i64 3, i64 %30
store i8 0, i8* %31
%32 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %3, i64 0, i64 4, i64 0
%33 = load i32, i32* @stdin
%34 = call i32 @fgets(i8* %32, i32 10, i32 %33)
%35 = call i32 @strlen(i8* %32)
%36 = add nsw i32 %35, -1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %3, i64 0, i64 4, i64 %37
store i8 0, i8* %38
%39 = call i32 @puts(i8* %4)
%40 = call i32 @puts(i8* %11)
%41 = call i32 @puts(i8* %18)
%42 = call i32 @puts(i8* %25)
%43 = call i32 @puts(i8* %32)
%44 = bitcast [5 x [10 x i8]]* %3 to i8**
%45 = call i32 @mytoupper(i8** %44, i32 5)
%46 = call i32 @puts(i8* %4)
%47 = call i32 @puts(i8* %11)
%48 = call i32 @puts(i8* %18)
%49 = call i32 @puts(i8* %25)
%50 = call i32 @puts(i8* %32)
ret i32 0
}