#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*/ swap(int *, int);
void seq_buuble_sort(int *list, int size) {
  int i;
  int list_length;
  for (list_length = size; list_length >= 2; list_length--) {
    for (i = 0; i < list_length - 1; i++) {
      swap(list, i);
    }
  }
}


x86 assembly (clang, -O0):
<seq_buuble_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jl     1174 <seq_buuble_sort+0x64>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1161 <seq_buuble_sort+0x51>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <swap@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <seq_buuble_sort+0x26>
jmp    1166 <seq_buuble_sort+0x56>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1125 <seq_buuble_sort+0x15>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seq_buuble_sort>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x2,%esi
jl     115a <seq_buuble_sort+0x4a>
mov    %esi,%r14d
mov    %rdi,%r15
lea    -0x1(%r14),%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14d,%r12d
lea    -0x1(%r12),%r14d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <swap@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1140 <seq_buuble_sort+0x30>
add    $0xffffffff,%ebx
cmp    $0x3,%r12d
jge    1130 <seq_buuble_sort+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @seq_buuble_sort(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* %4
store i32 %7, i32* %6
br label %8
8: ; preds = %25, %2
%9 = load i32, i32* %6
%10 = icmp sge i32 %9, 2
br i1 %10, label %11, label %28
11: ; preds = %8
store i32 0, i32* %5
br label %12
12: ; preds = %21, %11
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = sub nsw i32 %14, 1
%16 = icmp slt i32 %13, %15
br i1 %16, label %17, label %24
17: ; preds = %12
%18 = load i32*, i32** %3
%19 = load i32, i32* %5
%20 = call i32 @swap(i32* %18, i32 %19)
br label %21
21: ; preds = %17
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %12
24: ; preds = %12
br label %25
25: ; preds = %24
%26 = load i32, i32* %6
%27 = add nsw i32 %26, -1
store i32 %27, i32* %6
br label %8
28: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @seq_buuble_sort(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %6, label %16
4: ; preds = %11
%5 = icmp sgt i32 %8, 2
br i1 %5, label %6, label %16
6: ; preds = %2, %4
%7 = phi i32 [ %9, %4 ], [ %1, %2 ]
%8 = phi i32 [ %10, %4 ], [ %1, %2 ]
%9 = add i32 %7, -1
%10 = add nsw i32 %8, -1
br label %11
11: ; preds = %6, %11
%12 = phi i32 [ %14, %11 ], [ 0, %6 ]
%13 = tail call i32 @swap(i32* %0, i32 %12)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, %9
br i1 %15, label %4, label %11
16: ; preds = %4, %2
ret void
}