#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 */
struct Session {
  int dummy;
};
struct PDUList {
  int dummy;
};
struct DCirList {
  int dummy;
};

/* Variables and functions */
scalar_t__ allocNode(struct DCirList **);
int /*<<< orphan*/ freePDU(struct Session *, struct PDUList *);
void freePDUs(struct Session *ses, struct PDUList **pdus) {
  struct PDUList *pdu;
  while (*pdus) {
    pdu = (struct PDUList *)allocNode((struct DCirList **)pdus);
    freePDU(ses, pdu);
  }
}


x86 assembly (clang, -O0):
<freePDUs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     115d <freePDUs+0x3d>
mov    -0x10(%rbp),%rdi
call   1030 <allocNode@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <freePDU@plt>
jmp    1130 <freePDUs+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freePDUs>:
push   %r14
push   %rbx
push   %rax
cmpq   $0x0,(%rsi)
je     1149 <freePDUs+0x29>
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rbx,%rdi
call   1030 <allocNode@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <freePDU@plt>
cmpq   $0x0,(%rbx)
jne    1130 <freePDUs+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.Session = type { i32 }
%struct.PDUList = type { i32 }
%struct.DCirList = type { i32 }
define void @freePDUs(%struct.Session* %0, %struct.PDUList** %1) {
%3 = alloca %struct.Session*
%4 = alloca %struct.PDUList**
%5 = alloca %struct.PDUList*
store %struct.Session* %0, %struct.Session** %3
store %struct.PDUList** %1, %struct.PDUList*** %4
br label %6
6: ; preds = %10, %2
%7 = load %struct.PDUList**, %struct.PDUList*** %4
%8 = load %struct.PDUList*, %struct.PDUList** %7
%9 = icmp ne %struct.PDUList* %8, null
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load %struct.PDUList**, %struct.PDUList*** %4
%12 = bitcast %struct.PDUList** %11 to %struct.DCirList**
%13 = call i64 @allocNode(%struct.DCirList** %12)
%14 = inttoptr i64 %13 to %struct.PDUList*
store %struct.PDUList* %14, %struct.PDUList** %5
%15 = load %struct.Session*, %struct.Session** %3
%16 = load %struct.PDUList*, %struct.PDUList** %5
%17 = call i32 @freePDU(%struct.Session* %15, %struct.PDUList* %16)
br label %6
18: ; preds = %6
ret void
}

LLVM IR (-O2):
%struct.Session = type { i32 }
%struct.PDUList = type { i32 }
%struct.DCirList = type { i32 }
define void @freePDUs(%struct.Session* %0, %struct.PDUList** %1) {
%3 = load %struct.PDUList*, %struct.PDUList** %1
%4 = icmp eq %struct.PDUList* %3, null
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = bitcast %struct.PDUList** %1 to %struct.DCirList**
br label %7
7: ; preds = %5, %7
%8 = tail call i64 @allocNode(%struct.DCirList** %6)
%9 = inttoptr i64 %8 to %struct.PDUList*
%10 = tail call i32 @freePDU(%struct.Session* %0, %struct.PDUList* %9)
%11 = load %struct.PDUList*, %struct.PDUList** %1
%12 = icmp eq %struct.PDUList* %11, null
br i1 %12, label %13, label %7
13: ; preds = %7, %2
ret void
}