#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 int /*<<< orphan*/ ****thing;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ ******);
void condemnWarehouse(struct thing **warehouse, int x) {
  int i;
  for (i = 0; i < x + 2; i++) {
    free(warehouse[i]);
  }
  free(warehouse);
  return;
}


x86 assembly (clang, -O0):
<condemnWarehouse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    1156 <condemnWarehouse+0x46>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <condemnWarehouse+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<condemnWarehouse>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
cmp    $0xffffffff,%esi
jl     1142 <condemnWarehouse+0x32>
mov    %esi,%r15d
add    $0x2,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <condemnWarehouse+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.thing = type opaque
define void @condemnWarehouse(%struct.thing** %0, i32 %1) {
%3 = alloca %struct.thing**
%4 = alloca i32
%5 = alloca i32
store %struct.thing** %0, %struct.thing*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %19, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 2
%10 = icmp slt i32 %7, %9
br i1 %10, label %11, label %22
11: ; preds = %6
%12 = load %struct.thing**, %struct.thing*** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds %struct.thing*, %struct.thing** %12, i64 %14
%16 = load %struct.thing*, %struct.thing** %15
%17 = bitcast %struct.thing* %16 to i32******
%18 = call i32 @free(i32****** %17)
br label %19
19: ; preds = %11
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %6
22: ; preds = %6
%23 = load %struct.thing**, %struct.thing*** %3
%24 = bitcast %struct.thing** %23 to i32******
%25 = call i32 @free(i32****** %24)
ret void
}

LLVM IR (-O2):
%struct.thing = type opaque
define void @condemnWarehouse(%struct.thing** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, -2
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = add i32 %1, 2
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %13, %7 ]
%9 = getelementptr inbounds %struct.thing*, %struct.thing** %0, i64 %8
%10 = bitcast %struct.thing** %9 to i32*******
%11 = load i32******, i32******* %10
%12 = tail call i32 @free(i32****** %11)
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %15, label %7
15: ; preds = %7, %2
%16 = bitcast %struct.thing** %0 to i32******
%17 = tail call i32 @free(i32****** %16)
ret void
}