#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*/ ft_putchar(char);
int /*<<< orphan*/ ft_putstr(char *);
scalar_t__ ft_strcmp(char *, char *);
int /*<<< orphan*/ ft_swap(char **, char **);
int main(int argc, char **argv) {
  int i;
  i = 1;
  while (i < argc - 1) {
    if (ft_strcmp(argv[i], argv[i + 1]) > 0) {
      ft_swap(&argv[i], &argv[i + 1]);
      i = 1;
    } else
      i++;
  }
  i = 1;
  while (i < argc) {
    ft_putstr(argv[i]);
    ft_putchar('\n');
    i++;
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11db <main+0x9b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1050 <ft_strcmp@plt>
cmp    $0x0,%rax
jle    11cd <main+0x8d>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
call   1030 <ft_swap@plt>
movl   $0x1,-0x14(%rbp)
jmp    11d6 <main+0x96>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x1d>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1217 <main+0xd7>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <ft_putstr@plt>
mov    $0xa,%edi
call   1040 <ft_putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e2 <main+0xa2>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %edi,%r14d
cmp    $0x3,%edi
jl     1196 <main+0x56>
lea    -0x1(%r14),%r15d
mov    $0x1,%ebp
jmp    117b <main+0x3b>
xchg   %ax,%ax
lea    (%r12,%rbx,8),%rdi
lea    (%r12,%rbx,8),%rsi
add    $0x8,%rsi
call   1030 <ft_swap@plt>
mov    $0x1,%ebp
cmp    %r15d,%ebp
jge    1196 <main+0x56>
movslq %ebp,%rbx
mov    (%r12,%rbx,8),%rdi
mov    0x8(%r12,%rbx,8),%rsi
call   1050 <ft_strcmp@plt>
test   %rax,%rax
jg     1160 <main+0x20>
add    $0x1,%ebp
jmp    1176 <main+0x36>
cmp    $0x2,%r14d
jl     11cc <main+0x8c>
mov    %r14d,%r14d
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r12,%rbp,8),%rdi
call   1060 <ft_putstr@plt>
mov    $0xa,%edi
call   1040 <ft_putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    11b0 <main+0x70>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
br label %7
7: ; preds = %40, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %41
12: ; preds = %7
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %5
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %18, i64 %21
%23 = load i8*, i8** %22
%24 = call i64 @ft_strcmp(i8* %17, i8* %23)
%25 = icmp sgt i64 %24, 0
br i1 %25, label %26, label %37
26: ; preds = %12
%27 = load i8**, i8*** %5
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8**, i8*** %5
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %31, i64 %34
%36 = call i32 @ft_swap(i8** %30, i8** %35)
store i32 1, i32* %6
br label %40
37: ; preds = %12
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %40
40: ; preds = %37, %26
br label %7
41: ; preds = %7
store i32 1, i32* %6
br label %42
42: ; preds = %46, %41
%43 = load i32, i32* %6
%44 = load i32, i32* %4
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %56
46: ; preds = %42
%47 = load i8**, i8*** %5
%48 = load i32, i32* %6
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i32 @ft_putstr(i8* %51)
%53 = call i32 @ft_putchar(i8 signext 10)
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
br label %42
56: ; preds = %42
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = add nsw i32 %0, -1
%4 = icmp sgt i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %22, %2
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %33
7: ; preds = %5
%8 = zext i32 %0 to i64
br label %25
9: ; preds = %2, %22
%10 = phi i32 [ %23, %22 ], [ 1, %2 ]
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = add nsw i32 %10, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = tail call i64 @ft_strcmp(i8* %13, i8* %17)
%19 = icmp sgt i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %9
%21 = tail call i32 @ft_swap(i8** %12, i8** %16)
br label %22
22: ; preds = %9, %20
%23 = phi i32 [ 1, %20 ], [ %14, %9 ]
%24 = icmp slt i32 %23, %3
br i1 %24, label %9, label %5
25: ; preds = %7, %25
%26 = phi i64 [ 1, %7 ], [ %31, %25 ]
%27 = getelementptr inbounds i8*, i8** %1, i64 %26
%28 = load i8*, i8** %27
%29 = tail call i32 @ft_putstr(i8* %28)
%30 = tail call i32 @ft_putchar(i8 signext 10)
%31 = add nuw nsw i64 %26, 1
%32 = icmp eq i64 %31, %8
br i1 %32, label %33, label %25
33: ; preds = %25, %5
ret i32 0
}