#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*/ swap(char *, char *);
void sort_reminders(char date[365][12], char message[365][69], int *reminders) {
  for (int i = 0; i < *reminders; i += 1) {
    for (int j = i; j < *reminders; j += 1) {
      if (strcmp(date[i], date[j]) > 0) {
        swap(date[i], date[j]);
        swap(message[i], message[j]);
      }
    }
  }
}


x86 assembly (clang, -O0):
<sort_reminders>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    11f8 <sort_reminders+0xd8>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    11e5 <sort_reminders+0xc5>
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
imul   $0xc,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x20(%rbp),%rax
imul   $0xc,%rax,%rax
add    %rax,%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jle    11d2 <sort_reminders+0xb2>
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
imul   $0xc,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x20(%rbp),%rax
imul   $0xc,%rax,%rax
add    %rax,%rsi
call   1040 <swap@plt>
mov    -0x10(%rbp),%rdi
movslq -0x1c(%rbp),%rax
imul   $0x45,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
movslq -0x20(%rbp),%rax
imul   $0x45,%rax,%rax
add    %rax,%rsi
call   1040 <swap@plt>
jmp    11d7 <sort_reminders+0xb7>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1150 <sort_reminders+0x30>
jmp    11ea <sort_reminders+0xca>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113b <sort_reminders+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort_reminders>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdi,(%rsp)
mov    (%rdx),%eax
test   %eax,%eax
jle    11fd <sort_reminders+0xdd>
mov    %rdx,%r12
xor    %edx,%edx
mov    0x8(%rsp),%rbp
mov    (%rsp),%r14
jmp    1183 <sort_reminders+0x63>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %eax,%rcx
mov    0x20(%rsp),%rdx
mov    0x18(%rsp),%rbp
mov    0x10(%rsp),%r14
add    $0x1,%rdx
add    $0xc,%r14
add    $0x45,%rbp
cmp    %rcx,%rdx
jge    11fd <sort_reminders+0xdd>
movslq %eax,%rcx
cmp    %rcx,%rdx
jge    1172 <sort_reminders+0x52>
lea    (%rdx,%rdx,2),%rax
mov    (%rsp),%rcx
lea    (%rcx,%rax,4),%rbx
imul   $0x45,%rdx,%r13
add    0x8(%rsp),%r13
mov    %rdx,0x20(%rsp)
mov    %edx,%r15d
mov    %rbp,0x18(%rsp)
mov    %r14,0x10(%rsp)
jmp    11d5 <sort_reminders+0xb5>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r12),%eax
add    $0xc,%r14
add    $0x45,%rbp
add    $0x1,%r15d
cmp    %r15d,%eax
jle    1160 <sort_reminders+0x40>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jle    11c0 <sort_reminders+0xa0>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <swap@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
call   1040 <swap@plt>
jmp    11c0 <sort_reminders+0xa0>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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