#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 *, char *);
int main() {
  void sort(char *[]);
  int i;
  char *p[10];
  char str[10][20];
  for (i = 0; i < 10; i++)
    p[i] = str[i];
  printf("input 10 strings:\n");
  for (i = 0; i < 10; i++)
    scanf("%s", p[i]);
  sort(p);
  printf("now the sequence is:\n");
  for (i = 0; i < 10; i++)
    printf("%s\n", p[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    117c <main+0x4c>
movslq -0x8(%rbp),%rax
lea    -0x130(%rbp),%rcx
imul   $0x14,%rax,%rax
add    %rax,%rcx
movslq -0x8(%rbp),%rax
mov    %rcx,-0x60(%rbp,%rax,8)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1149 <main+0x19>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11be <main+0x8e>
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
lea    0xe68(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1191 <main+0x61>
lea    -0x60(%rbp),%rdi
call   1040 <sort@plt>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    120b <main+0xdb>
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11dc <main+0xac>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x120,%rsp
lea    0x50(%rsp),%rax
mov    %rax,(%rsp)
lea    0x64(%rsp),%rax
mov    %rax,0x8(%rsp)
lea    0x78(%rsp),%rax
mov    %rax,0x10(%rsp)
lea    0x8c(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0xa0(%rsp),%rax
mov    %rax,0x20(%rsp)
lea    0xb4(%rsp),%rax
mov    %rax,0x28(%rsp)
lea    0xc8(%rsp),%rax
mov    %rax,0x30(%rsp)
lea    0xdc(%rsp),%rax
mov    %rax,0x38(%rsp)
lea    0xf0(%rsp),%rax
mov    %rax,0x40(%rsp)
lea    0x104(%rsp),%rax
mov    %rax,0x48(%rsp)
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%rsi
lea    0xe39(%rip),%rbx
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x38(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x40(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x48(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %rsp,%rdi
call   1040 <sort@plt>
lea    0xdc2(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%rdi
call   1030 <puts@plt>
mov    0x18(%rsp),%rdi
call   1030 <puts@plt>
mov    0x20(%rsp),%rdi
call   1030 <puts@plt>
mov    0x28(%rsp),%rdi
call   1030 <puts@plt>
mov    0x30(%rsp),%rdi
call   1030 <puts@plt>
mov    0x38(%rsp),%rdi
call   1030 <puts@plt>
mov    0x40(%rsp),%rdi
call   1030 <puts@plt>
mov    0x48(%rsp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"input 10 strings:\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [22 x i8] c"now the sequence is:\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i8*]
%4 = alloca [10 x [20 x i8]]
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %16, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %4, i64 0, i64 %10
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %11, i64 0, i64 0
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i8*], [10 x i8*]* %3, i64 0, i64 %14
store i8* %12, i8** %15
br label %16
16: ; preds = %8
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %5
19: ; preds = %5
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %21
21: ; preds = %30, %19
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 10
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x i8*], [10 x i8*]* %3, i64 0, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %24
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %21
33: ; preds = %21
%34 = getelementptr inbounds [10 x i8*], [10 x i8*]* %3, i64 0, i64 0
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %36
36: ; preds = %45, %33
%37 = load i32, i32* %2
%38 = icmp slt i32 %37, 10
br i1 %38, label %39, label %48
39: ; preds = %36
%40 = load i32, i32* %2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [10 x i8*], [10 x i8*]* %3, i64 0, i64 %41
%43 = load i8*, i8** %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %43)
br label %45
45: ; preds = %39
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
store i32 %47, i32* %2
br label %36
48: ; preds = %36
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@str = [18 x i8] c"input 10 strings:\00"
@str.4 = [21 x i8] c"now the sequence is:\00"
define i32 @main() {
%1 = alloca [10 x i8*]
%2 = alloca [10 x [20 x i8]]
%3 = bitcast [10 x i8*]* %1 to i8*
%4 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %2, i64 0, i64 0, i64 0
%5 = getelementptr inbounds [10 x i8*], [10 x i8*]* %1, i64 0, i64 0
store i8* %4, i8** %5
%6 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %2, i64 0, i64 1, i64 0
%7 = getelementptr inbounds [10 x i8*], [10 x i8*]* %1, i64 0, i64 1
store i8* %6, i8** %7
%8 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %2, i64 0, i64 2, i64 0
%9 = getelementptr inbounds [10 x i8*], [10 x i8*]* %1, i64 0, i64 2
store i8* %8, i8** %9
%10 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %2, i64 0, i64 3, i64 0
%11 = getelementptr inbounds [10 x i8*], [10 x i8*]* %1, i64 0, i64 3
store i8* %10, i8** %11
%12 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %2, i64 0, i64 4, i64 0
%13 = getelementptr inbounds [10 x i8*], [10 x i8*]* %1, i64 0, i64 4
store i8* %12, i8** %13
%14 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %2, i64 0, i64 5, i64 0
%15 = getelementptr inbounds [10 x i8*], [10 x i8*]* %1, i64 0, i64 5
store i8* %14, i8** %15
%16 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %2, i64 0, i64 6, i64 0
%17 = getelementptr inbounds [10 x i8*], [10 x i8*]* %1, i64 0, i64 6
store i8* %16, i8** %17
%18 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %2, i64 0, i64 7, i64 0
%19 = getelementptr inbounds [10 x i8*], [10 x i8*]* %1, i64 0, i64 7
store i8* %18, i8** %19
%20 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %2, i64 0, i64 8, i64 0
%21 = getelementptr inbounds [10 x i8*], [10 x i8*]* %1, i64 0, i64 8
store i8* %20, i8** %21
%22 = getelementptr inbounds [10 x [20 x i8]], [10 x [20 x i8]]* %2, i64 0, i64 9, i64 0
%23 = getelementptr inbounds [10 x i8*], [10 x i8*]* %1, i64 0, i64 9
store i8* %22, i8** %23
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%25 = load i8*, i8** %5
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = load i8*, i8** %7
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = load i8*, i8** %9
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = load i8*, i8** %11
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i8*, i8** %13
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %33)
%35 = load i8*, i8** %15
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = load i8*, i8** %17
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %37)
%39 = load i8*, i8** %19
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %39)
%41 = load i8*, i8** %21
%42 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %41)
%43 = load i8*, i8** %23
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %43)
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.4, i64 0, i64 0))
%46 = load i8*, i8** %5
%47 = call i32 @puts(i8* dereferenceable(1) %46)
%48 = load i8*, i8** %7
%49 = call i32 @puts(i8* dereferenceable(1) %48)
%50 = load i8*, i8** %9
%51 = call i32 @puts(i8* dereferenceable(1) %50)
%52 = load i8*, i8** %11
%53 = call i32 @puts(i8* dereferenceable(1) %52)
%54 = load i8*, i8** %13
%55 = call i32 @puts(i8* dereferenceable(1) %54)
%56 = load i8*, i8** %15
%57 = call i32 @puts(i8* dereferenceable(1) %56)
%58 = load i8*, i8** %17
%59 = call i32 @puts(i8* dereferenceable(1) %58)
%60 = load i8*, i8** %19
%61 = call i32 @puts(i8* dereferenceable(1) %60)
%62 = load i8*, i8** %21
%63 = call i32 @puts(i8* dereferenceable(1) %62)
%64 = load i8*, i8** %23
%65 = call i32 @puts(i8* dereferenceable(1) %64)
ret i32 0
}