#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int strlen(char *);
char *strncpy(char *, char *, int);
extern int _sfcGetSlpHostname(char **hostname) {
  char *sn;
  sn = (char *)malloc((strlen("mycimom.com") + 1) * sizeof(char));
  sn = strncpy(sn, "mycimom.com", strlen("mycimom.com") + 1);
  if (sn == NULL)
    return 0;
  printf("-#- Request for custom SLP service hostname: (hostname = %s)\n", sn);
  *hostname = sn;
  return 1;
}


x86 assembly (clang, -O0):
<_sfcGetSlpHostname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xead(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe85(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
add    $0x1,%edx
lea    0xe70(%rip),%rsi
call   1030 <strncpy@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11b0 <_sfcGetSlpHostname+0x70>
movl   $0x0,-0x4(%rbp)
jmp    11d2 <_sfcGetSlpHostname+0x92>
mov    -0x18(%rbp),%rsi
lea    0xe51(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_sfcGetSlpHostname>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xeb1(%rip),%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strncpy@plt>
test   %rax,%rax
je     1199 <_sfcGetSlpHostname+0x59>
mov    %rax,%rbx
lea    0xe85(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    %rbx,(%r14)
mov    $0x1,%eax
jmp    119b <_sfcGetSlpHostname+0x5b>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"mycimom.com\00"
@.str.1 = [62 x i8] c"-#- Request for custom SLP service hostname: (hostname = %s)\0A\00"
define i32 @_sfcGetSlpHostname(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
%5 = call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%14 = add nsw i32 %13, 1
%15 = call i8* @strncpy(i8* %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %14)
store i8* %15, i8** %4
%16 = load i8*, i8** %4
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %19
18: ; preds = %1
store i32 0, i32* %2
br label %24
19: ; preds = %1
%20 = load i8*, i8** %4
%21 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = load i8*, i8** %4
%23 = load i8**, i8*** %3
store i8* %22, i8** %23
store i32 1, i32* %2
br label %24
24: ; preds = %19, %18
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [12 x i8] c"mycimom.com\00"
@.str.1 = [62 x i8] c"-#- Request for custom SLP service hostname: (hostname = %s)\0A\00"
define i32 @_sfcGetSlpHostname(i8** nocapture writeonly %0) {
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = add nsw i32 %6, 1
%8 = tail call i8* @strncpy(i8* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp eq i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = tail call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* %8)
store i8* %8, i8** %0
br label %12
12: ; preds = %1, %10
%13 = phi i32 [ 1, %10 ], [ 0, %1 ]
ret i32 %13
}