void free_int_RT_4D(int N_X, int K, int nrow, int ****RT4D) {
  int n_X, k;
  for (n_X = 0; n_X < N_X; n_X++) {
    for (k = 0; k < K; k++) {
      free_int_RT(nrow, RT4D[n_X][k]);
    }
    free(RT4D[n_X]);
  }
  free(RT4D);
}


x86 assembly (clang, -O0):
<free_int_RT_4D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a6 <free_int_RT_4D+0x86>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1187 <free_int_RT_4D+0x67>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x0,%al
call   1040 <free_int_RT@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114f <free_int_RT_4D+0x2f>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <free_int_RT_4D+0x1c>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_int_RT_4D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r13
mov    %esi,0x4(%rsp)
test   %edi,%edi
jle    118e <free_int_RT_4D+0x6e>
mov    %edx,%r12d
mov    %edi,%r15d
mov    0x4(%rsp),%ebp
xor    %ebx,%ebx
jmp    1163 <free_int_RT_4D+0x43>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%r13,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %r15,%rbx
je     118e <free_int_RT_4D+0x6e>
cmpl   $0x0,0x4(%rsp)
jle    1150 <free_int_RT_4D+0x30>
xor    %r14d,%r14d
nopl   (%rax)
mov    0x0(%r13,%rbx,8),%rax
mov    (%rax,%r14,8),%rsi
mov    %r12d,%edi
xor    %eax,%eax
call   1040 <free_int_RT@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    1170 <free_int_RT_4D+0x50>
jmp    1150 <free_int_RT_4D+0x30>
mov    %r13,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_int_RT_4D(i32 %0, i32 %1, i32 %2, i32**** %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32****
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32**** %3, i32***** %8
store i32 0, i32* %9
br label %11
11: ; preds = %42, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %45
15: ; preds = %11
store i32 0, i32* %10
br label %16
16: ; preds = %32, %15
%17 = load i32, i32* %10
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %35
20: ; preds = %16
%21 = load i32, i32* %7
%22 = load i32****, i32***** %8
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32***, i32**** %22, i64 %24
%26 = load i32***, i32**** %25
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32**, i32*** %26, i64 %28
%30 = load i32**, i32*** %29
%31 = call i32 (i32, i32**, ...) bitcast (i32 (...)* @free_int_RT to i32 (i32, i32**, ...)*)(i32 %21, i32** %30)
br label %32
32: ; preds = %20
%33 = load i32, i32* %10
%34 = add nsw i32 %33, 1
store i32 %34, i32* %10
br label %16
35: ; preds = %16
%36 = load i32****, i32***** %8
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32***, i32**** %36, i64 %38
%40 = load i32***, i32**** %39
%41 = bitcast i32*** %40 to i8*
br label %42
42: ; preds = %35
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
br label %11
45: ; preds = %11
%46 = load i32****, i32***** %8
%47 = bitcast i32**** %46 to i8*
ret void
}

LLVM IR (-O2):
define void @free_int_RT_4D(i32 %0, i32 %1, i32 %2, i32**** nocapture %3) {
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %28
6: ; preds = %4
%7 = icmp sgt i32 %1, 0
%8 = zext i32 %0 to i64
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %6, %22
%11 = phi i64 [ 0, %6 ], [ %26, %22 ]
br i1 %7, label %12, label %22
12: ; preds = %10
%13 = getelementptr inbounds i32***, i32**** %3, i64 %11
br label %14
14: ; preds = %12, %14
%15 = phi i64 [ 0, %12 ], [ %20, %14 ]
%16 = load i32***, i32**** %13
%17 = getelementptr inbounds i32**, i32*** %16, i64 %15
%18 = load i32**, i32*** %17
%19 = tail call i32 (i32, i32**, ...) bitcast (i32 (...)* @free_int_RT to i32 (i32, i32**, ...)*)(i32 %2, i32** %18)
%20 = add nuw nsw i64 %15, 1
%21 = icmp eq i64 %20, %9
br i1 %21, label %22, label %14
22: ; preds = %14, %10
%23 = getelementptr inbounds i32***, i32**** %3, i64 %11
%24 = bitcast i32**** %23 to i8**
%25 = load i8*, i8** %24
tail call void @free(i8* %25)
%26 = add nuw nsw i64 %11, 1
%27 = icmp eq i64 %26, %8
br i1 %27, label %28, label %10
28: ; preds = %22, %4
%29 = bitcast i32**** %3 to i8*
tail call void @free(i8* %29)
ret void
}