#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 /*<<< orphan*/ scanf(char *, char *);
int main() {
  char mytype[5][10] = {0};
  for (int i = 0; i < 5; i++) {
    printf("write the student %i name:\n", i);
    scanf("%s", mytype[i]);
  }
  printf("\n");
  for (int i = 0; i < 5; i++)
    printf("Student name: %s\n", mytype[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x5,-0x44(%rbp)
jge    119a <main+0x6a>
mov    -0x44(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x44(%rbp),%rax
lea    -0x40(%rbp),%rsi
imul   $0xa,%rax,%rax
add    %rax,%rsi
lea    0xe95(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1156 <main+0x26>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x48(%rbp)
cmpl   $0x5,-0x48(%rbp)
jge    11e4 <main+0xb4>
movslq -0x48(%rbp),%rax
lea    -0x40(%rbp),%rsi
imul   $0xa,%rax,%rax
add    %rax,%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11af <main+0x7f>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movw   $0x0,0x30(%rsp)
lea    0xea3(%rip),%r12
mov    %r12,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeac(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r12,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xa(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%r13
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1e(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x28(%rsp),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe17(%rip),%rbx
mov    %rbx,%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"write the student %i name:\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [18 x i8] c"Student name: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [10 x i8]]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [5 x [10 x i8]]* %2 to i8*
store i32 0, i32* %3
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 5
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %2, i64 0, i64 %13
%15 = getelementptr inbounds [10 x i8], [10 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)
br label %17
17: ; preds = %9
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %22
22: ; preds = %31, %20
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 5
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %2, i64 0, i64 %27
%29 = getelementptr inbounds [10 x i8], [10 x i8]* %28, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %25
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %22
34: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"write the student %i name:\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [18 x i8] c"Student name: %s\0A\00"
define i32 @main() {
%1 = alloca [5 x [10 x i8]]
%2 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %1, i64 0, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %1, i64 0, i64 1, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 2)
%9 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %1, i64 0, i64 2, i64 0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 3)
%12 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %1, i64 0, i64 3, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 4)
%15 = getelementptr inbounds [5 x [10 x i8]], [5 x [10 x i8]]* %1, i64 0, i64 4, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = call i32 @putchar(i32 10)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %15)
ret i32 0
}