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

/* Variables and functions */
int _imap4_fprintf(int /*<<< orphan*/ *, char *, char *, char *, ...);
int _send_misc(FILE *ofp, char *tag, char *prefix, char *message) {
  if (!tag)
    tag = "*";
  if (message) {
    return _imap4_fprintf(ofp, "%s %s %s\r\n", tag, prefix, message);
  } else {
    return _imap4_fprintf(ofp, "%s %s\r\n", tag, prefix);
  }
}


x86 assembly (clang, -O0):
<_send_misc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    113e <_send_misc+0x2e>
lea    0xec6(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     116f <_send_misc+0x5f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    0xea2(%rip),%rsi
mov    $0x0,%al
call   1030 <_imap4_fprintf@plt>
mov    %eax,-0x4(%rbp)
jmp    118c <_send_misc+0x7c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1030 <_imap4_fprintf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_send_misc>:
mov    %rcx,%r8
mov    %rdx,%rcx
test   %rsi,%rsi
lea    0xee0(%rip),%rdx
cmovne %rsi,%rdx
test   %r8,%r8
je     1137 <_send_misc+0x27>
lea    0xed2(%rip),%rsi
xor    %eax,%eax
jmp    1030 <_imap4_fprintf@plt>
lea    0xec7(%rip),%rsi
xor    %eax,%eax
jmp    1030 <_imap4_fprintf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"*\00"
@.str.1 = [11 x i8] c"%s %s %s\0D\0A\00"
@.str.2 = [8 x i8] c"%s %s\0D\0A\00"
define i32 @_send_misc(i32* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32* %0, i32** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%10 = load i8*, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %7
br label %13
13: ; preds = %12, %4
%14 = load i8*, i8** %9
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i32*, i32** %6
%18 = load i8*, i8** %7
%19 = load i8*, i8** %8
%20 = load i8*, i8** %9
%21 = call i32 (i32*, i8*, i8*, i8*, ...) @_imap4_fprintf(i32* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %18, i8* %19, i8* %20)
store i32 %21, i32* %5
br label %27
22: ; preds = %13
%23 = load i32*, i32** %6
%24 = load i8*, i8** %7
%25 = load i8*, i8** %8
%26 = call i32 (i32*, i8*, i8*, i8*, ...) @_imap4_fprintf(i32* %23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %24, i8* %25)
store i32 %26, i32* %5
br label %27
27: ; preds = %22, %16
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
@.str = [2 x i8] c"*\00"
@.str.1 = [11 x i8] c"%s %s %s\0D\0A\00"
@.str.2 = [8 x i8] c"%s %s\0D\0A\00"
define i32 @_send_misc(i32* %0, i8* %1, i8* %2, i8* %3) {
%5 = icmp eq i8* %1, null
%6 = select i1 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %1
%7 = icmp eq i8* %3, null
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 (i32*, i8*, i8*, i8*, ...) @_imap4_fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %2, i8* %3)
br label %12
10: ; preds = %4
%11 = tail call i32 (i32*, i8*, i8*, i8*, ...) @_imap4_fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* %2)
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}