#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*/ free(char *);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
main() {
  int i = 0;
  int j = 0;
  int k = 0;
  char *temp;
  int no_of_elements = 3;
  char c[3][7] = {{"i"}, {"love"}, {"python"}};
  for (j = no_of_elements - 1; j >= 0; j--) {
    k = 0;
    for (i = 1; i <= j; i++) {
      if (strcmp(c[k], c[i]) < 0) {
        k = i;
      }
    }
    temp = (char *)malloc(strlen(c[k]) + 1);
    strcpy(temp, c[k]);
    strcpy(c[k], c[j]);
    strcpy(c[j], temp);
    free(temp);
  }
  for (i = 0; i < no_of_elements; i++) {
    printf("%s\n", c[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x3,-0x1c(%rbp)
mov    0xe6e(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe6b(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe69(%rip),%eax
mov    %eax,-0x30(%rbp)
mov    0xe64(%rip),%al
mov    %al,-0x2c(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     12b4 <main+0x154>
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1226 <main+0xc6>
movslq -0x10(%rbp),%rax
lea    -0x40(%rbp),%rdi
imul   $0x7,%rax,%rax
add    %rax,%rdi
movslq -0x8(%rbp),%rax
lea    -0x40(%rbp),%rsi
imul   $0x7,%rax,%rax
add    %rax,%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jge    1213 <main+0xb3>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1218 <main+0xb8>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d4 <main+0x74>
movslq -0x10(%rbp),%rax
lea    -0x40(%rbp),%rdi
imul   $0x7,%rax,%rax
add    %rax,%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
movslq -0x10(%rbp),%rax
lea    -0x40(%rbp),%rsi
imul   $0x7,%rax,%rax
add    %rax,%rsi
call   1040 <strcpy@plt>
movslq -0x10(%rbp),%rax
lea    -0x40(%rbp),%rdi
imul   $0x7,%rax,%rax
add    %rax,%rdi
movslq -0xc(%rbp),%rax
lea    -0x40(%rbp),%rsi
imul   $0x7,%rax,%rax
add    %rax,%rsi
call   1040 <strcpy@plt>
movslq -0xc(%rbp),%rax
lea    -0x40(%rbp),%rdi
imul   $0x7,%rax,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11bc <main+0x5c>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12f0 <main+0x190>
movslq -0x8(%rbp),%rax
lea    -0x40(%rbp),%rsi
imul   $0x7,%rax,%rax
add    %rax,%rsi
lea    0xd38(%rip),%rdi
call   1060 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12bb <main+0x15b>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    0xe99(%rip),%rax
mov    %rax,0xd(%rsp)
movaps 0xe80(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x7(%rsp),%r14
mov    %rsp,%r12
mov    %r12,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
mov    %rax,%rbx
shr    $0x3f,%rbx
lea    0x0(,%rbx,8),%rdi
sub    %rbx,%rdi
or     %r12,%rdi
lea    0xe(%rsp),%r15
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
mov    $0x2,%eax
cmovns %rbx,%rax
lea    0x0(,%rax,8),%rcx
sub    %rax,%rcx
lea    (%rsp,%rcx,1),%r13
mov    %r13,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
shr    $0x3f,%rax
lea    0x0(,%rax,8),%rbx
sub    %rax,%rbx
or     %r12,%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1080 <malloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
mov    %r12,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xd66(%rip),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.c = [3 x [7 x i8]] [[7 x i8] c"i\00\00\00\00\00\00", [7 x i8] c"love\00\00\00", [7 x i8] c"python\00"]
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [3 x [7 x i8]]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 3, i32* %6
%8 = bitcast [3 x [7 x i8]]* %7 to i8*
%9 = load i32, i32* %6
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %3
br label %11
11: ; preds = %68, %0
%12 = load i32, i32* %3
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %71
14: ; preds = %11
store i32 0, i32* %4
store i32 1, i32* %2
br label %15
15: ; preds = %33, %14
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %36
19: ; preds = %15
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %7, i64 0, i64 %21
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %22, i64 0, i64 0
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %7, i64 0, i64 %25
%27 = getelementptr inbounds [7 x i8], [7 x i8]* %26, i64 0, i64 0
%28 = call i64 @strcmp(i8* %23, i8* %27)
%29 = icmp slt i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %19
%31 = load i32, i32* %2
store i32 %31, i32* %4
br label %32
32: ; preds = %30, %19
br label %33
33: ; preds = %32
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
br label %15
36: ; preds = %15
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %7, i64 0, i64 %38
%40 = getelementptr inbounds [7 x i8], [7 x i8]* %39, i64 0, i64 0
%41 = call i64 @strlen(i8* %40)
%42 = add nsw i64 %41, 1
%43 = call i64 @malloc(i64 %42)
%44 = inttoptr i64 %43 to i8*
store i8* %44, i8** %5
%45 = load i8*, i8** %5
%46 = load i32, i32* %4
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %7, i64 0, i64 %47
%49 = getelementptr inbounds [7 x i8], [7 x i8]* %48, i64 0, i64 0
%50 = call i32 @strcpy(i8* %45, i8* %49)
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %7, i64 0, i64 %52
%54 = getelementptr inbounds [7 x i8], [7 x i8]* %53, i64 0, i64 0
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %7, i64 0, i64 %56
%58 = getelementptr inbounds [7 x i8], [7 x i8]* %57, i64 0, i64 0
%59 = call i32 @strcpy(i8* %54, i8* %58)
%60 = load i32, i32* %3
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %7, i64 0, i64 %61
%63 = getelementptr inbounds [7 x i8], [7 x i8]* %62, i64 0, i64 0
%64 = load i8*, i8** %5
%65 = call i32 @strcpy(i8* %63, i8* %64)
%66 = load i8*, i8** %5
%67 = call i32 @free(i8* %66)
br label %68
68: ; preds = %36
%69 = load i32, i32* %3
%70 = add nsw i32 %69, -1
store i32 %70, i32* %3
br label %11
71: ; preds = %11
store i32 0, i32* %2
br label %72
72: ; preds = %82, %71
%73 = load i32, i32* %2
%74 = load i32, i32* %6
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %85
76: ; preds = %72
%77 = load i32, i32* %2
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %7, i64 0, i64 %78
%80 = getelementptr inbounds [7 x i8], [7 x i8]* %79, i64 0, i64 0
%81 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %80)
br label %82
82: ; preds = %76
%83 = load i32, i32* %2
%84 = add nsw i32 %83, 1
store i32 %84, i32* %2
br label %72
85: ; preds = %72
%86 = load i32, i32* %1
ret i32 %86
}

LLVM IR (-O2):
@__const.main.c = [3 x [7 x i8]] [[7 x i8] c"i\00\00\00\00\00\00", [7 x i8] c"love\00\00\00", [7 x i8] c"python\00"]
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [3 x [7 x i8]]
%2 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %1, i64 0, i64 0, i64 0
%3 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %1, i64 0, i64 1, i64 0
%4 = call i64 @strcmp(i8* %2, i8* %3)
%5 = lshr i64 %4, 63
%6 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %1, i64 0, i64 %5, i64 0
%7 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %1, i64 0, i64 2, i64 0
%8 = call i64 @strcmp(i8* %6, i8* %7)
%9 = icmp slt i64 %8, 0
%10 = select i1 %9, i64 2, i64 %5
%11 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %1, i64 0, i64 %10, i64 0
%12 = call i64 @strlen(i8* %11)
%13 = add nsw i64 %12, 1
%14 = call i64 @malloc(i64 %13)
%15 = inttoptr i64 %14 to i8*
%16 = call i32 @strcpy(i8* %15, i8* %11)
%17 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %1, i64 0, i64 2, i64 0
%18 = call i32 @strcpy(i8* %11, i8* %17)
%19 = call i32 @strcpy(i8* %17, i8* %15)
%20 = call i32 @free(i8* %15)
%21 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %1, i64 0, i64 1, i64 0
%22 = call i64 @strcmp(i8* %2, i8* %21)
%23 = lshr i64 %22, 63
%24 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %1, i64 0, i64 %23, i64 0
%25 = call i64 @strlen(i8* %24)
%26 = add nsw i64 %25, 1
%27 = call i64 @malloc(i64 %26)
%28 = inttoptr i64 %27 to i8*
%29 = call i32 @strcpy(i8* %28, i8* %24)
%30 = getelementptr inbounds [3 x [7 x i8]], [3 x [7 x i8]]* %1, i64 0, i64 1, i64 0
%31 = call i32 @strcpy(i8* %24, i8* %30)
%32 = call i32 @strcpy(i8* %30, i8* %28)
%33 = call i32 @free(i8* %28)
%34 = call i64 @strlen(i8* %2)
%35 = add nsw i64 %34, 1
%36 = call i64 @malloc(i64 %35)
%37 = inttoptr i64 %36 to i8*
%38 = call i32 @strcpy(i8* %37, i8* %2)
%39 = call i32 @strcpy(i8* %2, i8* %2)
%40 = call i32 @strcpy(i8* %2, i8* %37)
%41 = call i32 @free(i8* %37)
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %30)
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %17)
ret i32 0
}