#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 */
typedef size_t uint32_t;
struct blue_object {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct blue_object *);
void blue_array_clean(struct blue_object **array, uint32_t array_size) {
  if (array) {
    for (uint32_t i = 0; i < array_size; i++) {
      if (array[i]) {
        free(array[i]);
      }
    }
  }
}


x86 assembly (clang, -O0):
<blue_array_clean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1180 <blue_array_clean+0x70>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    117b <blue_array_clean+0x6b>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1165 <blue_array_clean+0x55>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    116a <blue_array_clean+0x5a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1133 <blue_array_clean+0x23>
jmp    1180 <blue_array_clean+0x70>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blue_array_clean>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1149 <blue_array_clean+0x39>
mov    %rsi,%r14
test   %rsi,%rsi
je     1149 <blue_array_clean+0x39>
mov    %rdi,%r15
xor    %ebx,%ebx
jmp    1139 <blue_array_clean+0x29>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%r14
je     1149 <blue_array_clean+0x39>
mov    (%r15,%rbx,8),%rdi
test   %rdi,%rdi
je     1130 <blue_array_clean+0x20>
call   1030 <free@plt>
jmp    1130 <blue_array_clean+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.blue_object = type { i32 }
define void @blue_array_clean(%struct.blue_object** %0, i64 %1) {
%3 = alloca %struct.blue_object**
%4 = alloca i64
%5 = alloca i64
store %struct.blue_object** %0, %struct.blue_object*** %3
store i64 %1, i64* %4
%6 = load %struct.blue_object**, %struct.blue_object*** %3
%7 = icmp ne %struct.blue_object** %6, null
br i1 %7, label %8, label %30
8: ; preds = %2
store i64 0, i64* %5
br label %9
9: ; preds = %26, %8
%10 = load i64, i64* %5
%11 = load i64, i64* %4
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %29
13: ; preds = %9
%14 = load %struct.blue_object**, %struct.blue_object*** %3
%15 = load i64, i64* %5
%16 = getelementptr inbounds %struct.blue_object*, %struct.blue_object** %14, i64 %15
%17 = load %struct.blue_object*, %struct.blue_object** %16
%18 = icmp ne %struct.blue_object* %17, null
br i1 %18, label %19, label %25
19: ; preds = %13
%20 = load %struct.blue_object**, %struct.blue_object*** %3
%21 = load i64, i64* %5
%22 = getelementptr inbounds %struct.blue_object*, %struct.blue_object** %20, i64 %21
%23 = load %struct.blue_object*, %struct.blue_object** %22
%24 = call i32 @free(%struct.blue_object* %23)
br label %25
25: ; preds = %19, %13
br label %26
26: ; preds = %25
%27 = load i64, i64* %5
%28 = add i64 %27, 1
store i64 %28, i64* %5
br label %9
29: ; preds = %9
br label %30
30: ; preds = %29, %2
ret void
}

LLVM IR (-O2):
%struct.blue_object = type { i32 }
define void @blue_array_clean(%struct.blue_object** %0, i64 %1) {
%3 = icmp ne %struct.blue_object** %0, null
%4 = icmp ne i64 %1, 0
%5 = and i1 %3, %4
br i1 %5, label %6, label %16
6: ; preds = %2, %13
%7 = phi i64 [ %14, %13 ], [ 0, %2 ]
%8 = getelementptr inbounds %struct.blue_object*, %struct.blue_object** %0, i64 %7
%9 = load %struct.blue_object*, %struct.blue_object** %8
%10 = icmp eq %struct.blue_object* %9, null
br i1 %10, label %13, label %11
11: ; preds = %6
%12 = tail call i32 @free(%struct.blue_object* %9)
br label %13
13: ; preds = %6, %11
%14 = add nuw i64 %7, 1
%15 = icmp eq i64 %14, %1
br i1 %15, label %16, label %6
16: ; preds = %13, %2
ret void
}