#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 *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  int i, j, aux;
  float nota[30];
  char nome[30][30];
  char nome2[30];
  printf("Olá, meu nome é LEONARDO AREAS e este programa pode ser visto no "
         "seguinte endereço do github: "
         "https://github.com/leonardoareas/trabalhoAv2/prog1_av2_1.c\n");
  for (i = 0; i <= 29; i++) {
    printf("Entre com o nome do aluno %d: ", i + 1);
    scanf("%s", nome[i]);
    printf("entre com a nota do %d: ", i + 1);
    scanf("%f", &nota[i]);
  }
  for (i = 0; i <= 29; i++) {
    for (j = i + 1; j <= 29; j++) {
      if (nota[j] > nota[i]) {
        aux = nota[j];
        nota[j] = nota[i];
        nota[i] = aux;
        strcpy(nome2, nome[j]);
        strcpy(nome[j], nome[i]);
        strcpy(nome[i], nome2);
      }
    }
  }
  printf("----------------\n");
  printf("Nome do aluno\t\tav1\n");
  for (i = 0; i <= 29; i++) {
    printf("%s\t\t%.2f\n\n", nome[i], nota[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1d,-0x8(%rbp)
jg     11d7 <main+0xa7>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xf2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x420(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
lea    0xf2e(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xf1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x90(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xf16(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1157 <main+0x27>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1d,-0x8(%rbp)
jg     12e1 <main+0x1b1>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1d,-0xc(%rbp)
jg     12ce <main+0x19e>
movslq -0xc(%rbp),%rax
movss  -0x90(%rbp,%rax,4),%xmm0
ff ff
movslq -0x8(%rbp),%rax
ucomiss -0x90(%rbp,%rax,4),%xmm0
ff
jbe    12bb <main+0x18b>
movslq -0xc(%rbp),%rax
cvttss2si -0x90(%rbp,%rax,4),%eax
ff ff
mov    %eax,-0x10(%rbp)
movslq -0x8(%rbp),%rax
movss  -0x90(%rbp,%rax,4),%xmm0
ff ff
movslq -0xc(%rbp),%rax
movss  %xmm0,-0x90(%rbp,%rax,4)
ff ff
cvtsi2ssl -0x10(%rbp),%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x90(%rbp,%rax,4)
ff ff
lea    -0x440(%rbp),%rdi
movslq -0xc(%rbp),%rax
lea    -0x420(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
movslq -0xc(%rbp),%rax
lea    -0x420(%rbp),%rdi
imul   $0x1e,%rax,%rax
add    %rax,%rdi
movslq -0x8(%rbp),%rax
lea    -0x420(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
movslq -0x8(%rbp),%rax
lea    -0x420(%rbp),%rdi
imul   $0x1e,%rax,%rax
add    %rax,%rdi
lea    -0x440(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    12c0 <main+0x190>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f1 <main+0xc1>
jmp    12d3 <main+0x1a3>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11de <main+0xae>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1d,-0x8(%rbp)
jg     134d <main+0x21d>
movslq -0x8(%rbp),%rax
lea    -0x420(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
movslq -0x8(%rbp),%rax
movss  -0x90(%rbp,%rax,4),%xmm0
ff ff
cvtss2sd %xmm0,%xmm0
lea    0xdc9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1304 <main+0x1d4>
mov    -0x4(%rbp),%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
lea    0xef1(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%r14
lea    0xb0(%rsp),%rbx
mov    $0xffffffffffffffe2,%r12
lea    0xeaa(%rip),%r13
lea    0xebc(%rip),%rbp
nop
lea    0x1f(%r12),%r15d
lea    0xe74(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe82(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r13,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x4,%r14
add    $0x1e,%rbx
inc    %r12
jne    1180 <main+0x40>
lea    0xce(%rsp),%rax
mov    %rax,(%rsp)
mov    $0x1,%r15d
xor    %r13d,%r13d
lea    0x90(%rsp),%r14
jmp    1208 <main+0xc8>
nopl   (%rax)
add    $0x1,%r15
addq   $0x1e,(%rsp)
mov    0x8(%rsp),%r13
cmp    $0x1e,%r13
je     1299 <main+0x159>
lea    0x1(%r13),%rax
mov    %rax,0x8(%rsp)
cmp    $0x1c,%r13
ja     11f0 <main+0xb0>
mov    %r13,%rax
shl    $0x5,%rax
sub    %r13,%rax
sub    %r13,%rax
lea    (%rsp,%rax,1),%rbp
add    $0xb0,%rbp
mov    (%rsp),%rbx
mov    %r15,%r12
jmp    124e <main+0x10e>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12
add    $0x1e,%rbx
cmp    $0x1e,%r12
je     11f0 <main+0xb0>
movss  0x10(%rsp,%r12,4),%xmm0
movss  0x10(%rsp,%r13,4),%xmm1
ucomiss %xmm1,%xmm0
jbe    1240 <main+0x100>
movss  %xmm1,0x10(%rsp,%r12,4)
cvttps2dq %xmm0,%xmm0
cvtdq2ps %xmm0,%xmm0
movss  %xmm0,0x10(%rsp,%r13,4)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    1240 <main+0x100>
lea    0xe45(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4a(%rip),%rdi
call   1040 <puts@plt>
lea    0xb0(%rsp),%rbx
xor    %ebp,%ebp
lea    0xd7c(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  0x10(%rsp,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbp
add    $0x1e,%rbx
cmp    $0x1e,%rbp
jne    12d0 <main+0x190>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [157 x i8] c"Ol\C3\A1, meu nome \C3\A9 LEONARDO AREAS e este programa pode ser visto no seguinte endere\C3\A7o do github: https://github.com/leonardoareas/trabalhoAv2/prog1_av2_1.c\0A\00"
@.str.1 = [31 x i8] c"Entre com o nome do aluno %d: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [25 x i8] c"entre com a nota do %d: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [18 x i8] c"----------------\0A\00"
@.str.6 = [20 x i8] c"Nome do aluno\09\09av1\0A\00"
@.str.7 = [11 x i8] c"%s\09\09%.2f\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [30 x float]
%6 = alloca [30 x [30 x i8]]
%7 = alloca [30 x i8]
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %9
9: ; preds = %28, %0
%10 = load i32, i32* %2
%11 = icmp sle i32 %10, 29
br i1 %11, label %12, label %31
12: ; preds = %9
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %6, i64 0, i64 %17
%19 = getelementptr inbounds [30 x i8], [30 x i8]* %18, i64 0, i64 0
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [30 x float], [30 x float]* %5, i64 0, i64 %25
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %26)
br label %28
28: ; preds = %12
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %9
31: ; preds = %9
store i32 0, i32* %2
br label %32
32: ; preds = %95, %31
%33 = load i32, i32* %2
%34 = icmp sle i32 %33, 29
br i1 %34, label %35, label %98
35: ; preds = %32
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %38
38: ; preds = %91, %35
%39 = load i32, i32* %3
%40 = icmp sle i32 %39, 29
br i1 %40, label %41, label %94
41: ; preds = %38
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [30 x float], [30 x float]* %5, i64 0, i64 %43
%45 = load float, float* %44
%46 = load i32, i32* %2
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [30 x float], [30 x float]* %5, i64 0, i64 %47
%49 = load float, float* %48
%50 = fcmp ogt float %45, %49
br i1 %50, label %51, label %90
51: ; preds = %41
%52 = load i32, i32* %3
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [30 x float], [30 x float]* %5, i64 0, i64 %53
%55 = load float, float* %54
%56 = fptosi float %55 to i32
store i32 %56, i32* %4
%57 = load i32, i32* %2
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [30 x float], [30 x float]* %5, i64 0, i64 %58
%60 = load float, float* %59
%61 = load i32, i32* %3
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [30 x float], [30 x float]* %5, i64 0, i64 %62
store float %60, float* %63
%64 = load i32, i32* %4
%65 = sitofp i32 %64 to float
%66 = load i32, i32* %2
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [30 x float], [30 x float]* %5, i64 0, i64 %67
store float %65, float* %68
%69 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%70 = load i32, i32* %3
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %6, i64 0, i64 %71
%73 = getelementptr inbounds [30 x i8], [30 x i8]* %72, i64 0, i64 0
%74 = call i32 @strcpy(i8* %69, i8* %73)
%75 = load i32, i32* %3
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %6, i64 0, i64 %76
%78 = getelementptr inbounds [30 x i8], [30 x i8]* %77, i64 0, i64 0
%79 = load i32, i32* %2
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %6, i64 0, i64 %80
%82 = getelementptr inbounds [30 x i8], [30 x i8]* %81, i64 0, i64 0
%83 = call i32 @strcpy(i8* %78, i8* %82)
%84 = load i32, i32* %2
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %6, i64 0, i64 %85
%87 = getelementptr inbounds [30 x i8], [30 x i8]* %86, i64 0, i64 0
%88 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%89 = call i32 @strcpy(i8* %87, i8* %88)
br label %90
90: ; preds = %51, %41
br label %91
91: ; preds = %90
%92 = load i32, i32* %3
%93 = add nsw i32 %92, 1
store i32 %93, i32* %3
br label %38
94: ; preds = %38
br label %95
95: ; preds = %94
%96 = load i32, i32* %2
%97 = add nsw i32 %96, 1
store i32 %97, i32* %2
br label %32
98: ; preds = %32
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %2
br label %101
101: ; preds = %115, %98
%102 = load i32, i32* %2
%103 = icmp sle i32 %102, 29
br i1 %103, label %104, label %118
104: ; preds = %101
%105 = load i32, i32* %2
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %6, i64 0, i64 %106
%108 = getelementptr inbounds [30 x i8], [30 x i8]* %107, i64 0, i64 0
%109 = load i32, i32* %2
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [30 x float], [30 x float]* %5, i64 0, i64 %110
%112 = load float, float* %111
%113 = fpext float %112 to double
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %108, double %113)
br label %115
115: ; preds = %104
%116 = load i32, i32* %2
%117 = add nsw i32 %116, 1
store i32 %117, i32* %2
br label %101
118: ; preds = %101
%119 = load i32, i32* %1
ret i32 %119
}

LLVM IR (-O2):
@.str.1 = [31 x i8] c"Entre com o nome do aluno %d: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [25 x i8] c"entre com a nota do %d: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.7 = [11 x i8] c"%s\09\09%.2f\0A\0A\00"
@str = [156 x i8] c"Ol\C3\A1, meu nome \C3\A9 LEONARDO AREAS e este programa pode ser visto no seguinte endere\C3\A7o do github: https://github.com/leonardoareas/trabalhoAv2/prog1_av2_1.c\00"
@str.8 = [17 x i8] c"----------------\00"
@str.9 = [19 x i8] c"Nome do aluno\09\09av1\00"
define i32 @main() {
%1 = alloca [30 x float]
%2 = alloca [30 x [30 x i8]]
%3 = alloca [30 x i8]
%4 = bitcast [30 x float]* %1 to i8*
%5 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %2, i64 0, i64 0, i64 0
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([156 x i8], [156 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %0, %8
%9 = phi i64 [ 0, %0 ], [ %10, %8 ]
%10 = add nuw nsw i64 %9, 1
%11 = trunc i64 %10 to i32
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %2, i64 0, i64 %9, i64 0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%16 = getelementptr inbounds [30 x float], [30 x float]* %1, i64 0, i64 %9
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %16)
%18 = icmp eq i64 %10, 30
br i1 %18, label %22, label %8
19: ; preds = %43, %22
%20 = add nuw nsw i64 %24, 1
%21 = icmp eq i64 %25, 30
br i1 %21, label %46, label %22
22: ; preds = %8, %19
%23 = phi i64 [ %25, %19 ], [ 0, %8 ]
%24 = phi i64 [ %20, %19 ], [ 1, %8 ]
%25 = add nuw nsw i64 %23, 1
%26 = icmp ult i64 %23, 29
br i1 %26, label %27, label %19
27: ; preds = %22
%28 = getelementptr inbounds [30 x float], [30 x float]* %1, i64 0, i64 %23
%29 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %2, i64 0, i64 %23, i64 0
br label %30
30: ; preds = %27, %43
%31 = phi i64 [ %24, %27 ], [ %44, %43 ]
%32 = getelementptr inbounds [30 x float], [30 x float]* %1, i64 0, i64 %31
%33 = load float, float* %32
%34 = load float, float* %28
%35 = fcmp ogt float %33, %34
br i1 %35, label %36, label %43
36: ; preds = %30
%37 = fptosi float %33 to i32
store float %34, float* %32
%38 = sitofp i32 %37 to float
store float %38, float* %28
%39 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %2, i64 0, i64 %31, i64 0
%40 = call i32 @strcpy(i8* %6, i8* %39)
%41 = call i32 @strcpy(i8* %39, i8* %29)
%42 = call i32 @strcpy(i8* %29, i8* %6)
br label %43
43: ; preds = %30, %36
%44 = add nuw nsw i64 %31, 1
%45 = icmp eq i64 %44, 30
br i1 %45, label %19, label %30
46: ; preds = %19
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.8, i64 0, i64 0))
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0))
br label %49
49: ; preds = %46, %49
%50 = phi i64 [ 0, %46 ], [ %56, %49 ]
%51 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %2, i64 0, i64 %50, i64 0
%52 = getelementptr inbounds [30 x float], [30 x float]* %1, i64 0, i64 %50
%53 = load float, float* %52
%54 = fpext float %53 to double
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %51, double %54)
%56 = add nuw nsw i64 %50, 1
%57 = icmp eq i64 %56, 30
br i1 %57, label %58, label %49
58: ; preds = %49
ret i32 0
}