#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 *BR_(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char const *);
int /*<<< orphan*/ stderr;
char *str(scalar_t__);
scalar_t__ strlen(char const *);
void fish_warn(const char *s) {
  char *new = str(strlen(s) + 1 + 5 + 4 + 2 + 1);
  char *c = BR_("*");
  sprintf(new, "%s %s\n", c, s);
  fprintf(stderr, new);
  free(new);
  free(c);
}


x86 assembly (clang, -O0):
<fish_warn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
add    $0x5,%rdi
add    $0x4,%rdi
add    $0x2,%rdi
add    $0x1,%rdi
call   1060 <str@plt>
mov    %rax,-0x10(%rbp)
lea    0xe64(%rip),%rdi
call   1070 <BR_@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe4a(%rip),%rsi
call   1080 <sprintf@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fish_warn>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0xd(%rax),%rdi
call   1060 <str@plt>
mov    %rax,%rbx
lea    0xe80(%rip),%rdi
call   1070 <BR_@plt>
mov    %rax,%r15
lea    0xe73(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
mov    %r14,%rcx
call   1080 <sprintf@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"*\00"
@.str.1 = [7 x i8] c"%s %s\0A\00"
@stderr = global i32 0
define void @fish_warn(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 1
%8 = add nsw i64 %7, 5
%9 = add nsw i64 %8, 4
%10 = add nsw i64 %9, 2
%11 = add nsw i64 %10, 1
%12 = call i8* @str(i64 %11)
store i8* %12, i8** %3
%13 = call i8* @BR_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %13, i8** %4
%14 = load i8*, i8** %3
%15 = load i8*, i8** %4
%16 = load i8*, i8** %2
%17 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %16)
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %3
%20 = call i32 @fprintf(i32 %18, i8* %19)
%21 = load i8*, i8** %3
%22 = call i32 @free(i8* %21)
%23 = load i8*, i8** %4
%24 = call i32 @free(i8* %23)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"*\00"
@.str.1 = [7 x i8] c"%s %s\0A\00"
@stderr = global i32 0
define void @fish_warn(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 13
%4 = tail call i8* @str(i64 %3)
%5 = tail call i8* @BR_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %0)
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* %4)
%9 = tail call i32 @free(i8* %4)
%10 = tail call i32 @free(i8* %5)
ret void
}