#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 */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strlen(char const *);
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void runes_vwarn(const char *fmt, va_list ap) {
  size_t fmt_len;
  char *fmt_with_nl;
  fmt_len = strlen(fmt);
  fmt_with_nl = malloc(fmt_len + 2);
  strcpy(fmt_with_nl, fmt);
  fmt_with_nl[fmt_len] = '\n';
  fmt_with_nl[fmt_len + 1] = '\0';
  vfprintf(stderr, fmt_with_nl, ap);
}


x86 assembly (clang, -O0):
<runes_vwarn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0xa,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,0x1(%rax,%rcx,1)
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1060 <vfprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runes_vwarn>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r15
call   1040 <strlen@plt>
mov    %rax,%rbp
lea    0x2(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
movw   $0xa,(%rbx,%rbp,1)
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <vfprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @runes_vwarn(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = add i64 %9, 2
%11 = call i8* @malloc(i64 %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = load i8*, i8** %3
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = load i8*, i8** %6
%16 = load i64, i64* %5
%17 = getelementptr inbounds i8, i8* %15, i64 %16
store i8 10, i8* %17
%18 = load i8*, i8** %6
%19 = load i64, i64* %5
%20 = add i64 %19, 1
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 0, i8* %21
%22 = load i32, i32* @stderr
%23 = load i8*, i8** %6
%24 = load i32, i32* %4
%25 = call i32 @vfprintf(i32 %22, i8* %23, i32 %24)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @runes_vwarn(i8* %0, i32 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = add i64 %3, 2
%5 = tail call i8* @malloc(i64 %4)
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
%7 = getelementptr inbounds i8, i8* %5, i64 %3
store i8 10, i8* %7
%8 = add i64 %3, 1
%9 = getelementptr inbounds i8, i8* %5, i64 %8
store i8 0, i8* %9
%10 = load i32, i32* @stderr
%11 = tail call i32 @vfprintf(i32 %10, i8* %5, i32 %1)
ret void
}