#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*/ cmp(char *, char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
void main() {
  char s[5][100], *p[5];
  int i, j;
  printf("Input 5 strings:\n");
  for (i = 0; i < 5; i++)
    gets(s[i]);
  printf("-------------------------\n");
  for (i = 0; i < 5; i++)
    p[i] = s[i];
  for (i = 0; i < 5; i++)
    for (j = i + 1; j < 5; j++)
      cmp(p[i], p[j]);
  for (i = 0; i < 5; i++)
    puts(s[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x234(%rbp)
cmpl   $0x5,-0x234(%rbp)
jge    119c <main+0x5c>
movslq -0x234(%rbp),%rax
lea    -0x200(%rbp),%rdi
imul   $0x64,%rax,%rax
add    %rax,%rdi
call   1060 <gets@plt>
mov    -0x234(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x234(%rbp)
jmp    1161 <main+0x21>
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x234(%rbp)
cmpl   $0x5,-0x234(%rbp)
jge    11f7 <main+0xb7>
movslq -0x234(%rbp),%rax
lea    -0x200(%rbp),%rcx
imul   $0x64,%rax,%rax
add    %rax,%rcx
movslq -0x234(%rbp),%rax
mov    %rcx,-0x230(%rbp,%rax,8)
ff
mov    -0x234(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x234(%rbp)
jmp    11b2 <main+0x72>
movl   $0x0,-0x234(%rbp)
cmpl   $0x5,-0x234(%rbp)
jge    127a <main+0x13a>
mov    -0x234(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x238(%rbp)
cmpl   $0x5,-0x238(%rbp)
jge    1261 <main+0x121>
movslq -0x234(%rbp),%rax
mov    -0x230(%rbp,%rax,8),%rdi
ff
movslq -0x238(%rbp),%rax
mov    -0x230(%rbp,%rax,8),%rsi
ff
call   1050 <cmp@plt>
mov    -0x238(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x238(%rbp)
jmp    121d <main+0xdd>
jmp    1266 <main+0x126>
mov    -0x234(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x234(%rbp)
jmp    1201 <main+0xc1>
movl   $0x0,-0x234(%rbp)
cmpl   $0x5,-0x234(%rbp)
jge    12bf <main+0x17f>
movslq -0x234(%rbp),%rax
lea    -0x200(%rbp),%rdi
imul   $0x64,%rax,%rax
add    %rax,%rdi
call   1030 <puts@plt>
mov    -0x234(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x234(%rbp)
jmp    1284 <main+0x144>
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x200,%rsp
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%r15
mov    %r15,%rdi
call   1050 <gets@plt>
lea    0x64(%rsp),%r14
mov    %r14,%rdi
call   1050 <gets@plt>
lea    0xc8(%rsp),%r12
mov    %r12,%rdi
call   1050 <gets@plt>
lea    0x12c(%rsp),%r13
mov    %r13,%rdi
call   1050 <gets@plt>
lea    0x190(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <cmp@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <cmp@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1040 <cmp@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <cmp@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <cmp@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1040 <cmp@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <cmp@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <cmp@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <cmp@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <cmp@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Input 5 strings:\0A\00"
@.str.1 = [27 x i8] c"-------------------------\0A\00"
define void @main() {
%1 = alloca [5 x [100 x i8]]
%2 = alloca [5 x i8*]
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 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, 5
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [5 x [100 x i8]], [5 x [100 x i8]]* %1, i64 0, i64 %11
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%14 = call i32 @gets(i8* %13)
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 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %20
20: ; preds = %31, %18
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %34
23: ; preds = %20
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x [100 x i8]], [5 x [100 x i8]]* %1, i64 0, i64 %25
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %26, i64 0, i64 0
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %29
store i8* %27, i8** %30
br label %31
31: ; preds = %23
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %20
34: ; preds = %20
store i32 0, i32* %3
br label %35
35: ; preds = %58, %34
%36 = load i32, i32* %3
%37 = icmp slt i32 %36, 5
br i1 %37, label %38, label %61
38: ; preds = %35
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %41
41: ; preds = %54, %38
%42 = load i32, i32* %4
%43 = icmp slt i32 %42, 5
br i1 %43, label %44, label %57
44: ; preds = %41
%45 = load i32, i32* %3
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %46
%48 = load i8*, i8** %47
%49 = load i32, i32* %4
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %50
%52 = load i8*, i8** %51
%53 = call i32 @cmp(i8* %48, i8* %52)
br label %54
54: ; preds = %44
%55 = load i32, i32* %4
%56 = add nsw i32 %55, 1
store i32 %56, i32* %4
br label %41
57: ; preds = %41
br label %58
58: ; preds = %57
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
br label %35
61: ; preds = %35
store i32 0, i32* %3
br label %62
62: ; preds = %71, %61
%63 = load i32, i32* %3
%64 = icmp slt i32 %63, 5
br i1 %64, label %65, label %74
65: ; preds = %62
%66 = load i32, i32* %3
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [5 x [100 x i8]], [5 x [100 x i8]]* %1, i64 0, i64 %67
%69 = getelementptr inbounds [100 x i8], [100 x i8]* %68, i64 0, i64 0
%70 = call i32 @puts(i8* %69)
br label %71
71: ; preds = %65
%72 = load i32, i32* %3
%73 = add nsw i32 %72, 1
store i32 %73, i32* %3
br label %62
74: ; preds = %62
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"Input 5 strings:\00"
@str.2 = [26 x i8] c"-------------------------\00"
define void @main() {
%1 = alloca [5 x [100 x i8]]
%2 = getelementptr inbounds [5 x [100 x i8]], [5 x [100 x i8]]* %1, i64 0, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = getelementptr inbounds [5 x [100 x i8]], [5 x [100 x i8]]* %1, i64 0, i64 1, i64 0
%6 = call i32 @gets(i8* %5)
%7 = getelementptr inbounds [5 x [100 x i8]], [5 x [100 x i8]]* %1, i64 0, i64 2, i64 0
%8 = call i32 @gets(i8* %7)
%9 = getelementptr inbounds [5 x [100 x i8]], [5 x [100 x i8]]* %1, i64 0, i64 3, i64 0
%10 = call i32 @gets(i8* %9)
%11 = getelementptr inbounds [5 x [100 x i8]], [5 x [100 x i8]]* %1, i64 0, i64 4, i64 0
%12 = call i32 @gets(i8* %11)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.2, i64 0, i64 0))
%14 = call i32 @cmp(i8* %2, i8* %5)
%15 = call i32 @cmp(i8* %2, i8* %7)
%16 = call i32 @cmp(i8* %2, i8* %9)
%17 = call i32 @cmp(i8* %2, i8* %11)
%18 = call i32 @cmp(i8* %5, i8* %7)
%19 = call i32 @cmp(i8* %5, i8* %9)
%20 = call i32 @cmp(i8* %5, i8* %11)
%21 = call i32 @cmp(i8* %7, i8* %9)
%22 = call i32 @cmp(i8* %7, i8* %11)
%23 = call i32 @cmp(i8* %9, i8* %11)
%24 = call i32 @puts(i8* %2)
%25 = call i32 @puts(i8* %5)
%26 = call i32 @puts(i8* %7)
%27 = call i32 @puts(i8* %9)
%28 = call i32 @puts(i8* %11)
ret void
}