#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 client {
  int dummy;
};

/* Variables and functions */
char *audio_get_mixer_channel_name();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ send_data_str(struct client *, char *);
int req_get_mixer_channel_name(struct client *cli) {
  int status = 1;
  char *name = audio_get_mixer_channel_name();
  if (!send_data_str(cli, name ? name : ""))
    status = 0;
  free(name);
  return status;
}


x86 assembly (clang, -O0):
<req_get_mixer_channel_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    $0x0,%al
call   1050 <audio_get_mixer_channel_name@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116e <req_get_mixer_channel_name+0x3e>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    117e <req_get_mixer_channel_name+0x4e>
lea    0xe8b(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    117e <req_get_mixer_channel_name+0x4e>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <send_data_str@plt>
cmp    $0x0,%eax
jne    119b <req_get_mixer_channel_name+0x6b>
movl   $0x0,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<req_get_mixer_channel_name>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <audio_get_mixer_channel_name@plt>
mov    %rax,%rbx
test   %rax,%rax
lea    0xeb5(%rip),%rsi
cmovne %rax,%rsi
mov    %r14,%rdi
call   1040 <send_data_str@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.client = type { i32 }
@.str = [1 x i8] zeroinitializer
define i32 @req_get_mixer_channel_name(%struct.client* %0) {
%2 = alloca %struct.client*
%3 = alloca i32
%4 = alloca i8*
store %struct.client* %0, %struct.client** %2
store i32 1, i32* %3
%5 = call i8* (...) @audio_get_mixer_channel_name()
store i8* %5, i8** %4
%6 = load %struct.client*, %struct.client** %2
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i8*, i8** %4
br label %12
11: ; preds = %1
br label %12
12: ; preds = %11, %9
%13 = phi i8* [ %10, %9 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %11 ]
%14 = call i32 @send_data_str(%struct.client* %6, i8* %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %12
store i32 0, i32* %3
br label %17
17: ; preds = %16, %12
%18 = load i8*, i8** %4
%19 = call i32 @free(i8* %18)
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
%struct.client = type { i32 }
@.str = [1 x i8] zeroinitializer
define i32 @req_get_mixer_channel_name(%struct.client* %0) {
%2 = tail call i8* (...) @audio_get_mixer_channel_name()
%3 = icmp eq i8* %2, null
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %2
%5 = tail call i32 @send_data_str(%struct.client* %0, i8* %4)
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @free(i8* %2)
ret i32 %7
}