#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*/ m_clear(int);
int /*<<< orphan*/ m_free(int);
scalar_t__ m_next(int, int *, int **);
void slop_free_message(int buf) {
  int p;
  int *cur;
  if (!buf)
    return;
  for (p = -1; m_next(buf, &p, &cur);) {
    if (*cur)
      m_free(*cur);
  }
  m_clear(buf);
}


x86 assembly (clang, -O0):
<slop_free_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114a <slop_free_message+0x1a>
jmp    1190 <slop_free_message+0x60>
movl   $0xffffffff,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1050 <m_next@plt>
cmp    $0x0,%rax
je     1188 <slop_free_message+0x58>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
je     1183 <slop_free_message+0x53>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <m_free@plt>
jmp    1151 <slop_free_message+0x21>
mov    -0x4(%rbp),%edi
call   1040 <m_clear@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slop_free_message>:
test   %edi,%edi
je     11a4 <slop_free_message+0x74>
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movl   $0xffffffff,0x4(%rsp)
ff
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <m_next@plt>
test   %rax,%rax
je     1194 <slop_free_message+0x64>
lea    0x4(%rsp),%r14
lea    0x8(%rsp),%r15
jmp    1182 <slop_free_message+0x52>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <m_next@plt>
test   %rax,%rax
je     1194 <slop_free_message+0x64>
mov    0x8(%rsp),%rax
mov    (%rax),%edi
test   %edi,%edi
je     1170 <slop_free_message+0x40>
call   1030 <m_free@plt>
jmp    1170 <slop_free_message+0x40>
mov    %ebx,%edi
call   1040 <m_clear@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @slop_free_message(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
br label %25
8: ; preds = %1
store i32 -1, i32* %3
br label %9
9: ; preds = %21, %8
%10 = load i32, i32* %2
%11 = call i64 @m_next(i32 %10, i32* %3, i32** %4)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = load i32*, i32** %4
%15 = load i32, i32* %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = call i32 @m_free(i32 %19)
br label %21
21: ; preds = %17, %13
br label %9
22: ; preds = %9
%23 = load i32, i32* %2
%24 = call i32 @m_clear(i32 %23)
br label %25
25: ; preds = %22, %7
ret void
}

LLVM IR (-O2):
define void @slop_free_message(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32** %3 to i8*
%6 = icmp eq i32 %0, 0
br i1 %6, label %21, label %7
7: ; preds = %1
store i32 -1, i32* %2
%8 = call i64 @m_next(i32 %0, i32* %2, i32** %3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %19, label %10
10: ; preds = %7, %16
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = call i32 @m_free(i32 %12)
br label %16
16: ; preds = %14, %10
%17 = call i64 @m_next(i32 %0, i32* %2, i32** %3)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %10
19: ; preds = %16, %7
%20 = call i32 @m_clear(i32 %0)
br label %21
21: ; preds = %1, %19
ret void
}