#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 */
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void insertion_sort(char nombres[10][100]) {
  for (int i = 1; i < 10; i++) {
    char key[100];
    char temp[100];
    strcpy(key, nombres[i]);
    int j = i - 1;
    while (strcmp(key, nombres[j]) < 0 && j >= 0) {
      strcpy(temp, nombres[j]);
      strcpy(nombres[j], nombres[j + 1]);
      strcpy(nombres[j + 1], temp);
      j--;
    }
  }
}


x86 assembly (clang, -O0):
<insertion_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    124b <insertion_sort+0x12b>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xe4(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0xe4(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xe5(%rbp)
jge    11a4 <insertion_sort+0x84>
cmpl   $0x0,-0xe4(%rbp)
setge  %al
mov    %al,-0xe5(%rbp)
mov    -0xe5(%rbp),%al
test   $0x1,%al
jne    11b7 <insertion_sort+0x97>
jmp    1238 <insertion_sort+0x118>
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0xe4(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
movslq -0xe4(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x64,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x64,%rax,%rax
add    %rax,%rdi
lea    -0xe0(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0xe4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xe4(%rbp)
jmp    1164 <insertion_sort+0x44>
jmp    123d <insertion_sort+0x11d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <insertion_sort+0x16>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insertion_sort>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    %rdi,%r12
mov    $0x1,%eax
xor    %ecx,%ecx
lea    0x90(%rsp),%r14
lea    0x20(%rsp),%r15
mov    %rdi,0x8(%rsp)
jmp    1172 <insertion_sort+0x52>
nop
mov    0x10(%rsp),%rax
add    $0x1,%rax
mov    0x18(%rsp),%rcx
add    $0x1,%rcx
addq   $0x64,0x8(%rsp)
cmp    $0x9,%rcx
je     1200 <insertion_sort+0xe0>
mov    %rcx,0x18(%rsp)
mov    %rax,0x10(%rsp)
imul   $0x64,%rax,%rbx
lea    (%r12,%rbx,1),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    (%r12,%rbx,1),%rsi
add    $0xffffffffffffff9c,%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jns    1150 <insertion_sort+0x30>
mov    0x8(%rsp),%r13
mov    0x10(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    %ebp,%eax
imul   $0x64,%rax,%rbx
add    %r12,%rbx
mov    %r13,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
add    $0xffffffffffffff9c,%r13
mov    %r14,%rdi
mov    %r13,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jns    1150 <insertion_sort+0x30>
add    $0xffffffffffffffff,%rbp
test   %rbp,%rbp
jg     11b0 <insertion_sort+0x90>
jmp    1150 <insertion_sort+0x30>
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @insertion_sort([100 x i8]* %0) {
%2 = alloca [100 x i8]*
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = alloca i32
store [100 x i8]* %0, [100 x i8]** %2
store i32 1, i32* %3
br label %7
7: ; preds = %65, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %68
10: ; preds = %7
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%12 = load [100 x i8]*, [100 x i8]** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 %14
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %15, i64 0, i64 0
%17 = call i32 @strcpy(i8* %11, i8* %16)
%18 = load i32, i32* %3
%19 = sub nsw i32 %18, 1
store i32 %19, i32* %6
br label %20
20: ; preds = %34, %10
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%22 = load [100 x i8]*, [100 x i8]** %2
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %22, i64 %24
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %25, i64 0, i64 0
%27 = call i64 @strcmp(i8* %21, i8* %26)
%28 = icmp slt i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %20
%30 = load i32, i32* %6
%31 = icmp sge i32 %30, 0
br label %32
32: ; preds = %29, %20
%33 = phi i1 [ false, %20 ], [ %31, %29 ]
br i1 %33, label %34, label %64
34: ; preds = %32
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%36 = load [100 x i8]*, [100 x i8]** %2
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %36, i64 %38
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %39, i64 0, i64 0
%41 = call i32 @strcpy(i8* %35, i8* %40)
%42 = load [100 x i8]*, [100 x i8]** %2
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [100 x i8], [100 x i8]* %42, i64 %44
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %45, i64 0, i64 0
%47 = load [100 x i8]*, [100 x i8]** %2
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [100 x i8], [100 x i8]* %47, i64 %50
%52 = getelementptr inbounds [100 x i8], [100 x i8]* %51, i64 0, i64 0
%53 = call i32 @strcpy(i8* %46, i8* %52)
%54 = load [100 x i8]*, [100 x i8]** %2
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [100 x i8], [100 x i8]* %54, i64 %57
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %58, i64 0, i64 0
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%61 = call i32 @strcpy(i8* %59, i8* %60)
%62 = load i32, i32* %6
%63 = add nsw i32 %62, -1
store i32 %63, i32* %6
br label %20
64: ; preds = %32
br label %65
65: ; preds = %64
%66 = load i32, i32* %3
%67 = add nsw i32 %66, 1
store i32 %67, i32* %3
br label %7
68: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @insertion_sort([100 x i8]* %0) {
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
br label %7
6: ; preds = %31
ret void
7: ; preds = %1, %31
%8 = phi i64 [ 1, %1 ], [ %32, %31 ]
%9 = phi i64 [ 0, %1 ], [ %33, %31 ]
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %0, i64 %8, i64 0
%11 = call i32 @strcpy(i8* %4, i8* %10)
%12 = add nsw i64 %8, -1
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %0, i64 %12, i64 0
%14 = call i64 @strcmp(i8* %4, i8* %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %31
16: ; preds = %7, %16
%17 = phi i64 [ %25, %16 ], [ %9, %7 ]
%18 = phi i8* [ %26, %16 ], [ %13, %7 ]
%19 = phi i64 [ %17, %16 ], [ %8, %7 ]
%20 = call i32 @strcpy(i8* %5, i8* %18)
%21 = and i64 %19, 4294967295
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %0, i64 %21, i64 0
%23 = call i32 @strcpy(i8* %18, i8* %22)
%24 = call i32 @strcpy(i8* %22, i8* %5)
%25 = add nsw i64 %17, -1
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %0, i64 %25, i64 0
%27 = call i64 @strcmp(i8* %4, i8* %26)
%28 = icmp slt i64 %27, 0
%29 = icmp sgt i64 %17, 0
%30 = select i1 %28, i1 %29, i1 false
br i1 %30, label %16, label %31
31: ; preds = %16, %7
%32 = add nuw nsw i64 %8, 1
%33 = add nuw nsw i64 %9, 1
%34 = icmp eq i64 %33, 9
br i1 %34, label %6, label %7
}