#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 bubble_sort(int *, int);
int /*<<< orphan*/ printf(char *, int);
char *test_null() {
  int *array = NULL;
  do {
    if (!(bubble_sort(array, 10) == -1)) {
      printf("Line number is: %d\n", 17);
      return "error, sorted NULL array";
    }
  } while (0);
  do {
    if (!(bubble_sort(array, -4) == -1)) {
      printf("Line number is: %d\n", 18);
      return "error, sorted NULL array";
    }
  } while (0);
  do {
    if (!(bubble_sort(array, 0) == -1)) {
      printf("Line number is: %d\n", 19);
      return "error, sorted NULL array";
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_null>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1040 <bubble_sort@plt>
cmp    $0xffffffff,%eax
je     1168 <test_null+0x48>
lea    0xeb2(%rip),%rdi
mov    $0x11,%esi
call   1030 <printf@plt>
lea    0xeb5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f6 <test_null+0xd6>
jmp    116d <test_null+0x4d>
jmp    1172 <test_null+0x52>
mov    -0x10(%rbp),%rdi
mov    $0xfffffffc,%esi
call   1040 <bubble_sort@plt>
cmp    $0xffffffff,%eax
je     11aa <test_null+0x8a>
lea    0xe70(%rip),%rdi
mov    $0x12,%esi
call   1030 <printf@plt>
lea    0xe73(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f6 <test_null+0xd6>
jmp    11af <test_null+0x8f>
jmp    11b4 <test_null+0x94>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1040 <bubble_sort@plt>
cmp    $0xffffffff,%eax
je     11e9 <test_null+0xc9>
lea    0xe31(%rip),%rdi
mov    $0x13,%esi
call   1030 <printf@plt>
lea    0xe34(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f6 <test_null+0xd6>
jmp    11ee <test_null+0xce>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_null>:
push   %rbx
xor    %edi,%edi
mov    $0xa,%esi
call   1040 <bubble_sort@plt>
mov    $0x11,%esi
cmp    $0xffffffff,%eax
jne    1162 <test_null+0x42>
xor    %edi,%edi
mov    $0xfffffffc,%esi
call   1040 <bubble_sort@plt>
mov    $0x12,%esi
cmp    $0xffffffff,%eax
jne    1162 <test_null+0x42>
xor    %ebx,%ebx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <bubble_sort@plt>
mov    $0x13,%esi
cmp    $0xffffffff,%eax
je     1175 <test_null+0x55>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9f(%rip),%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Line number is: %d\0A\00"
@.str.1 = [25 x i8] c"error, sorted NULL array\00"
define i8* @test_null() {
%1 = alloca i8*
%2 = alloca i32*
store i32* null, i32** %2
br label %3
3: ; preds = %0
%4 = load i32*, i32** %2
%5 = call i32 @bubble_sort(i32* %4, i32 10)
%6 = icmp eq i32 %5, -1
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 17)
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %27
9: ; preds = %3
br label %10
10: ; preds = %9
br label %11
11: ; preds = %10
%12 = load i32*, i32** %2
%13 = call i32 @bubble_sort(i32* %12, i32 -4)
%14 = icmp eq i32 %13, -1
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 18)
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %27
17: ; preds = %11
br label %18
18: ; preds = %17
br label %19
19: ; preds = %18
%20 = load i32*, i32** %2
%21 = call i32 @bubble_sort(i32* %20, i32 0)
%22 = icmp eq i32 %21, -1
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 19)
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %27
25: ; preds = %19
br label %26
26: ; preds = %25
store i8* null, i8** %1
br label %27
27: ; preds = %26, %23, %15, %7
%28 = load i8*, i8** %1
ret i8* %28
}

LLVM IR (-O2):
@.str = [20 x i8] c"Line number is: %d\0A\00"
@.str.1 = [25 x i8] c"error, sorted NULL array\00"
define i8* @test_null() {
%1 = tail call i32 @bubble_sort(i32* null, i32 10)
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %9
3: ; preds = %0
%4 = tail call i32 @bubble_sort(i32* null, i32 -4)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @bubble_sort(i32* null, i32 0)
%8 = icmp eq i32 %7, -1
br i1 %8, label %12, label %9
9: ; preds = %6, %3, %0
%10 = phi i32 [ 17, %0 ], [ 18, %3 ], [ 19, %6 ]
%11 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %6
%13 = phi i8* [ null, %6 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), %9 ]
ret i8* %13
}