#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 *, char *);
scalar_t__ strcmp(char *, char *);
int main() {
  int i, k, j;
  static char *str[4] = {"Program", "Fortran", "C", "Basic"};
  char *temp;
  for (i = 0; i < 4; i++) {
    for (j = i + 1; j < 4; j++) {
      if (strcmp(str[i], str[j]) > 0) {
        temp = str[j];
        str[j] = str[i];
        str[i] = temp;
      }
    }
  }
  for (i = 0; i < 4; i++)
    printf("%s\n", str[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11ea <main+0xca>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    11d7 <main+0xb7>
movslq -0x8(%rbp),%rcx
lea    0x2ee2(%rip),%rax
mov    (%rax,%rcx,8),%rdi
movslq -0x10(%rbp),%rcx
lea    0x2ed3(%rip),%rax
mov    (%rax,%rcx,8),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jle    11c4 <main+0xa4>
movslq -0x10(%rbp),%rcx
lea    0x2eb5(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
movslq -0x8(%rbp),%rcx
lea    0x2ea2(%rip),%rax
mov    (%rax,%rcx,8),%rdx
movslq -0x10(%rbp),%rcx
lea    0x2e93(%rip),%rax
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rdx
movslq -0x8(%rbp),%rcx
lea    0x2e80(%rip),%rax
mov    %rdx,(%rax,%rcx,8)
jmp    11c9 <main+0xa9>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1149 <main+0x29>
jmp    11dc <main+0xbc>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1224 <main+0x104>
movslq -0x8(%rbp),%rcx
lea    0x2e3a(%rip),%rax
mov    (%rax,%rcx,8),%rsi
lea    0xe07(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f1 <main+0xd1>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2f18(%rip),%rdi
mov    0x2f21(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jle    1157 <main+0x37>
mov    0x2f10(%rip),%rdi
mov    0x2ef9(%rip),%rax
mov    %rax,0x2f02(%rip)
mov    %rdi,0x2eeb(%rip)
jmp    115e <main+0x3e>
mov    0x2ee2(%rip),%rdi
mov    0x2efb(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jle    118d <main+0x6d>
mov    0x2eea(%rip),%rdi
mov    0x2ec3(%rip),%rax
mov    %rax,0x2edc(%rip)
mov    %rdi,0x2eb5(%rip)
jmp    1194 <main+0x74>
mov    0x2eac(%rip),%rdi
mov    0x2ed5(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jle    11c1 <main+0xa1>
mov    0x2ec4(%rip),%rax
mov    0x2e8d(%rip),%rcx
mov    %rcx,0x2eb6(%rip)
mov    %rax,0x2e7f(%rip)
mov    0x2e88(%rip),%rdi
mov    0x2e91(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jle    11f7 <main+0xd7>
mov    0x2e80(%rip),%rdi
mov    0x2e69(%rip),%rax
mov    %rax,0x2e72(%rip)
mov    %rdi,0x2e5b(%rip)
jmp    11fe <main+0xde>
mov    0x2e52(%rip),%rdi
mov    0x2e6b(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jle    122b <main+0x10b>
mov    0x2e5a(%rip),%rax
mov    0x2e33(%rip),%rcx
mov    %rcx,0x2e4c(%rip)
mov    %rax,0x2e25(%rip)
mov    0x2e2e(%rip),%rdi
mov    0x2e37(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jle    125f <main+0x13f>
mov    0x2e26(%rip),%rax
mov    0x2e0f(%rip),%rcx
mov    %rcx,0x2e18(%rip)
mov    %rax,0x2e01(%rip)
mov    0x2dda(%rip),%rsi
lea    0xdab(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2dd4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2dd5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2dd6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@main.str = internal global [4 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0)]
@.str = [8 x i8] c"Program\00"
@.str.1 = [8 x i8] c"Fortran\00"
@.str.2 = [2 x i8] c"C\00"
@.str.3 = [6 x i8] c"Basic\00"
@.str.4 = [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*
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %47, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %50
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
br label %12
12: ; preds = %43, %9
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %46
15: ; preds = %12
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [4 x i8*], [4 x i8*]* @main.str, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [4 x i8*], [4 x i8*]* @main.str, i64 0, i64 %21
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %19, i8* %23)
%25 = icmp sgt i64 %24, 0
br i1 %25, label %26, label %42
26: ; preds = %15
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [4 x i8*], [4 x i8*]* @main.str, i64 0, i64 %28
%30 = load i8*, i8** %29
store i8* %30, i8** %5
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [4 x i8*], [4 x i8*]* @main.str, i64 0, i64 %32
%34 = load i8*, i8** %33
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [4 x i8*], [4 x i8*]* @main.str, i64 0, i64 %36
store i8* %34, i8** %37
%38 = load i8*, i8** %5
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4 x i8*], [4 x i8*]* @main.str, i64 0, i64 %40
store i8* %38, i8** %41
br label %42
42: ; preds = %26, %15
br label %43
43: ; preds = %42
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %12
46: ; preds = %12
br label %47
47: ; preds = %46
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 1
store i32 %49, i32* %2
br label %6
50: ; preds = %6
store i32 0, i32* %2
br label %51
51: ; preds = %60, %50
%52 = load i32, i32* %2
%53 = icmp slt i32 %52, 4
br i1 %53, label %54, label %63
54: ; preds = %51
%55 = load i32, i32* %2
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [4 x i8*], [4 x i8*]* @main.str, i64 0, i64 %56
%58 = load i8*, i8** %57
%59 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %58)
br label %60
60: ; preds = %54
%61 = load i32, i32* %2
%62 = add nsw i32 %61, 1
store i32 %62, i32* %2
br label %51
63: ; preds = %51
ret i32 0
}

LLVM IR (-O2):
@main.str.0 = internal unnamed_addr global i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
@main.str.1 = internal unnamed_addr global i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
@main.str.2 = internal unnamed_addr global i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
@main.str.3 = internal unnamed_addr global i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0)
@.str = [8 x i8] c"Program\00"
@.str.1 = [8 x i8] c"Fortran\00"
@.str.2 = [2 x i8] c"C\00"
@.str.3 = [6 x i8] c"Basic\00"
@.str.4 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = load i8*, i8** @main.str.0
%2 = load i8*, i8** @main.str.1
%3 = tail call i64 @strcmp(i8* %1, i8* %2)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %42, label %40
5: ; preds = %60, %55
%6 = load i8*, i8** @main.str.1
%7 = load i8*, i8** @main.str.2
%8 = tail call i64 @strcmp(i8* %6, i8* %7)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = load i8*, i8** @main.str.1
br label %15
12: ; preds = %5
%13 = load i8*, i8** @main.str.2
%14 = load i8*, i8** @main.str.1
store i8* %14, i8** @main.str.2
store i8* %13, i8** @main.str.1
br label %15
15: ; preds = %10, %12
%16 = phi i8* [ %11, %10 ], [ %13, %12 ]
%17 = load i8*, i8** @main.str.3
%18 = tail call i64 @strcmp(i8* %16, i8* %17)
%19 = icmp sgt i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i8*, i8** @main.str.3
%22 = load i8*, i8** @main.str.1
store i8* %22, i8** @main.str.3
store i8* %21, i8** @main.str.1
br label %23
23: ; preds = %20, %15
%24 = load i8*, i8** @main.str.2
%25 = load i8*, i8** @main.str.3
%26 = tail call i64 @strcmp(i8* %24, i8* %25)
%27 = icmp sgt i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i8*, i8** @main.str.3
%30 = load i8*, i8** @main.str.2
store i8* %30, i8** @main.str.3
store i8* %29, i8** @main.str.2
br label %31
31: ; preds = %28, %23
%32 = load i8*, i8** @main.str.0
%33 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %32)
%34 = load i8*, i8** @main.str.1
%35 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %34)
%36 = load i8*, i8** @main.str.2
%37 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %36)
%38 = load i8*, i8** @main.str.3
%39 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %38)
ret i32 0
40: ; preds = %0
%41 = load i8*, i8** @main.str.0
br label %45
42: ; preds = %0
%43 = load i8*, i8** @main.str.1
%44 = load i8*, i8** @main.str.0
store i8* %44, i8** @main.str.1
store i8* %43, i8** @main.str.0
br label %45
45: ; preds = %40, %42
%46 = phi i8* [ %41, %40 ], [ %43, %42 ]
%47 = load i8*, i8** @main.str.2
%48 = tail call i64 @strcmp(i8* %46, i8* %47)
%49 = icmp sgt i64 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %45
%51 = load i8*, i8** @main.str.0
br label %55
52: ; preds = %45
%53 = load i8*, i8** @main.str.2
%54 = load i8*, i8** @main.str.0
store i8* %54, i8** @main.str.2
store i8* %53, i8** @main.str.0
br label %55
55: ; preds = %50, %52
%56 = phi i8* [ %51, %50 ], [ %53, %52 ]
%57 = load i8*, i8** @main.str.3
%58 = tail call i64 @strcmp(i8* %56, i8* %57)
%59 = icmp sgt i64 %58, 0
br i1 %59, label %60, label %5
60: ; preds = %55
%61 = load i8*, i8** @main.str.3
%62 = load i8*, i8** @main.str.0
store i8* %62, i8** @main.str.3
store i8* %61, i8** @main.str.0
br label %5
}