#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 find_split_point(int *, int);
int /*<<< orphan*/ printf(char *, ...);
void print_two_parts(int array[], int n) {
  int split_point = find_split_point(array, n);
  if (split_point == -1 || split_point == n) {
    printf("Not possible\n");
  }
  int i;
  for (i = 0; i < n; ++i) {
    if (split_point == i)
      printf("\n");
    printf("%d ", array[i]);
  }
}


x86 assembly (clang, -O0):
<print_two_parts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <find_split_point@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
je     1154 <print_two_parts+0x34>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1162 <print_two_parts+0x42>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b6 <print_two_parts+0x96>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    118f <print_two_parts+0x6f>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1169 <print_two_parts+0x49>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_two_parts>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r12
call   1050 <find_split_point@plt>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
je     1163 <print_two_parts+0x23>
cmp    %r15d,%r14d
jne    116f <print_two_parts+0x2f>
lea    0xe9a(%rip),%rdi
call   1040 <puts@plt>
test   %r15d,%r15d
jle    11b8 <print_two_parts+0x78>
mov    %r14d,%r13d
mov    %r15d,%ebx
lea    0xe7f(%rip),%r14
xor    %ebp,%ebp
jmp    11a7 <print_two_parts+0x67>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbp,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
je     11b8 <print_two_parts+0x78>
cmp    %rbp,%r13
jne    1190 <print_two_parts+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1190 <print_two_parts+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Not possible\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [4 x i8] c"%d \00"
define void @print_two_parts(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32*, i32** %3
%8 = load i32, i32* %4
%9 = call i32 @find_split_point(i32* %7, i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, -1
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12, %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %12
store i32 0, i32* %6
br label %19
19: ; preds = %36, %18
%20 = load i32, i32* %6
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %39
23: ; preds = %19
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27, %23
%30 = load i32*, i32** %3
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %29
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %19
39: ; preds = %19
ret void
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%d \00"
@str = [13 x i8] c"Not possible\00"
define void @print_two_parts(i32* %0, i32 %1) {
%3 = tail call i32 @find_split_point(i32* %0, i32 %1)
%4 = icmp eq i32 %3, -1
%5 = icmp eq i32 %3, %1
%6 = or i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %2, %7
%10 = icmp sgt i32 %1, 0
br i1 %10, label %11, label %25
11: ; preds = %9
%12 = zext i32 %3 to i64
%13 = zext i32 %1 to i64
br label %14
14: ; preds = %11, %19
%15 = phi i64 [ 0, %11 ], [ %23, %19 ]
%16 = icmp eq i64 %15, %12
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @putchar(i32 10)
br label %19
19: ; preds = %17, %14
%20 = getelementptr inbounds i32, i32* %0, i64 %15
%21 = load i32, i32* %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = add nuw nsw i64 %15, 1
%24 = icmp eq i64 %23, %13
br i1 %24, label %25, label %14
25: ; preds = %19, %9
ret void
}