#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*/ fflush(int /*<<< orphan*/);
int printf(char *, char const *, ...);
int /*<<< orphan*/ stdout;
char *strrchr(char const *, char);
int std_out(void *p, const char *file, size_t line, const char *str) {
  int ret;
  ((void)p);
  if (file) {
    ret = printf("%16s:%04ld  %s\n",
                 strrchr(file, '/')    ? (strrchr(file, '/') + 1)
                 : strrchr(file, '\\') ? (strrchr(file, '\\') + 1)
                                       : file,
                 line, str);
  } else {
    ret = printf("%s", str);
  }
  fflush(stdout);
  return ret;
}


x86 assembly (clang, -O0):
<std_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11eb <std_out+0xbb>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
cmp    $0x0,%rax
je     1186 <std_out+0x56>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11c9 <std_out+0x99>
mov    -0x10(%rbp),%rdi
mov    $0x5c,%esi
call   1040 <strrchr@plt>
cmp    $0x0,%rax
je     11b9 <std_out+0x89>
mov    -0x10(%rbp),%rdi
mov    $0x5c,%esi
call   1040 <strrchr@plt>
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11c1 <std_out+0x91>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    %eax,-0x24(%rbp)
jmp    1200 <std_out+0xd0>
mov    -0x20(%rbp),%rsi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    %eax,-0x24(%rbp)
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0x24(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<std_out>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r15
test   %rsi,%rsi
je     115b <std_out+0x2b>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rsi,%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     116e <std_out+0x3e>
add    $0x1,%rax
jmp    1189 <std_out+0x59>
lea    0xeae(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11a0 <std_out+0x70>
mov    %rbx,%rdi
mov    $0x5c,%esi
call   1040 <strrchr@plt>
mov    %rax,%rcx
add    $0x1,%rax
test   %rcx,%rcx
cmove  %rbx,%rax
lea    0xe70(%rip),%rdi
mov    %rax,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %eax,%ebx
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%16s:%04ld %s\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@stdout = global i32 0
define i32 @std_out(i8* %0, i8* %1, i64 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %38
13: ; preds = %4
%14 = load i8*, i8** %6
%15 = call i8* @strrchr(i8* %14, i8 signext 47)
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i8*, i8** %6
%19 = call i8* @strrchr(i8* %18, i8 signext 47)
%20 = getelementptr inbounds i8, i8* %19, i64 1
br label %33
21: ; preds = %13
%22 = load i8*, i8** %6
%23 = call i8* @strrchr(i8* %22, i8 signext 92)
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i8*, i8** %6
%27 = call i8* @strrchr(i8* %26, i8 signext 92)
%28 = getelementptr inbounds i8, i8* %27, i64 1
br label %31
29: ; preds = %21
%30 = load i8*, i8** %6
br label %31
31: ; preds = %29, %25
%32 = phi i8* [ %28, %25 ], [ %30, %29 ]
br label %33
33: ; preds = %31, %17
%34 = phi i8* [ %20, %17 ], [ %32, %31 ]
%35 = load i64, i64* %7
%36 = load i8*, i8** %8
%37 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %34, i64 %35, i8* %36)
store i32 %37, i32* %9
br label %41
38: ; preds = %4
%39 = load i8*, i8** %8
%40 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %39)
store i32 %40, i32* %9
br label %41
41: ; preds = %38, %33
%42 = load i32, i32* @stdout
%43 = call i32 @fflush(i32 %42)
%44 = load i32, i32* %9
ret i32 %44
}

LLVM IR (-O2):
@.str = [16 x i8] c"%16s:%04ld %s\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@stdout = global i32 0
define i32 @std_out(i8* nocapture readnone %0, i8* %1, i64 %2, i8* %3) {
%5 = icmp eq i8* %1, null
br i1 %5, label %19, label %6
6: ; preds = %4
%7 = tail call i8* @strrchr(i8* %1, i8 signext 47)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %7, i64 1
br label %16
11: ; preds = %6
%12 = tail call i8* @strrchr(i8* %1, i8 signext 92)
%13 = icmp eq i8* %12, null
%14 = getelementptr inbounds i8, i8* %12, i64 1
%15 = select i1 %13, i8* %1, i8* %14
br label %16
16: ; preds = %11, %9
%17 = phi i8* [ %10, %9 ], [ %15, %11 ]
%18 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %17, i64 %2, i8* %3)
br label %21
19: ; preds = %4
%20 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %21
21: ; preds = %19, %16
%22 = phi i32 [ %18, %16 ], [ %20, %19 ]
%23 = load i32, i32* @stdout
%24 = tail call i32 @fflush(i32 %23)
ret i32 %22
}