#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*/ count_sort(int *, int);
int /*<<< orphan*/ init_vector(int *);
int main(int argc, char **argv) {
  int vector[100];
  init_vector(vector);
  count_sort(vector, 100);
  for (int i = 1; i < 100; i++) {
    if (vector[i] < vector[i - 1]) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1a0(%rbp),%rdi
call   1030 <init_vector@plt>
lea    -0x1a0(%rbp),%rdi
mov    $0x64,%esi
call   1040 <count_sort@plt>
movl   $0x1,-0x1a4(%rbp)
cmpl   $0x64,-0x1a4(%rbp)
jge    11b9 <main+0x99>
movslq -0x1a4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
mov    -0x1a4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x1a0(%rbp,%rcx,4),%eax
jge    11a0 <main+0x80>
movl   $0x1,-0x4(%rbp)
jmp    11c0 <main+0xa0>
jmp    11a5 <main+0x85>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1160 <main+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x190,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <init_vector@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <count_sort@plt>
mov    $0x3,%ecx
mov    (%rsp),%edx
mov    $0x1,%eax
nopl   (%rax)
mov    -0x8(%rsp,%rcx,4),%esi
cmp    %edx,%esi
jl     1173 <main+0x53>
mov    -0x4(%rsp,%rcx,4),%edi
cmp    %esi,%edi
jl     1173 <main+0x53>
mov    (%rsp,%rcx,4),%edx
cmp    %edi,%edx
jl     1173 <main+0x53>
add    $0x3,%rcx
cmp    $0x66,%rcx
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 0
%9 = call i32 @init_vector(i32* %8)
%10 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 0
%11 = call i32 @count_sort(i32* %10, i32 100)
store i32 1, i32* %7
br label %12
12: ; preds = %28, %2
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 100
br i1 %14, label %15, label %31
15: ; preds = %12
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = load i32, i32* %7
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp slt i32 %19, %24
br i1 %25, label %26, label %27
26: ; preds = %15
store i32 1, i32* %3
br label %32
27: ; preds = %15
br label %28
28: ; preds = %27
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %12
31: ; preds = %12
store i32 0, i32* %3
br label %32
32: ; preds = %31, %26
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i32]
%4 = bitcast [100 x i32]* %3 to i8*
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%6 = call i32 @init_vector(i32* %5)
%7 = call i32 @count_sort(i32* %5, i32 100)
%8 = load i32, i32* %5
br label %22
9: ; preds = %22
%10 = add nuw nsw i64 %24, 1
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, %26
br i1 %13, label %28, label %14
14: ; preds = %9
%15 = add nuw nsw i64 %24, 2
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = icmp slt i32 %17, %12
br i1 %18, label %28, label %19
19: ; preds = %14
%20 = add nuw nsw i64 %24, 3
%21 = icmp eq i64 %20, 100
br i1 %21, label %28, label %22
22: ; preds = %19, %2
%23 = phi i32 [ %8, %2 ], [ %17, %19 ]
%24 = phi i64 [ 1, %2 ], [ %20, %19 ]
%25 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = icmp slt i32 %26, %23
br i1 %27, label %28, label %9
28: ; preds = %19, %14, %9, %22
%29 = phi i32 [ 1, %22 ], [ 1, %9 ], [ 1, %14 ], [ 0, %19 ]
ret i32 %29
}