#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 */
typedef int /*<<< orphan*/ inputs;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main() {
  char *inputs[] = {"billowy", "biopsy",  "chinos", "defaced",
                    "chintz",  "sponged", "bijoux", "abhors",
                    "fiddle",  "begins",  "chimps", "wronged"};
  for (int i = 0; i < sizeof(inputs) / sizeof(inputs[0]); i++) {
    char last = 0;
    int forwards = 1;
    int reverse = 1;
    for (int j = 0; j < strlen(inputs[i]) && (forwards || reverse); j++) {
      if (last != 0 && (!forwards || inputs[i][j] < last)) {
        forwards = 0;
      }
      if (last != 0 && (!reverse || inputs[i][j] > last)) {
        reverse = 0;
      }
      last = inputs[i][j];
    }
    printf("%s %s", inputs[i],
           forwards ? "IN ORDER"
                    : (reverse ? "REVERSE ORDER" : "NOT IN ORDER"));
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2c73(%rip),%rsi
mov    $0x60,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x74(%rbp)
movslq -0x74(%rbp),%rax
cmp    $0xc,%rax
jae    1322 <main+0x1f2>
movb   $0x0,-0x75(%rbp)
movl   $0x1,-0x7c(%rbp)
movl   $0x1,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x8c(%rbp)
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rdi
call   1030 <strlen@plt>
mov    -0x8c(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x85(%rbp)
jge    11e5 <main+0xb5>
mov    $0x1,%al
cmpl   $0x0,-0x7c(%rbp)
mov    %al,-0x8d(%rbp)
jne    11d9 <main+0xa9>
cmpl   $0x0,-0x80(%rbp)
setne  %al
mov    %al,-0x8d(%rbp)
mov    -0x8d(%rbp),%al
mov    %al,-0x85(%rbp)
mov    -0x85(%rbp),%al
test   $0x1,%al
jne    11f8 <main+0xc8>
jmp    129e <main+0x16e>
movsbl -0x75(%rbp),%eax
cmp    $0x0,%eax
je     1236 <main+0x106>
cmpl   $0x0,-0x7c(%rbp)
je     122f <main+0xff>
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
movslq -0x84(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x75(%rbp),%ecx
cmp    %ecx,%eax
jge    1236 <main+0x106>
movl   $0x0,-0x7c(%rbp)
movsbl -0x75(%rbp),%eax
cmp    $0x0,%eax
je     1274 <main+0x144>
cmpl   $0x0,-0x80(%rbp)
je     126d <main+0x13d>
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
movslq -0x84(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x75(%rbp),%ecx
cmp    %ecx,%eax
jle    1274 <main+0x144>
movl   $0x0,-0x80(%rbp)
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
movslq -0x84(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x75(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1188 <main+0x58>
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
mov    %rax,-0x98(%rbp)
cmpl   $0x0,-0x7c(%rbp)
je     12cb <main+0x19b>
lea    0xdb1(%rip),%rax
mov    %rax,-0xa0(%rbp)
jmp    12ea <main+0x1ba>
mov    -0x80(%rbp),%edx
lea    0xd97(%rip),%rax
lea    0xd82(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0xa0(%rbp)
mov    -0x98(%rbp),%rsi
mov    -0xa0(%rbp),%rdx
lea    0xd59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    115e <main+0x2e>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf2e(%rip),%r15
xor    %ebp,%ebp
jmp    118a <main+0x5a>
cs nopw 0x0(%rax,%rax,1)
lea    0xf15(%rip),%rax
lea    0xf12(%rip),%r15
mov    %rax,%rdx
lea    0xef0(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    $0xc,%rbp
je     124d <main+0x11d>
lea    0x2c2f(%rip),%rax
mov    (%rax,%rbp,8),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r15,%rdx
test   %eax,%eax
jle    1161 <main+0x31>
mov    $0x1,%r15d
xor    %r13d,%r13d
mov    $0x1,%r14d
xor    %r12d,%r12d
jmp    11db <main+0xab>
nopl   0x0(%rax,%rax,1)
xor    %r15d,%r15d
movzbl (%rbx,%r13,1),%r12d
add    $0x1,%r13
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%r13
jge    1220 <main+0xf0>
mov    %r14d,%eax
or     %r15d,%eax
je     1150 <main+0x20>
test   %r12b,%r12b
je     11c3 <main+0x93>
test   %r14d,%r14d
je     11fd <main+0xcd>
mov    $0x1,%r14d
cmp    %r12b,(%rbx,%r13,1)
jge    1200 <main+0xd0>
xor    %r14d,%r14d
test   %r15d,%r15d
je     11c0 <main+0x90>
mov    $0x1,%r15d
cmp    %r12b,(%rbx,%r13,1)
jg     11c0 <main+0x90>
jmp    11c3 <main+0x93>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %r15d,%r15d
lea    0xe34(%rip),%rax
lea    0xe3b(%rip),%rcx
cmove  %rcx,%rax
lea    0xe34(%rip),%r15
mov    %r15,%rdx
test   %r14d,%r14d
jne    1161 <main+0x31>
jmp    115e <main+0x2e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"billowy\00"
@.str.1 = [7 x i8] c"biopsy\00"
@.str.2 = [7 x i8] c"chinos\00"
@.str.3 = [8 x i8] c"defaced\00"
@.str.4 = [7 x i8] c"chintz\00"
@.str.5 = [8 x i8] c"sponged\00"
@.str.6 = [7 x i8] c"bijoux\00"
@.str.7 = [7 x i8] c"abhors\00"
@.str.8 = [7 x i8] c"fiddle\00"
@.str.9 = [7 x i8] c"begins\00"
@.str.10 = [7 x i8] c"chimps\00"
@.str.11 = [8 x i8] c"wronged\00"
@__const.main.inputs = [12 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [6 x i8] c"%s %s\00"
@.str.13 = [9 x i8] c"IN ORDER\00"
@.str.14 = [14 x i8] c"REVERSE ORDER\00"
@.str.15 = [13 x i8] c"NOT IN ORDER\00"
@.str.16 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i8*]
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [12 x i8*]* %2 to i8*
store i32 0, i32* %3
br label %9
9: ; preds = %103, %0
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = icmp ult i64 %11, 12
br i1 %12, label %13, label %106
13: ; preds = %9
store i8 0, i8* %4
store i32 1, i32* %5
store i32 1, i32* %6
store i32 0, i32* %7
br label %14
14: ; preds = %83, %13
%15 = load i32, i32* %7
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @strlen(i8* %19)
%21 = icmp slt i32 %15, %20
br i1 %21, label %22, label %30
22: ; preds = %14
%23 = load i32, i32* %5
%24 = icmp ne i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* %6
%27 = icmp ne i32 %26, 0
br label %28
28: ; preds = %25, %22
%29 = phi i1 [ true, %22 ], [ %27, %25 ]
br label %30
30: ; preds = %28, %14
%31 = phi i1 [ false, %14 ], [ %29, %28 ]
br i1 %31, label %32, label %86
32: ; preds = %30
%33 = load i8, i8* %4
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %53
36: ; preds = %32
%37 = load i32, i32* %5
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %52
39: ; preds = %36
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 %41
%43 = load i8*, i8** %42
%44 = load i32, i32* %7
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = load i8, i8* %4
%50 = sext i8 %49 to i32
%51 = icmp slt i32 %48, %50
br i1 %51, label %52, label %53
52: ; preds = %39, %36
store i32 0, i32* %5
br label %53
53: ; preds = %52, %39, %32
%54 = load i8, i8* %4
%55 = sext i8 %54 to i32
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %74
57: ; preds = %53
%58 = load i32, i32* %6
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %73
60: ; preds = %57
%61 = load i32, i32* %3
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 %62
%64 = load i8*, i8** %63
%65 = load i32, i32* %7
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %64, i64 %66
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = load i8, i8* %4
%71 = sext i8 %70 to i32
%72 = icmp sgt i32 %69, %71
br i1 %72, label %73, label %74
73: ; preds = %60, %57
store i32 0, i32* %6
br label %74
74: ; preds = %73, %60, %53
%75 = load i32, i32* %3
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 %76
%78 = load i8*, i8** %77
%79 = load i32, i32* %7
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %78, i64 %80
%82 = load i8, i8* %81
store i8 %82, i8* %4
br label %83
83: ; preds = %74
%84 = load i32, i32* %7
%85 = add nsw i32 %84, 1
store i32 %85, i32* %7
br label %14
86: ; preds = %30
%87 = load i32, i32* %3
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [12 x i8*], [12 x i8*]* %2, i64 0, i64 %88
%90 = load i8*, i8** %89
%91 = load i32, i32* %5
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %94
93: ; preds = %86
br label %99
94: ; preds = %86
%95 = load i32, i32* %6
%96 = icmp ne i32 %95, 0
%97 = zext i1 %96 to i64
%98 = select i1 %96, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0)
br label %99
99: ; preds = %94, %93
%100 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), %93 ], [ %98, %94 ]
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i8* %90, i8* %100)
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
br label %103
103: ; preds = %99
%104 = load i32, i32* %3
%105 = add nsw i32 %104, 1
store i32 %105, i32* %3
br label %9
106: ; preds = %9
%107 = load i32, i32* %1
ret i32 %107
}

LLVM IR (-O2):
@.str = [8 x i8] c"billowy\00"
@.str.1 = [7 x i8] c"biopsy\00"
@.str.2 = [7 x i8] c"chinos\00"
@.str.3 = [8 x i8] c"defaced\00"
@.str.4 = [7 x i8] c"chintz\00"
@.str.5 = [8 x i8] c"sponged\00"
@.str.6 = [7 x i8] c"bijoux\00"
@.str.7 = [7 x i8] c"abhors\00"
@.str.8 = [7 x i8] c"fiddle\00"
@.str.9 = [7 x i8] c"begins\00"
@.str.10 = [7 x i8] c"chimps\00"
@.str.11 = [8 x i8] c"wronged\00"
@__const.main.inputs = [12 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [6 x i8] c"%s %s\00"
@.str.13 = [9 x i8] c"IN ORDER\00"
@.str.14 = [14 x i8] c"REVERSE ORDER\00"
@.str.15 = [13 x i8] c"NOT IN ORDER\00"
define i32 @main() {
br label %1
1: ; preds = %0, %22
%2 = phi i64 [ 0, %0 ], [ %26, %22 ]
%3 = getelementptr inbounds [12 x i8*], [12 x i8*]* @__const.main.inputs, i64 0, i64 %2
%4 = load i8*, i8** %3
%5 = tail call i32 @strlen(i8* %4)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %8, label %22
7: ; preds = %22
ret i32 0
8: ; preds = %1, %43
%9 = phi i64 [ %48, %43 ], [ 0, %1 ]
%10 = phi i32 [ %45, %43 ], [ 1, %1 ]
%11 = phi i32 [ %44, %43 ], [ 1, %1 ]
%12 = phi i8 [ %47, %43 ], [ 0, %1 ]
%13 = icmp ne i32 %11, 0
%14 = icmp ne i32 %10, 0
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %28, label %20
16: ; preds = %43
%17 = icmp eq i32 %44, 0
%18 = icmp eq i32 %45, 0
%19 = select i1 %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0)
br i1 %17, label %20, label %22
20: ; preds = %8, %16
%21 = phi i8* [ %19, %16 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), %8 ]
br label %22
22: ; preds = %16, %1, %20
%23 = phi i8* [ %21, %20 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), %1 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), %16 ]
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i8* %4, i8* %23)
%25 = tail call i32 @putchar(i32 10)
%26 = add nuw nsw i64 %2, 1
%27 = icmp eq i64 %26, 12
br i1 %27, label %7, label %1
28: ; preds = %8
%29 = icmp eq i8 %12, 0
br i1 %29, label %43, label %30
30: ; preds = %28
br i1 %13, label %31, label %35
31: ; preds = %30
%32 = getelementptr inbounds i8, i8* %4, i64 %9
%33 = load i8, i8* %32
%34 = icmp slt i8 %33, %12
br i1 %34, label %35, label %36
35: ; preds = %31, %30
br label %36
36: ; preds = %35, %31
%37 = phi i32 [ 1, %31 ], [ 0, %35 ]
br i1 %14, label %38, label %42
38: ; preds = %36
%39 = getelementptr inbounds i8, i8* %4, i64 %9
%40 = load i8, i8* %39
%41 = icmp sgt i8 %40, %12
br i1 %41, label %42, label %43
42: ; preds = %38, %36
br label %43
43: ; preds = %28, %42, %38
%44 = phi i32 [ %37, %42 ], [ %37, %38 ], [ %11, %28 ]
%45 = phi i32 [ 0, %42 ], [ 1, %38 ], [ %10, %28 ]
%46 = getelementptr inbounds i8, i8* %4, i64 %9
%47 = load i8, i8* %46
%48 = add nuw nsw i64 %9, 1
%49 = tail call i32 @strlen(i8* %4)
%50 = sext i32 %49 to i64
%51 = icmp slt i64 %48, %50
br i1 %51, label %8, label %16
}