#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__ bubble_sort(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
char *test_lt_size() {
  int array[] = {123, 10, -56, 0, 90, 154};
  do {
    if (!(bubble_sort(array, 3) == 0)) {
      printf("Line number is: %d\n", 46);
      return "error, unable to sort successful";
    }
  } while (0);
  int i = 0;
  printf("Sorted: ");
  for (; i < 3; i++) {
    printf("%d\t", array[i]);
  }
  puts("");
  printf("Complete array: ");
  for (i = 0; i < 6; i++) {
    printf("%d\t", array[i]);
  }
  puts("");
  return 0;
}


x86 assembly (clang, -O0):
<test_lt_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xebb(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x3,%esi
call   1050 <bubble_sort@plt>
cmp    $0x0,%rax
je     1194 <test_lt_size+0x64>
lea    0xea0(%rip),%rdi
mov    $0x2e,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    123f <test_lt_size+0x10f>
jmp    1199 <test_lt_size+0x69>
movl   $0x0,-0x24(%rbp)
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x3,-0x24(%rbp)
jge    11dc <test_lt_size+0xac>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ae <test_lt_size+0x7e>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x6,-0x24(%rbp)
jge    122b <test_lt_size+0xfb>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11fd <test_lt_size+0xcd>
lea    0xe27(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_lt_size>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0xed2(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
call   1050 <bubble_sort@plt>
test   %rax,%rax
je     117f <test_lt_size+0x4f>
lea    0xeb1(%rip),%rdi
mov    $0x2e,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb2(%rip),%r14
jmp    1235 <test_lt_size+0x105>
lea    0xec7(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%esi
lea    0xebc(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.test_lt_size.array = [6 x i32] [i32 123, i32 10, i32 -56, i32 0, i32 90, i32 154]
@.str = [20 x i8] c"Line number is: %d\0A\00"
@.str.1 = [33 x i8] c"error, unable to sort successful\00"
@.str.2 = [9 x i8] c"Sorted: \00"
@.str.3 = [4 x i8] c"%d\09\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [17 x i8] c"Complete array: \00"
define i8* @test_lt_size() {
%1 = alloca i8*
%2 = alloca [6 x i32]
%3 = alloca i32
%4 = bitcast [6 x i32]* %2 to i8*
br label %5
5: ; preds = %0
%6 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%7 = call i64 @bubble_sort(i32* %6, i32 3)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 46)
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %43
11: ; preds = %5
br label %12
12: ; preds = %11
store i32 0, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %23, %12
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %26
17: ; preds = %14
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %17
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %14
26: ; preds = %14
%27 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %29
29: ; preds = %38, %26
%30 = load i32, i32* %3
%31 = icmp slt i32 %30, 6
br i1 %31, label %32, label %41
32: ; preds = %29
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %29
41: ; preds = %29
%42 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
store i8* null, i8** %1
br label %43
43: ; preds = %41, %9
%44 = load i8*, i8** %1
ret i8* %44
}

LLVM IR (-O2):
@__const.test_lt_size.array = [6 x i32] [i32 123, i32 10, i32 -56, i32 0, i32 90, i32 154]
@.str = [20 x i8] c"Line number is: %d\0A\00"
@.str.1 = [33 x i8] c"error, unable to sort successful\00"
@.str.2 = [9 x i8] c"Sorted: \00"
@.str.3 = [4 x i8] c"%d\09\00"
@.str.5 = [17 x i8] c"Complete array: \00"
define i8* @test_lt_size() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i64 @bubble_sort(i32* %3, i32 3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 46)
br label %36
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = call i32 @putchar(i32 10)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %12
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %15
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 3
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 4
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = call i32 @putchar(i32 10)
br label %36
36: ; preds = %8, %6
%37 = phi i8* [ null, %8 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), %6 ]
ret i8* %37
}