#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;
  float nota[30], aux;
  char nome[30][30];
  char aux2[30];
  printf("Olá, meu nome é Bruno Lemos Landeiro e este programa pode ser visto "
         "no seguinte endereço do github: "
         "https://github.com/brunolandeiro/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 %s: ", nome[i]);
    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(aux2, nome[j]);
        strcpy(nome[j], nome[i]);
        strcpy(nome[i], aux2);
      }
    }
  }
  printf("\n\nListagem da av1\n");
  printf("----------------\n");
  printf("Nome do aluno\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     11e3 <main+0xb3>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xf35(%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    0xf34(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
movslq -0x8(%rbp),%rax
lea    -0x420(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
lea    0xf17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x90(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xf10(%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     12f5 <main+0x1c5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1d,-0xc(%rbp)
jg     12e2 <main+0x1b2>
movslq -0xc(%rbp),%rax
movss  -0x90(%rbp,%rax,4),%xmm0
ff ff
movslq -0x8(%rbp),%rax
ucomiss -0x90(%rbp,%rax,4),%xmm0
ff
jbe    12cf <main+0x19f>
movslq -0xc(%rbp),%rax
movss  -0x90(%rbp,%rax,4),%xmm0
ff ff
movss  %xmm0,-0x94(%rbp)
ff
movslq -0x8(%rbp),%rax
movss  -0x90(%rbp,%rax,4),%xmm0
ff ff
movslq -0xc(%rbp),%rax
movss  %xmm0,-0x90(%rbp,%rax,4)
ff ff
movss  -0x94(%rbp),%xmm0
ff
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    12d4 <main+0x1a4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11fd <main+0xcd>
jmp    12e7 <main+0x1b7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ea <main+0xba>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1d,-0x8(%rbp)
jg     136f <main+0x23f>
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    0xdbf(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1326 <main+0x1f6>
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,%r15
lea    0xea7(%rip),%r12
lea    0xea3(%rip),%r13
lea    0xeb5(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
lea    0x1f(%r15),%esi
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
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    %r15
jne    1190 <main+0x50>
lea    0xce(%rsp),%rax
mov    %rax,(%rsp)
mov    $0x1,%r15d
xor    %r13d,%r13d
lea    0x90(%rsp),%r14
jmp    1218 <main+0xd8>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r15
addq   $0x1e,(%rsp)
mov    0x8(%rsp),%r13
cmp    $0x1e,%r13
je     12a2 <main+0x162>
lea    0x1(%r13),%rax
mov    %rax,0x8(%rsp)
cmp    $0x1c,%r13
ja     1200 <main+0xc0>
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    125e <main+0x11e>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12
add    $0x1e,%rbx
cmp    $0x1e,%r12
je     1200 <main+0xc0>
movss  0x10(%rsp,%r12,4),%xmm0
movss  0x10(%rsp,%r13,4),%xmm1
ucomiss %xmm1,%xmm0
jbe    1250 <main+0x110>
movss  %xmm1,0x10(%rsp,%r12,4)
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    1250 <main+0x110>
lea    0xe42(%rip),%rdi
call   1040 <puts@plt>
lea    0xe48(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4d(%rip),%rdi
call   1040 <puts@plt>
lea    0xb0(%rsp),%rbx
xor    %ebp,%ebp
lea    0xd67(%rip),%r14
nopw   0x0(%rax,%rax,1)
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    12e0 <main+0x1a0>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [163 x i8] c"Ol\C3\A1, meu nome \C3\A9 Bruno Lemos Landeiro e este programa pode ser visto no seguinte endere\C3\A7o do github: https://github.com/brunolandeiro/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 %s: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [19 x i8] c"\0A\0AListagem da av1\0A\00"
@.str.6 = [18 x i8] c"----------------\0A\00"
@.str.7 = [19 x i8] c"Nome do aluno\09av1\0A\00"
@.str.8 = [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 [30 x float]
%5 = alloca 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 ([163 x i8], [163 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %9
9: ; preds = %30, %0
%10 = load i32, i32* %2
%11 = icmp sle i32 %10, 29
br i1 %11, label %12, label %33
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 = sext i32 %21 to i64
%23 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %6, i64 0, i64 %22
%24 = getelementptr inbounds [30 x i8], [30 x i8]* %23, i64 0, i64 0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %24)
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [30 x float], [30 x float]* %4, i64 0, i64 %27
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %28)
br label %30
30: ; preds = %12
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %9
33: ; preds = %9
store i32 0, i32* %2
br label %34
34: ; preds = %95, %33
%35 = load i32, i32* %2
%36 = icmp sle i32 %35, 29
br i1 %36, label %37, label %98
37: ; preds = %34
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %40
40: ; preds = %91, %37
%41 = load i32, i32* %3
%42 = icmp sle i32 %41, 29
br i1 %42, label %43, label %94
43: ; preds = %40
%44 = load i32, i32* %3
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [30 x float], [30 x float]* %4, i64 0, i64 %45
%47 = load float, float* %46
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [30 x float], [30 x float]* %4, i64 0, i64 %49
%51 = load float, float* %50
%52 = fcmp ogt float %47, %51
br i1 %52, label %53, label %90
53: ; preds = %43
%54 = load i32, i32* %3
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [30 x float], [30 x float]* %4, i64 0, i64 %55
%57 = load float, float* %56
store float %57, float* %5
%58 = load i32, i32* %2
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [30 x float], [30 x float]* %4, i64 0, i64 %59
%61 = load float, float* %60
%62 = load i32, i32* %3
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [30 x float], [30 x float]* %4, i64 0, i64 %63
store float %61, float* %64
%65 = load float, float* %5
%66 = load i32, i32* %2
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [30 x float], [30 x float]* %4, 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 = %53, %43
br label %91
91: ; preds = %90
%92 = load i32, i32* %3
%93 = add nsw i32 %92, 1
store i32 %93, i32* %3
br label %40
94: ; preds = %40
br label %95
95: ; preds = %94
%96 = load i32, i32* %2
%97 = add nsw i32 %96, 1
store i32 %97, i32* %2
br label %34
98: ; preds = %34
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %2
br label %102
102: ; preds = %116, %98
%103 = load i32, i32* %2
%104 = icmp sle i32 %103, 29
br i1 %104, label %105, label %119
105: ; preds = %102
%106 = load i32, i32* %2
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %6, i64 0, i64 %107
%109 = getelementptr inbounds [30 x i8], [30 x i8]* %108, i64 0, i64 0
%110 = load i32, i32* %2
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [30 x float], [30 x float]* %4, i64 0, i64 %111
%113 = load float, float* %112
%114 = fpext float %113 to double
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %109, double %114)
br label %116
116: ; preds = %105
%117 = load i32, i32* %2
%118 = add nsw i32 %117, 1
store i32 %118, i32* %2
br label %102
119: ; preds = %102
%120 = load i32, i32* %1
ret i32 %120
}

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 %s: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.8 = [11 x i8] c"%s\09\09%.2f\0A\0A\00"
@str = [162 x i8] c"Ol\C3\A1, meu nome \C3\A9 Bruno Lemos Landeiro e este programa pode ser visto no seguinte endere\C3\A7o do github: https://github.com/brunolandeiro/trabalhoAv2/prog1_av2_1.c\00"
@str.9 = [18 x i8] c"\0A\0AListagem da av1\00"
@str.10 = [17 x i8] c"----------------\00"
@str.11 = [18 x i8] c"Nome do aluno\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 ([162 x i8], [162 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), i8* %13)
%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 = %41, %22
%20 = add nuw nsw i64 %24, 1
%21 = icmp eq i64 %25, 30
br i1 %21, label %44, 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, %41
%31 = phi i64 [ %24, %27 ], [ %42, %41 ]
%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 %41
36: ; preds = %30
store float %34, float* %32
store float %33, float* %28
%37 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %2, i64 0, i64 %31, i64 0
%38 = call i32 @strcpy(i8* %6, i8* %37)
%39 = call i32 @strcpy(i8* %37, i8* %29)
%40 = call i32 @strcpy(i8* %29, i8* %6)
br label %41
41: ; preds = %30, %36
%42 = add nuw nsw i64 %31, 1
%43 = icmp eq i64 %42, 30
br i1 %43, label %19, label %30
44: ; preds = %19
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.9, i64 0, i64 0))
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.10, i64 0, i64 0))
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.11, i64 0, i64 0))
br label %48
48: ; preds = %44, %48
%49 = phi i64 [ 0, %44 ], [ %55, %48 ]
%50 = getelementptr inbounds [30 x [30 x i8]], [30 x [30 x i8]]* %2, i64 0, i64 %49, i64 0
%51 = getelementptr inbounds [30 x float], [30 x float]* %1, i64 0, i64 %49
%52 = load float, float* %51
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %50, double %53)
%55 = add nuw nsw i64 %49, 1
%56 = icmp eq i64 %55, 30
br i1 %56, label %57, label %48
57: ; preds = %48
ret i32 0
}