#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 */
char getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  int iNum, i, j;
  char acNames[100][50], cTemp[50], ch;
  printf("\nEnter no of elements\n");
  scanf("%d", &iNum);
  ch = getchar();
  printf("\nEnter the list of names\n");
  for (i = 0; i < iNum; i++)
    gets(acNames[i]);
  for (i = 0; i < iNum - 1; i++) {
    for (j = 0; j < iNum - i - 1; j++) {
      if (strcmp(acNames[j], acNames[j + 1]) > 0) {
        strcpy(cTemp, acNames[j]);
        strcpy(acNames[j], acNames[j + 1]);
        strcpy(acNames[j + 1], cTemp);
      }
    }
  }
  printf("\nThe Sorted name list is \n");
  for (i = 0; i < iNum; i++) {
    puts(acNames[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
call   1050 <printf@plt>
lea    0xe82(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1090 <scanf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %al,-0x13e1(%rbp)
lea    0xe68(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ef <main+0x7f>
movslq -0xc(%rbp),%rax
lea    -0x13a0(%rbp),%rdi
imul   $0x32,%rax,%rax
add    %rax,%rdi
call   1080 <gets@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11be <main+0x4e>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12ec <main+0x17c>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12d9 <main+0x169>
movslq -0x10(%rbp),%rax
lea    -0x13a0(%rbp),%rdi
imul   $0x32,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cltq
lea    -0x13a0(%rbp),%rsi
imul   $0x32,%rax,%rax
add    %rax,%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jle    12c6 <main+0x156>
lea    -0x13e0(%rbp),%rdi
movslq -0x10(%rbp),%rax
lea    -0x13a0(%rbp),%rsi
imul   $0x32,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
movslq -0x10(%rbp),%rax
lea    -0x13a0(%rbp),%rdi
imul   $0x32,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cltq
lea    -0x13a0(%rbp),%rsi
imul   $0x32,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cltq
lea    -0x13a0(%rbp),%rdi
imul   $0x32,%rax,%rax
add    %rax,%rdi
lea    -0x13e0(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    12cb <main+0x15b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120e <main+0x9e>
jmp    12de <main+0x16e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f6 <main+0x86>
lea    0xd41(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1330 <main+0x1c0>
movslq -0xc(%rbp),%rax
lea    -0x13a0(%rbp),%rdi
imul   $0x32,%rax,%rax
add    %rax,%rdi
call   1040 <puts@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12ff <main+0x18f>
lea    0xd16(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x13f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x13d8,%rsp
lea    0xe7b(%rip),%rdi
call   1050 <puts@plt>
lea    0xe6c(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1090 <scanf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
lea    0xe6d(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    127d <main+0x10d>
lea    0x50(%rsp),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1080 <gets@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
add    $0x32,%rbx
cmp    %rax,%rbp
jl     11d0 <main+0x60>
cmp    $0x2,%eax
jl     127d <main+0x10d>
xor    %r12d,%r12d
lea    0x10(%rsp),%r14
jmp    120c <main+0x9c>
nopl   (%rax)
add    $0x1,%r12d
lea    -0x1(%rax),%ecx
cmp    %ecx,%r12d
jge    127d <main+0x10d>
mov    %r12d,%ebp
not    %ebp
lea    (%rax,%rbp,1),%ecx
test   %ecx,%ecx
jle    1200 <main+0x90>
lea    0x50(%rsp),%rbx
xor    %r13d,%r13d
jmp    1242 <main+0xd2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0xc(%rsp),%eax
lea    (%rax,%rbp,1),%ecx
movslq %ecx,%rcx
mov    %r15,%rbx
cmp    %rcx,%r13
jge    1200 <main+0x90>
add    $0x1,%r13
lea    0x32(%rbx),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jle    1230 <main+0xc0>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
jmp    1230 <main+0xc0>
lea    0xdae(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    12ba <main+0x14a>
lea    0x50(%rsp),%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <puts@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
add    $0x32,%rbx
cmp    %rax,%rbp
jl     12a0 <main+0x130>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x13d8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0AEnter no of elements\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"\0AEnter the list of names\0A\00"
@.str.3 = [27 x i8] c"\0AThe Sorted name list is \0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100 x [50 x i8]]
%6 = alloca [50 x i8]
%7 = alloca i8
store i32 0, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %7
%11 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %12
12: ; preds = %22, %0
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x [50 x i8]], [100 x [50 x i8]]* %5, i64 0, i64 %18
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %19, i64 0, i64 0
%21 = call i32 @gets(i8* %20)
br label %22
22: ; preds = %16
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %12
25: ; preds = %12
store i32 0, i32* %3
br label %26
26: ; preds = %80, %25
%27 = load i32, i32* %3
%28 = load i32, i32* %2
%29 = sub nsw i32 %28, 1
%30 = icmp slt i32 %27, %29
br i1 %30, label %31, label %83
31: ; preds = %26
store i32 0, i32* %4
br label %32
32: ; preds = %76, %31
%33 = load i32, i32* %4
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = sub nsw i32 %34, %35
%37 = sub nsw i32 %36, 1
%38 = icmp slt i32 %33, %37
br i1 %38, label %39, label %79
39: ; preds = %32
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x [50 x i8]], [100 x [50 x i8]]* %5, i64 0, i64 %41
%43 = getelementptr inbounds [50 x i8], [50 x i8]* %42, i64 0, i64 0
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [100 x [50 x i8]], [100 x [50 x i8]]* %5, i64 0, i64 %46
%48 = getelementptr inbounds [50 x i8], [50 x i8]* %47, i64 0, i64 0
%49 = call i64 @strcmp(i8* %43, i8* %48)
%50 = icmp sgt i64 %49, 0
br i1 %50, label %51, label %75
51: ; preds = %39
%52 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%53 = load i32, i32* %4
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [100 x [50 x i8]], [100 x [50 x i8]]* %5, i64 0, i64 %54
%56 = getelementptr inbounds [50 x i8], [50 x i8]* %55, i64 0, i64 0
%57 = call i32 @strcpy(i8* %52, i8* %56)
%58 = load i32, i32* %4
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [100 x [50 x i8]], [100 x [50 x i8]]* %5, i64 0, i64 %59
%61 = getelementptr inbounds [50 x i8], [50 x i8]* %60, i64 0, i64 0
%62 = load i32, i32* %4
%63 = add nsw i32 %62, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [100 x [50 x i8]], [100 x [50 x i8]]* %5, i64 0, i64 %64
%66 = getelementptr inbounds [50 x i8], [50 x i8]* %65, i64 0, i64 0
%67 = call i32 @strcpy(i8* %61, i8* %66)
%68 = load i32, i32* %4
%69 = add nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [100 x [50 x i8]], [100 x [50 x i8]]* %5, i64 0, i64 %70
%72 = getelementptr inbounds [50 x i8], [50 x i8]* %71, i64 0, i64 0
%73 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%74 = call i32 @strcpy(i8* %72, i8* %73)
br label %75
75: ; preds = %51, %39
br label %76
76: ; preds = %75
%77 = load i32, i32* %4
%78 = add nsw i32 %77, 1
store i32 %78, i32* %4
br label %32
79: ; preds = %32
br label %80
80: ; preds = %79
%81 = load i32, i32* %3
%82 = add nsw i32 %81, 1
store i32 %82, i32* %3
br label %26
83: ; preds = %26
%84 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %85
85: ; preds = %95, %83
%86 = load i32, i32* %3
%87 = load i32, i32* %2
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %98
89: ; preds = %85
%90 = load i32, i32* %3
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [100 x [50 x i8]], [100 x [50 x i8]]* %5, i64 0, i64 %91
%93 = getelementptr inbounds [50 x i8], [50 x i8]* %92, i64 0, i64 0
%94 = call i32 @puts(i8* %93)
br label %95
95: ; preds = %89
%96 = load i32, i32* %3
%97 = add nsw i32 %96, 1
store i32 %97, i32* %3
br label %85
98: ; preds = %85
%99 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

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