#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int main() {
  struct aluno {
    char nome[100];
    int idade;
  };
  int n, i;
  printf("Digite a quantidade de alunos : ");
  scanf("%d", &n);
  struct aluno aluno[n];
  for (i = 0; i < n; i++) {
    printf("Digite o nome do aluno : \n");
    fflush(stdin);
    gets(aluno[i].nome);
    printf("Digite a idade do aluno : \n");
    scanf(" %d", &aluno[i].idade);
  }
  for (i = 0; i < n; i++) {
    printf("Aluno #%d\n", i + 1);
    printf("Nome : %s\n", aluno[i].nome);
    printf("Idade do(a) %s : %d\n\n", aluno[i].nome, aluno[i].idade);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
imul   $0x68,%rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1212 <main+0xd2>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0x28(%rbp),%rdi
movslq -0xc(%rbp),%rax
imul   $0x68,%rax,%rax
add    %rax,%rdi
call   1040 <gets@plt>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
movslq -0xc(%rbp),%rax
imul   $0x68,%rax,%rax
add    %rax,%rsi
add    $0x64,%rsi
lea    0xe59(%rip),%rdi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119b <main+0x5b>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1292 <main+0x152>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
movslq -0xc(%rbp),%rax
imul   $0x68,%rax,%rax
add    %rax,%rsi
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x68,%rcx,%rcx
mov    %rax,%rsi
add    %rcx,%rsi
movslq -0xc(%rbp),%rcx
imul   $0x68,%rcx,%rcx
add    %rcx,%rax
mov    0x64(%rax),%edx
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1219 <main+0xd9>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <scanf@plt>
mov    %rsp,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r13
imul   $0x68,%rax,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    126b <main+0x11b>
xor    %r14d,%r14d
lea    0xebc(%rip),%r15
lea    0xe6b(%rip),%r12
mov    %r13,%rbx
nopl   0x0(%rax)
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0x64(%rbx),%rsi
mov    %r12,%rdi
call   1070 <scanf@plt>
add    $0x1,%r14
movslq -0x2c(%rbp),%rax
add    $0x68,%rbx
cmp    %rax,%r14
jl     11c0 <main+0x70>
test   %eax,%eax
jle    126b <main+0x11b>
lea    0xe13(%rip),%r14
lea    0xe17(%rip),%r15
lea    0xe1b(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x64(%r13),%edx
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movslq -0x2c(%rbp),%rax
add    $0x68,%r13
cmp    %rax,%rbx
jl     1230 <main+0xe0>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.aluno = type { [100 x i8], i32 }
@.str = [33 x i8] c"Digite a quantidade de alunos : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"Digite o nome do aluno : \0A\00"
@stdin = global i32 0
@.str.3 = [28 x i8] c"Digite a idade do aluno : \0A\00"
@.str.4 = [4 x i8] c" %d\00"
@.str.5 = [11 x i8] c"Aluno #%d\0A\00"
@.str.6 = [11 x i8] c"Nome : %s\0A\00"
@.str.7 = [22 x i8] c"Idade do(a) %s : %d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %4
%11 = alloca %struct.aluno, i64 %9
store i64 %9, i64* %5
store i32 0, i32* %3
br label %12
12: ; preds = %32, %0
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %35
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32, i32* @stdin
%19 = call i32 @fflush(i32 %18)
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds %struct.aluno, %struct.aluno* %11, i64 %21
%23 = getelementptr inbounds %struct.aluno, %struct.aluno* %22, i32 0, i32 0
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%25 = call i32 @gets(i8* %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds %struct.aluno, %struct.aluno* %11, i64 %28
%30 = getelementptr inbounds %struct.aluno, %struct.aluno* %29, i32 0, i32 1
%31 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32* %30)
br label %32
32: ; preds = %16
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %12
35: ; preds = %12
store i32 0, i32* %3
br label %36
36: ; preds = %61, %35
%37 = load i32, i32* %3
%38 = load i32, i32* %2
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %64
40: ; preds = %36
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %3
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds %struct.aluno, %struct.aluno* %11, i64 %45
%47 = getelementptr inbounds %struct.aluno, %struct.aluno* %46, i32 0, i32 0
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %47, i64 0, i64 0
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %48)
%50 = load i32, i32* %3
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds %struct.aluno, %struct.aluno* %11, i64 %51
%53 = getelementptr inbounds %struct.aluno, %struct.aluno* %52, i32 0, i32 0
%54 = getelementptr inbounds [100 x i8], [100 x i8]* %53, i64 0, i64 0
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds %struct.aluno, %struct.aluno* %11, i64 %56
%58 = getelementptr inbounds %struct.aluno, %struct.aluno* %57, i32 0, i32 1
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %54, i32 %59)
br label %61
61: ; preds = %40
%62 = load i32, i32* %3
%63 = add nsw i32 %62, 1
store i32 %63, i32* %3
br label %36
64: ; preds = %36
store i32 0, i32* %1
%65 = load i8*, i8** %4
%66 = load i32, i32* %1
ret i32 %66
}

LLVM IR (-O2):
%struct.aluno = type { [100 x i8], i32 }
@.str = [33 x i8] c"Digite a quantidade de alunos : \00"
@.str.1 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.4 = [4 x i8] c" %d\00"
@.str.5 = [11 x i8] c"Aluno #%d\0A\00"
@.str.6 = [11 x i8] c"Nome : %s\0A\00"
@.str.7 = [22 x i8] c"Idade do(a) %s : %d\0A\0A\00"
@str = [26 x i8] c"Digite o nome do aluno : \00"
@str.8 = [27 x i8] c"Digite a idade do aluno : \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
%8 = alloca %struct.aluno, i64 %6
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %13, label %40
11: ; preds = %13
%12 = icmp sgt i32 %24, 0
br i1 %12, label %27, label %40
13: ; preds = %0, %13
%14 = phi i64 [ %23, %13 ], [ 0, %0 ]
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%16 = load i32, i32* @stdin
%17 = call i32 @fflush(i32 %16)
%18 = getelementptr inbounds %struct.aluno, %struct.aluno* %8, i64 %14, i32 0, i64 0
%19 = call i32 @gets(i8* %18)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.8, i64 0, i64 0))
%21 = getelementptr inbounds %struct.aluno, %struct.aluno* %8, i64 %14, i32 1
%22 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32* %21)
%23 = add nuw nsw i64 %14, 1
%24 = load i32, i32* %1
%25 = sext i32 %24 to i64
%26 = icmp slt i64 %23, %25
br i1 %26, label %13, label %11
27: ; preds = %11, %27
%28 = phi i64 [ %29, %27 ], [ 0, %11 ]
%29 = add nuw nsw i64 %28, 1
%30 = trunc i64 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds %struct.aluno, %struct.aluno* %8, i64 %28, i32 0, i64 0
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds %struct.aluno, %struct.aluno* %8, i64 %28, i32 1
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %32, i32 %35)
%37 = load i32, i32* %1
%38 = sext i32 %37 to i64
%39 = icmp slt i64 %29, %38
br i1 %39, label %27, label %40
40: ; preds = %27, %0, %11
ret i32 0
}