#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sort(char **, int);
void main() {
  char str[3][80];
  char(*p)[80];
  int i;
  p = str;
  printf("Enter the three string:\n");
  for (i = 0; i < 3; i++) {
    gets(*p);
    p++;
  }
  p = str;
  sort(str, 3);
  printf("Order string:\n");
  for (i = 0; i < 3; i++) {
    printf("%s\n", str[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0xf0(%rbp),%rax
mov    %rax,-0xf8(%rbp)
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xfc(%rbp)
cmpl   $0x3,-0xfc(%rbp)
jge    11a0 <main+0x70>
mov    -0xf8(%rbp),%rdi
call   1050 <gets@plt>
mov    -0xf8(%rbp),%rax
add    $0x50,%rax
mov    %rax,-0xf8(%rbp)
mov    -0xfc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc(%rbp)
jmp    1161 <main+0x31>
lea    -0xf0(%rbp),%rax
mov    %rax,-0xf8(%rbp)
lea    -0xf0(%rbp),%rdi
mov    $0x3,%esi
call   1040 <sort@plt>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xfc(%rbp)
cmpl   $0x3,-0xfc(%rbp)
jge    121b <main+0xeb>
movslq -0xfc(%rbp),%rax
lea    -0xf0(%rbp),%rsi
imul   $0x50,%rax,%rax
add    %rax,%rsi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xfc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc(%rbp)
jmp    11d7 <main+0xa7>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xf0,%rsp
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0x50(%rsp),%r14
mov    %r14,%rdi
call   1050 <gets@plt>
lea    0xa0(%rsp),%r15
mov    %r15,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <sort@plt>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
add    $0xf0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter the three string:\0A\00"
@.str.1 = [15 x i8] c"Order string:\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca [3 x [80 x i8]]
%2 = alloca [80 x i8]*
%3 = alloca i32
%4 = getelementptr inbounds [3 x [80 x i8]], [3 x [80 x i8]]* %1, i64 0, i64 0
store [80 x i8]* %4, [80 x i8]** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %6
6: ; preds = %15, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 3
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load [80 x i8]*, [80 x i8]** %2
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%12 = call i32 @gets(i8* %11)
%13 = load [80 x i8]*, [80 x i8]** %2
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i32 1
store [80 x i8]* %14, [80 x i8]** %2
br label %15
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %6
18: ; preds = %6
%19 = getelementptr inbounds [3 x [80 x i8]], [3 x [80 x i8]]* %1, i64 0, i64 0
store [80 x i8]* %19, [80 x i8]** %2
%20 = getelementptr inbounds [3 x [80 x i8]], [3 x [80 x i8]]* %1, i64 0, i64 0
%21 = bitcast [80 x i8]* %20 to i8**
%22 = call i32 @sort(i8** %21, i32 3)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %24
24: ; preds = %33, %18
%25 = load i32, i32* %3
%26 = icmp slt i32 %25, 3
br i1 %26, label %27, label %36
27: ; preds = %24
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [3 x [80 x i8]], [3 x [80 x i8]]* %1, i64 0, i64 %29
%31 = getelementptr inbounds [80 x i8], [80 x i8]* %30, i64 0, i64 0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %27
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %24
36: ; preds = %24
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"Enter the three string:\00"
@str.3 = [14 x i8] c"Order string:\00"
define void @main() {
%1 = alloca [3 x [80 x i8]]
%2 = getelementptr inbounds [3 x [80 x i8]], [3 x [80 x i8]]* %1, i64 0, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [3 x [80 x i8]], [3 x [80 x i8]]* %1, i64 0, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = getelementptr inbounds [3 x [80 x i8]], [3 x [80 x i8]]* %1, i64 0, i64 1, i64 0
%7 = call i32 @gets(i8* %6)
%8 = getelementptr inbounds [3 x [80 x i8]], [3 x [80 x i8]]* %1, i64 0, i64 2, i64 0
%9 = call i32 @gets(i8* %8)
%10 = bitcast [3 x [80 x i8]]* %1 to i8**
%11 = call i32 @sort(i8** %10, i32 3)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.3, i64 0, i64 0))
%13 = call i32 @puts(i8* %2)
%14 = getelementptr inbounds [3 x [80 x i8]], [3 x [80 x i8]]* %1, i64 0, i64 1, i64 0
%15 = call i32 @puts(i8* %14)
%16 = getelementptr inbounds [3 x [80 x i8]], [3 x [80 x i8]]* %1, i64 0, i64 2, i64 0
%17 = call i32 @puts(i8* %16)
ret void
}