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

/* Variables and functions */
int /*<<< orphan*/ generic_logger(struct logger_info *, struct logger_var *,
                                  char *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, int);
void log_with_pos_info(struct logger_info *logger, struct logger_var *var,
                       const char *filename, int line, const char *fmt,
                       va_list args) {
  char pos_info[128];
  snprintf(pos_info, 128, "%s:%d", filename, line);
  generic_logger(logger, var, pos_info, fmt, args);
}


x86 assembly (clang, -O0):
<log_with_pos_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    $0x80,%esi
lea    0xea3(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
call   1030 <generic_logger@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_with_pos_info>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x80,%rsp
mov    %r9d,%r14d
mov    %r8,%r15
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %rsi,%rbp
mov    %rdi,%rbx
lea    0xeb8(%rip),%rdx
mov    %rsp,%r12
mov    %r12,%rdi
mov    $0x80,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14d,%r8d
call   1030 <generic_logger@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.logger_info = type { i32 }
%struct.logger_var = type { i32 }
@.str = [6 x i8] c"%s:%d\00"
define void @log_with_pos_info(%struct.logger_info* %0, %struct.logger_var* %1, i8* %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca %struct.logger_info*
%8 = alloca %struct.logger_var*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca [128 x i8]
store %struct.logger_info* %0, %struct.logger_info** %7
store %struct.logger_var* %1, %struct.logger_var** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%15 = load i8*, i8** %9
%16 = load i32, i32* %10
%17 = call i32 @snprintf(i8* %14, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %15, i32 %16)
%18 = load %struct.logger_info*, %struct.logger_info** %7
%19 = load %struct.logger_var*, %struct.logger_var** %8
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%21 = load i8*, i8** %11
%22 = load i32, i32* %12
%23 = call i32 @generic_logger(%struct.logger_info* %18, %struct.logger_var* %19, i8* %20, i8* %21, i32 %22)
ret void
}

LLVM IR (-O2):
%struct.logger_info = type { i32 }
%struct.logger_var = type { i32 }
@.str = [6 x i8] c"%s:%d\00"
define void @log_with_pos_info(%struct.logger_info* %0, %struct.logger_var* %1, i8* %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca [128 x i8]
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%9 = call i32 @snprintf(i8* %8, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %3)
%10 = call i32 @generic_logger(%struct.logger_info* %0, %struct.logger_var* %1, i8* %8, i8* %4, i32 %5)
ret void
}