#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ vis5d_debug_msg(char *);
int vis5d_debug_msg2(char *str1, char *str2) {
  char str[256];
  if (*str1 == '\n') {
    fprintf(stderr, "\n");
    str1++;
  }
  sprintf(str, "%s: ", str1);
  if (str2 != 0) {
    strcat(str, str2);
    strcat(str, "\n");
  }
  vis5d_debug_msg(str);
  return 1;
}


x86 assembly (clang, -O0):
<vis5d_debug_msg2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1184 <vis5d_debug_msg2+0x44>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe6c(%rip),%rsi
call   1060 <sprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     11c9 <vis5d_debug_msg2+0x89>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x110(%rbp),%rdi
lea    0xe3c(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x110(%rbp),%rdi
call   1040 <vis5d_debug_msg@plt>
mov    $0x1,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vis5d_debug_msg2>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
cmpb   $0xa,(%rdi)
jne    116e <vis5d_debug_msg2+0x2e>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x1,%rbx
lea    0xe8d(%rip),%rsi
mov    %rsp,%rdi
mov    %rbx,%rdx
call   1060 <sprintf@plt>
test   %r14,%r14
je     11a2 <vis5d_debug_msg2+0x62>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
lea    0xe66(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rsp,%rdi
call   1040 <vis5d_debug_msg@plt>
mov    $0x1,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [5 x i8] c"%s: \00"
define i32 @vis5d_debug_msg2(i8* %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 10
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds i8, i8* %0, i64 1
br label %11
11: ; preds = %7, %2
%12 = phi i8* [ %10, %7 ], [ %0, %2 ]
%13 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = icmp eq i8* %1, null
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = call i32 @strcat(i8* %4, i8* %1)
%17 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %15, %11
%19 = call i32 @vis5d_debug_msg(i8* %4)
ret i32 1
}