#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 */
char *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int strlen(char *);
char *strncpy(char *, char *, int);
extern int _sfcGetSlpHostname(char **hostname) {
  char *sn;
  sn = 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 i8* @malloc(i32 %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%13 = add nsw i32 %12, 1
%14 = call i8* @strncpy(i8* %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %13)
store i8* %14, i8** %4
%15 = load i8*, i8** %4
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %1
store i32 0, i32* %2
br label %23
18: ; preds = %1
%19 = load i8*, i8** %4
%20 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i8*, i8** %4
%22 = load i8**, i8*** %3
store i8* %21, i8** %22
store i32 1, i32* %2
br label %23
23: ; preds = %18, %17
%24 = load i32, i32* %2
ret i32 %24
}

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 i8* @malloc(i32 %3)
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = add nsw i32 %5, 1
%7 = tail call i8* @strncpy(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* %7)
store i8* %7, i8** %0
br label %11
11: ; preds = %1, %9
%12 = phi i32 [ 1, %9 ], [ 0, %1 ]
ret i32 %12
}