#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*/ free(char **);
int /*<<< orphan*/ free_string_field(char **);
void free_multiple_string_field(unsigned int len, char ***arg, char ***orig) {
  unsigned int i;
  if (*arg) {
    for (i = 0; i < len; ++i) {
      free_string_field(&((*arg)[i]));
      free_string_field(&((*orig)[i]));
    }
    free_string_field(&((*arg)[0]));
    free(*arg);
    *arg = 0;
    free(*orig);
    *orig = 0;
  }
}


x86 assembly (clang, -O0):
<free_multiple_string_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     11c8 <free_multiple_string_field+0xa8>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    118e <free_multiple_string_field+0x6e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x1c(%rbp),%eax
shl    $0x3,%rax
add    %rax,%rdi
call   1040 <free_string_field@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x1c(%rbp),%eax
shl    $0x3,%rax
add    %rax,%rdi
call   1040 <free_string_field@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1148 <free_multiple_string_field+0x28>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <free_string_field@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_multiple_string_field>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edi,%eax
mov    (%rsi),%rdi
test   %rdi,%rdi
je     1192 <free_multiple_string_field+0x72>
mov    %rdx,%r14
mov    %rsi,%r15
test   %eax,%eax
je     116f <free_multiple_string_field+0x4f>
mov    %eax,%r12d
shl    $0x3,%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
add    %rbx,%rdi
call   1040 <free_string_field@plt>
mov    (%r14),%rdi
add    %rbx,%rdi
call   1040 <free_string_field@plt>
mov    (%r15),%rdi
add    $0x8,%rbx
cmp    %rbx,%r12
jne    1150 <free_multiple_string_field+0x30>
call   1040 <free_string_field@plt>
mov    (%r15),%rdi
call   1030 <free@plt>
movq   $0x0,(%r15)
mov    (%r14),%rdi
call   1030 <free@plt>
movq   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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