#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*/ ****score;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ ******);
void free_scorelist(struct score **scores) {
  struct score **tmp;
  if (scores == NULL)
    return;
  tmp = scores;
  while (*tmp != NULL) {
    free(*tmp);
    tmp++;
  }
  free(scores);
}


x86 assembly (clang, -O0):
<free_scorelist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <free_scorelist+0x1c>
jmp    1168 <free_scorelist+0x58>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     115f <free_scorelist+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <free_scorelist+0x24>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_scorelist>:
test   %rdi,%rdi
je     1150 <free_scorelist+0x40>
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <free_scorelist+0x31>
lea    0x8(%r14),%rbx
nopl   0x0(%rax,%rax,1)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <free_scorelist+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>
ret

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

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