#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 *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  int n, i, j;
  printf("Enter the strength of the class: ");
  scanf("%d", &n);
  char class[n][80];
  printf("Enter the names of the students:\n");
  for (i = 0; i < n; i++)
    scanf("%s", class[i]);
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (strcmp(class[i], class[j]) <= 0) {
        char temp[80];
        strcpy(temp, class[i]);
        strcpy(class[i], class[j]);
        strcpy(class[j], temp);
      }
    }
  }
  printf("\nStudents in the class: \n");
  printf("-----------------------\n");
  for (i = 0; i < n; i++)
    printf("%d %s\n", i + 1, class[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x79(%rbp)
call   1040 <printf@plt>
mov    -0x79(%rbp),%al
lea    0xeb5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
shl    $0x4,%rcx
lea    (%rcx,%rcx,4),%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e8 <main+0xa8>
mov    -0x78(%rbp),%rsi
movslq -0xc(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%rsi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b1 <main+0x71>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12b2 <main+0x172>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    129f <main+0x15f>
mov    -0x78(%rbp),%rsi
movslq -0xc(%rbp),%rax
imul   $0x50,%rax,%rax
mov    %rsi,%rdi
add    %rax,%rdi
movslq -0x10(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jg     128c <main+0x14c>
mov    -0x78(%rbp),%rsi
lea    -0x70(%rbp),%rdi
movslq -0xc(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x78(%rbp),%rsi
movslq -0xc(%rbp),%rax
imul   $0x50,%rax,%rax
mov    %rsi,%rdi
add    %rax,%rdi
movslq -0x10(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x78(%rbp),%rdi
movslq -0x10(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%rdi
lea    -0x70(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1291 <main+0x151>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1202 <main+0xc2>
jmp    12a4 <main+0x164>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ef <main+0xaf>
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1312 <main+0x1d2>
mov    -0x78(%rbp),%rdx
mov    -0xc(%rbp),%esi
add    $0x1,%esi
movslq -0xc(%rbp),%rax
imul   $0x50,%rax,%rax
add    %rax,%rdx
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12d5 <main+0x195>
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    $0x68,%rsp
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %rsp,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r14
shl    $0x4,%rax
lea    (%rax,%rax,4),%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    0xe8f(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    1274 <main+0x124>
lea    0xe6f(%rip),%r15
mov    %r14,-0x38(%rbp)
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
add    $0x50,%r14
cmp    %rax,%rbx
jl     11c0 <main+0x70>
test   %eax,%eax
mov    -0x38(%rbp),%r14
jle    1274 <main+0x124>
xor    %r13d,%r13d
lea    -0x90(%rbp),%r15
jmp    1210 <main+0xc0>
cs nopw 0x0(%rax,%rax,1)
mov    -0x38(%rbp),%r14
movslq %eax,%rcx
add    $0x1,%r13
cmp    %rcx,%r13
jge    1274 <main+0x124>
test   %eax,%eax
jle    1204 <main+0xb4>
lea    0x0(,%r13,4),%r12
add    %r13,%r12
shl    $0x4,%r12
add    %r14,%r12
mov    %r14,%rbx
xor    %r14d,%r14d
jmp    1241 <main+0xf1>
xchg   %ax,%ax
add    $0x1,%r14
movslq -0x2c(%rbp),%rax
add    $0x50,%rbx
cmp    %rax,%r14
jge    1200 <main+0xb0>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jg     1230 <main+0xe0>
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
jmp    1230 <main+0xe0>
lea    0xdd5(%rip),%rdi
call   1040 <puts@plt>
lea    0xde2(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    12c0 <main+0x170>
lea    0xd8f(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
movslq -0x2c(%rbp),%rax
add    $0x50,%r14
cmp    %rax,%rbx
jl     12a0 <main+0x150>
mov    -0x40(%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):
@.str = [34 x i8] c"Enter the strength of the class: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"Enter the names of the students:\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [26 x i8] c"\0AStudents in the class: \0A\00"
@.str.5 = [25 x i8] c"-----------------------\0A\00"
@.str.6 = [7 x i8] c"%d %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca [80 x i8]
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca [80 x i8], i64 %11
store i64 %11, i64* %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %15
15: ; preds = %25, %0
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 %21
%23 = getelementptr inbounds [80 x i8], [80 x i8]* %22, i64 0, i64 0
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %19
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %15
28: ; preds = %15
store i32 0, i32* %3
br label %29
29: ; preds = %76, %28
%30 = load i32, i32* %3
%31 = load i32, i32* %2
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %79
33: ; preds = %29
store i32 0, i32* %4
br label %34
34: ; preds = %72, %33
%35 = load i32, i32* %4
%36 = load i32, i32* %2
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %75
38: ; preds = %34
%39 = load i32, i32* %3
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 %40
%42 = getelementptr inbounds [80 x i8], [80 x i8]* %41, i64 0, i64 0
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 %44
%46 = getelementptr inbounds [80 x i8], [80 x i8]* %45, i64 0, i64 0
%47 = call i64 @strcmp(i8* %42, i8* %46)
%48 = icmp sle i64 %47, 0
br i1 %48, label %49, label %71
49: ; preds = %38
%50 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%51 = load i32, i32* %3
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 %52
%54 = getelementptr inbounds [80 x i8], [80 x i8]* %53, i64 0, i64 0
%55 = call i32 @strcpy(i8* %50, i8* %54)
%56 = load i32, i32* %3
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 %57
%59 = getelementptr inbounds [80 x i8], [80 x i8]* %58, i64 0, i64 0
%60 = load i32, i32* %4
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 %61
%63 = getelementptr inbounds [80 x i8], [80 x i8]* %62, i64 0, i64 0
%64 = call i32 @strcpy(i8* %59, i8* %63)
%65 = load i32, i32* %4
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 %66
%68 = getelementptr inbounds [80 x i8], [80 x i8]* %67, i64 0, i64 0
%69 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%70 = call i32 @strcpy(i8* %68, i8* %69)
br label %71
71: ; preds = %49, %38
br label %72
72: ; preds = %71
%73 = load i32, i32* %4
%74 = add nsw i32 %73, 1
store i32 %74, i32* %4
br label %34
75: ; preds = %34
br label %76
76: ; preds = %75
%77 = load i32, i32* %3
%78 = add nsw i32 %77, 1
store i32 %78, i32* %3
br label %29
79: ; preds = %29
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %82
82: ; preds = %94, %79
%83 = load i32, i32* %3
%84 = load i32, i32* %2
%85 = icmp slt i32 %83, %84
br i1 %85, label %86, label %97
86: ; preds = %82
%87 = load i32, i32* %3
%88 = add nsw i32 %87, 1
%89 = load i32, i32* %3
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 %90
%92 = getelementptr inbounds [80 x i8], [80 x i8]* %91, i64 0, i64 0
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %88, i8* %92)
br label %94
94: ; preds = %86
%95 = load i32, i32* %3
%96 = add nsw i32 %95, 1
store i32 %96, i32* %3
br label %82
97: ; preds = %82
%98 = load i8*, i8** %5
%99 = load i32, i32* %1
ret i32 %99
}

LLVM IR (-O2):
@.str = [34 x i8] c"Enter the strength of the class: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.6 = [7 x i8] c"%d %s\0A\00"
@str = [33 x i8] c"Enter the names of the students:\00"
@str.7 = [25 x i8] c"\0AStudents in the class: \00"
@str.8 = [24 x i8] c"-----------------------\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
%9 = alloca [80 x i8], i64 %7
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %17, label %50
13: ; preds = %17
%14 = icmp sgt i32 %22, 0
br i1 %14, label %15, label %50
15: ; preds = %13
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
br label %25
17: ; preds = %0, %17
%18 = phi i64 [ %21, %17 ], [ 0, %0 ]
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 %18, i64 0
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %19)
%21 = add nuw nsw i64 %18, 1
%22 = load i32, i32* %1
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %17, label %13
25: ; preds = %15, %45
%26 = phi i32 [ %22, %15 ], [ %46, %45 ]
%27 = phi i64 [ 0, %15 ], [ %48, %45 ]
%28 = icmp sgt i32 %26, 0
br i1 %28, label %29, label %45
29: ; preds = %25
%30 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 %27, i64 0
br label %31
31: ; preds = %29, %40
%32 = phi i64 [ 0, %29 ], [ %41, %40 ]
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 %32, i64 0
%34 = call i64 @strcmp(i8* %30, i8* %33)
%35 = icmp slt i64 %34, 1
br i1 %35, label %36, label %40
36: ; preds = %31
%37 = call i32 @strcpy(i8* %16, i8* %30)
%38 = call i32 @strcpy(i8* %30, i8* %33)
%39 = call i32 @strcpy(i8* %33, i8* %16)
br label %40
40: ; preds = %31, %36
%41 = add nuw nsw i64 %32, 1
%42 = load i32, i32* %1
%43 = sext i32 %42 to i64
%44 = icmp slt i64 %41, %43
br i1 %44, label %31, label %45
45: ; preds = %40, %25
%46 = phi i32 [ %26, %25 ], [ %42, %40 ]
%47 = sext i32 %46 to i64
%48 = add nuw nsw i64 %27, 1
%49 = icmp slt i64 %48, %47
br i1 %49, label %25, label %50
50: ; preds = %45, %0, %13
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.8, i64 0, i64 0))
%53 = load i32, i32* %1
%54 = icmp sgt i32 %53, 0
br i1 %54, label %55, label %64
55: ; preds = %50, %55
%56 = phi i64 [ %57, %55 ], [ 0, %50 ]
%57 = add nuw nsw i64 %56, 1
%58 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 %56, i64 0
%59 = trunc i64 %57 to i32
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %59, i8* %58)
%61 = load i32, i32* %1
%62 = sext i32 %61 to i64
%63 = icmp slt i64 %57, %62
br i1 %63, label %55, label %64
64: ; preds = %55, %50
ret i32 0
}