#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*/ sprintf(char *, char *, char *);
int sip_content_type_to_string(char *content_type, char **p_buffer) {
  if (content_type && p_buffer && *p_buffer) {
    sprintf(*p_buffer,
            "Content-Type"
            ": %s",
            content_type);
    return (int)0;
  }
  return (int)-1;
}


x86 assembly (clang, -O0):
<sip_content_type_to_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1167 <sip_content_type_to_string+0x57>
cmpq   $0x0,-0x18(%rbp)
je     1167 <sip_content_type_to_string+0x57>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1167 <sip_content_type_to_string+0x57>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeaa(%rip),%rsi
call   1030 <sprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    116e <sip_content_type_to_string+0x5e>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sip_content_type_to_string>:
push   %rax
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     1139 <sip_content_type_to_string+0x29>
test   %rsi,%rsi
je     1139 <sip_content_type_to_string+0x29>
mov    %rdi,%rdx
mov    (%rsi),%rdi
test   %rdi,%rdi
je     1139 <sip_content_type_to_string+0x29>
lea    0xece(%rip),%rsi
call   1030 <sprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"Content-Type: %s\00"
define i32 @sip_content_type_to_string(i8* %0, i8** %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8** %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %11
11: ; preds = %2, %6, %9
%12 = phi i32 [ 0, %9 ], [ -1, %6 ], [ -1, %2 ]
ret i32 %12
}