#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;
struct where {
  int dummy;
};

/* Variables and functions */
struct where *default_where(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char const *,
                           char const *, int, char const *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
char *where_str(struct where const *);
void ice_msg(const char *pre, const char *f, int line, const char *fn,
             const char *fmt, va_list l) {
  const struct where *w = default_where(NULL);
  fprintf(stderr, "%s: %s %s:%d (%s): ", where_str(w), pre, f, line, fn);
  vfprintf(stderr, fmt, l);
  fputc('\n', stderr);
}


x86 assembly (clang, -O0):
<ice_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <default_where@plt>
mov    %rax,-0x38(%rbp)
mov    0x2e5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <where_str@plt>
mov    -0x3c(%rbp),%edi
mov    %rax,%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x14(%rbp),%r9d
mov    -0x20(%rbp),%rax
lea    0xe52(%rip),%rsi
mov    %rax,(%rsp)
call   1040 <fprintf@plt>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1060 <vfprintf@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ice_msg>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,0xc(%rsp)
mov    %r8,0x10(%rsp)
mov    %rcx,%rbp
mov    %edx,%r12d
mov    %rsi,%r13
mov    %rdi,%rbx
xor    %edi,%edi
call   1050 <default_where@plt>
mov    0x2e5e(%rip),%r15
mov    (%r15),%r14d
mov    %rax,%rdi
call   1070 <where_str@plt>
mov    %rbp,(%rsp)
lea    0xe68(%rip),%rsi
mov    %r14d,%edi
mov    %rax,%rdx
mov    %rbx,%rcx
mov    %r13,%r8
mov    %r12d,%r9d
call   1040 <fprintf@plt>
mov    (%r15),%edi
mov    0x10(%rsp),%rsi
mov    0xc(%rsp),%edx
call   1060 <vfprintf@plt>
mov    (%r15),%esi
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
%struct.where = type { i32 }
@stderr = global i32 0
@.str = [20 x i8] c"%s: %s %s:%d (%s): \00"
define void @ice_msg(i8* %0, i8* %1, i32 %2, i8* %3, i8* %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca %struct.where*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%14 = call %struct.where* @default_where(i32* null)
store %struct.where* %14, %struct.where** %13
%15 = load i32, i32* @stderr
%16 = load %struct.where*, %struct.where** %13
%17 = call i8* @where_str(%struct.where* %16)
%18 = load i8*, i8** %7
%19 = load i8*, i8** %8
%20 = load i32, i32* %9
%21 = load i8*, i8** %10
%22 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %18, i8* %19, i32 %20, i8* %21)
%23 = load i32, i32* @stderr
%24 = load i8*, i8** %11
%25 = load i32, i32* %12
%26 = call i32 @vfprintf(i32 %23, i8* %24, i32 %25)
%27 = load i32, i32* @stderr
%28 = call i32 @fputc(i8 signext 10, i32 %27)
ret void
}

LLVM IR (-O2):
%struct.where = type { i32 }
@stderr = global i32 0
@.str = [20 x i8] c"%s: %s %s:%d (%s): \00"
define void @ice_msg(i8* %0, i8* %1, i32 %2, i8* %3, i8* %4, i32 %5) {
%7 = tail call %struct.where* @default_where(i32* null)
%8 = load i32, i32* @stderr
%9 = tail call i8* @where_str(%struct.where* %7)
%10 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %0, i8* %1, i32 %2, i8* %3)
%11 = load i32, i32* @stderr
%12 = tail call i32 @vfprintf(i32 %11, i8* %4, i32 %5)
%13 = load i32, i32* @stderr
%14 = tail call i32 @fputc(i8 signext 10, i32 %13)
ret void
}