#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*/ rs_debug(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
char *record_getpath(char *streamname) {
  static char _spath[1024];
  if (!streamname) {
    rs_debug("record getpath failed,streamname:%s\n", streamname);
    return NULL;
  }
  sprintf(_spath, "%s/%s%s", "records", streamname, ".flv");
  return _spath;
}


x86 assembly (clang, -O0):
<record_getpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <record_getpath+0x34>
mov    -0x10(%rbp),%rsi
lea    0xebe(%rip),%rdi
call   1030 <rs_debug@plt>
movq   $0x0,-0x8(%rbp)
jmp    1184 <record_getpath+0x64>
mov    -0x10(%rbp),%rcx
lea    0x2ee1(%rip),%rdi
lea    0xebf(%rip),%rsi
lea    0xec0(%rip),%rdx
lea    0xec1(%rip),%r8
call   1040 <sprintf@plt>
lea    0x2ec0(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<record_getpath>:
push   %rbx
test   %rdi,%rdi
je     114f <record_getpath+0x2f>
mov    %rdi,%rcx
lea    0x2f10(%rip),%rbx
lea    0xeee(%rip),%rsi
lea    0xeef(%rip),%rdx
lea    0xef0(%rip),%r8
mov    %rbx,%rdi
call   1040 <sprintf@plt>
jmp    115f <record_getpath+0x3f>
lea    0xeaa(%rip),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
call   1030 <rs_debug@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@record_getpath._spath = internal global [1024 x i8] zeroinitializer
@.str = [37 x i8] c"record getpath failed,streamname:%s\0A\00"
@.str.1 = [8 x i8] c"%s/%s%s\00"
@.str.2 = [8 x i8] c"records\00"
@.str.3 = [5 x i8] c".flv\00"
define i8* @record_getpath(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = call i32 @rs_debug(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %7)
store i8* null, i8** %2
br label %12
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @record_getpath._spath, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @record_getpath._spath, i64 0, i64 0), i8** %2
br label %12
12: ; preds = %9, %6
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@record_getpath._spath = internal global [1024 x i8] zeroinitializer
@.str = [37 x i8] c"record getpath failed,streamname:%s\0A\00"
@.str.1 = [8 x i8] c"%s/%s%s\00"
@.str.2 = [8 x i8] c"records\00"
@.str.3 = [5 x i8] c".flv\00"
define i8* @record_getpath(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @rs_debug(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* null)
br label %7
5: ; preds = %1
%6 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @record_getpath._spath, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
%8 = phi i8* [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @record_getpath._spath, i64 0, i64 0), %5 ], [ null, %3 ]
ret i8* %8
}