#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 *, ...);
void display(char name[][40], float w[], float q[], float t[], float p[],
             float e[], float total[], char grade[][3]) {
  int i;
  printf("                                       Students                      "
         "            \n\n");
  printf("Sudent "
         "Name\t\tW(30%%)\tQ(15%%)\tT(20%%)\tP(15%%)\tE(20%%)\tTOTAL(100%%)"
         "\tGRADE\n\n");
  for (i = 0; i < 100; i++) {
    printf("%-17s\t%3.0f\t%3.0f\t%3.0f\t%3.0f\t%3.0f\t %3.2f\t\t %-3s\n",
           name[i], w[i], q[i], t[i], p[i], e[i], total[i], grade[i]);
  }
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x64,-0x34(%rbp)
jge    1205 <display+0xf5>
mov    -0x8(%rbp),%rsi
movslq -0x34(%rbp),%rax
imul   $0x28,%rax,%rax
add    %rax,%rsi
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
cvtss2sd %xmm2,%xmm2
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm3
cvtss2sd %xmm3,%xmm3
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm4
cvtss2sd %xmm4,%xmm4
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm5
cvtss2sd %xmm5,%xmm5
mov    0x18(%rbp),%rdx
movslq -0x34(%rbp),%rax
imul   $0x3,%rax,%rax
add    %rax,%rdx
lea    0xeae(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    115b <display+0x4b>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0x58(%rsp),%r14
lea    0xf2d(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
movss  (%rbx,%r15,1),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x0(%r13,%r15,1),%xmm1
cvtss2sd %xmm1,%xmm1
movss  (%r12,%r15,1),%xmm2
cvtss2sd %xmm2,%xmm2
mov    0x8(%rsp),%rax
movss  (%rax,%r15,1),%xmm3
cvtss2sd %xmm3,%xmm3
mov    0x10(%rsp),%rax
movss  (%rax,%r15,1),%xmm4
cvtss2sd %xmm4,%xmm4
mov    0x50(%rsp),%rax
movss  (%rax,%r15,1),%xmm5
cvtss2sd %xmm5,%xmm5
lea    0xe87(%rip),%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    $0x6,%al
call   1040 <printf@plt>
add    $0x4,%r15
add    $0x28,%rbp
add    $0x3,%r14
cmp    $0x190,%r15
jne    1170 <display+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [84 x i8] c" Students \0A\0A\00"
@.str.1 = [74 x i8] c"Sudent Name\09\09W(30%%)\09Q(15%%)\09T(20%%)\09P(15%%)\09E(20%%)\09TOTAL(100%%)\09GRADE\0A\0A\00"
@.str.2 = [51 x i8] c"%-17s\09%3.0f\09%3.0f\09%3.0f\09%3.0f\09%3.0f\09 %3.2f\09\09 %-3s\0A\00"
define void @display([40 x i8]* %0, float* %1, float* %2, float* %3, float* %4, float* %5, float* %6, [3 x i8]* %7) {
%9 = alloca [40 x i8]*
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float*
%14 = alloca float*
%15 = alloca float*
%16 = alloca [3 x i8]*
%17 = alloca i32
store [40 x i8]* %0, [40 x i8]** %9
store float* %1, float** %10
store float* %2, float** %11
store float* %3, float** %12
store float* %4, float** %13
store float* %5, float** %14
store float* %6, float** %15
store [3 x i8]* %7, [3 x i8]** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %17
br label %20
20: ; preds = %71, %8
%21 = load i32, i32* %17
%22 = icmp slt i32 %21, 100
br i1 %22, label %23, label %74
23: ; preds = %20
%24 = load [40 x i8]*, [40 x i8]** %9
%25 = load i32, i32* %17
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [40 x i8], [40 x i8]* %24, i64 %26
%28 = getelementptr inbounds [40 x i8], [40 x i8]* %27, i64 0, i64 0
%29 = load float*, float** %10
%30 = load i32, i32* %17
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds float, float* %29, i64 %31
%33 = load float, float* %32
%34 = fpext float %33 to double
%35 = load float*, float** %11
%36 = load i32, i32* %17
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds float, float* %35, i64 %37
%39 = load float, float* %38
%40 = fpext float %39 to double
%41 = load float*, float** %12
%42 = load i32, i32* %17
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds float, float* %41, i64 %43
%45 = load float, float* %44
%46 = fpext float %45 to double
%47 = load float*, float** %13
%48 = load i32, i32* %17
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds float, float* %47, i64 %49
%51 = load float, float* %50
%52 = fpext float %51 to double
%53 = load float*, float** %14
%54 = load i32, i32* %17
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds float, float* %53, i64 %55
%57 = load float, float* %56
%58 = fpext float %57 to double
%59 = load float*, float** %15
%60 = load i32, i32* %17
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds float, float* %59, i64 %61
%63 = load float, float* %62
%64 = fpext float %63 to double
%65 = load [3 x i8]*, [3 x i8]** %16
%66 = load i32, i32* %17
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [3 x i8], [3 x i8]* %65, i64 %67
%69 = getelementptr inbounds [3 x i8], [3 x i8]* %68, i64 0, i64 0
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %28, double %34, double %40, double %46, double %52, double %58, double %64, i8* %69)
br label %71
71: ; preds = %23
%72 = load i32, i32* %17
%73 = add nsw i32 %72, 1
store i32 %73, i32* %17
br label %20
74: ; preds = %20
ret void
}

LLVM IR (-O2):
@.str.1 = [74 x i8] c"Sudent Name\09\09W(30%%)\09Q(15%%)\09T(20%%)\09P(15%%)\09E(20%%)\09TOTAL(100%%)\09GRADE\0A\0A\00"
@.str.2 = [51 x i8] c"%-17s\09%3.0f\09%3.0f\09%3.0f\09%3.0f\09%3.0f\09 %3.2f\09\09 %-3s\0A\00"
@str = [83 x i8] c" Students \0A\00"
define void @display([40 x i8]* %0, float* nocapture %1, float* nocapture %2, float* nocapture %3, float* nocapture %4, float* nocapture %5, float* nocapture %6, [3 x i8]* %7) {
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %8, %11
%12 = phi i64 [ 0, %8 ], [ %34, %11 ]
%13 = getelementptr inbounds [40 x i8], [40 x i8]* %0, i64 %12, i64 0
%14 = getelementptr inbounds float, float* %1, i64 %12
%15 = load float, float* %14
%16 = fpext float %15 to double
%17 = getelementptr inbounds float, float* %2, i64 %12
%18 = load float, float* %17
%19 = fpext float %18 to double
%20 = getelementptr inbounds float, float* %3, i64 %12
%21 = load float, float* %20
%22 = fpext float %21 to double
%23 = getelementptr inbounds float, float* %4, i64 %12
%24 = load float, float* %23
%25 = fpext float %24 to double
%26 = getelementptr inbounds float, float* %5, i64 %12
%27 = load float, float* %26
%28 = fpext float %27 to double
%29 = getelementptr inbounds float, float* %6, i64 %12
%30 = load float, float* %29
%31 = fpext float %30 to double
%32 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 %12, i64 0
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %13, double %16, double %19, double %22, double %25, double %28, double %31, i8* %32)
%34 = add nuw nsw i64 %12, 1
%35 = icmp eq i64 %34, 100
br i1 %35, label %36, label %11
36: ; preds = %11
ret void
}