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

/* Variables and functions */
int /*<<< orphan*/ STDERR_FILENO;
char const *_getprogname();
int /*<<< orphan*/ _write(int /*<<< orphan*/, char const *, int);
int strlen(char const *);
void __env_warnx(const char *msg, const char *name, size_t nameLen) {
  static const char nl[] = "\n";
  static const char progSep[] = ": ";
  _write(STDERR_FILENO, _getprogname(), strlen(_getprogname()));
  _write(STDERR_FILENO, progSep, sizeof(progSep) - 1);
  _write(STDERR_FILENO, msg, strlen(msg));
  _write(STDERR_FILENO, name, nameLen);
  _write(STDERR_FILENO, nl, sizeof(nl) - 1);
  return;
}


x86 assembly (clang, -O0):
<__env_warnx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    $0x0,%al
call   1030 <_getprogname@plt>
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1030 <_getprogname@plt>
mov    %rax,%rdi
call   1040 <strlen@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
call   1050 <_write@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
mov    $0x2,%edx
call   1050 <_write@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1050 <_write@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    %eax,%edx
call   1050 <_write@plt>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
lea    0xe1b(%rip),%rsi
mov    $0x1,%edx
call   1050 <_write@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__env_warnx>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    0x2e95(%rip),%r13
mov    0x0(%r13),%ebp
xor    %eax,%eax
call   1030 <_getprogname@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <_getprogname@plt>
mov    %rax,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <_write@plt>
mov    0x0(%r13),%edi
lea    0xe83(%rip),%rsi
mov    $0x2,%edx
call   1050 <_write@plt>
mov    0x0(%r13),%ebx
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    %eax,%edx
call   1050 <_write@plt>
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    %r14d,%edx
call   1050 <_write@plt>
mov    0x0(%r13),%edi
lea    0xe45(%rip),%rsi
mov    $0x1,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <_write@plt>

LLVM IR (-O0):
@__env_warnx.nl = internal constant [2 x i8] c"\0A\00"
@__env_warnx.progSep = internal constant [3 x i8] c": \00"
@STDERR_FILENO = global i32 0
define void @__env_warnx(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* @STDERR_FILENO
%8 = call i8* (...) @_getprogname()
%9 = call i8* (...) @_getprogname()
%10 = call i32 @strlen(i8* %9)
%11 = call i32 @_write(i32 %7, i8* %8, i32 %10)
%12 = load i32, i32* @STDERR_FILENO
%13 = call i32 @_write(i32 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__env_warnx.progSep, i64 0, i64 0), i32 2)
%14 = load i32, i32* @STDERR_FILENO
%15 = load i8*, i8** %4
%16 = load i8*, i8** %4
%17 = call i32 @strlen(i8* %16)
%18 = call i32 @_write(i32 %14, i8* %15, i32 %17)
%19 = load i32, i32* @STDERR_FILENO
%20 = load i8*, i8** %5
%21 = load i64, i64* %6
%22 = trunc i64 %21 to i32
%23 = call i32 @_write(i32 %19, i8* %20, i32 %22)
%24 = load i32, i32* @STDERR_FILENO
%25 = call i32 @_write(i32 %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @__env_warnx.nl, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@__env_warnx.nl = internal constant [2 x i8] c"\0A\00"
@__env_warnx.progSep = internal constant [3 x i8] c": \00"
@STDERR_FILENO = global i32 0
define void @__env_warnx(i8* %0, i8* %1, i64 %2) {
%4 = load i32, i32* @STDERR_FILENO
%5 = tail call i8* (...) @_getprogname()
%6 = tail call i8* (...) @_getprogname()
%7 = tail call i32 @strlen(i8* %6)
%8 = tail call i32 @_write(i32 %4, i8* %5, i32 %7)
%9 = load i32, i32* @STDERR_FILENO
%10 = tail call i32 @_write(i32 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__env_warnx.progSep, i64 0, i64 0), i32 2)
%11 = load i32, i32* @STDERR_FILENO
%12 = tail call i32 @strlen(i8* %0)
%13 = tail call i32 @_write(i32 %11, i8* %0, i32 %12)
%14 = load i32, i32* @STDERR_FILENO
%15 = trunc i64 %2 to i32
%16 = tail call i32 @_write(i32 %14, i8* %1, i32 %15)
%17 = load i32, i32* @STDERR_FILENO
%18 = tail call i32 @_write(i32 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @__env_warnx.nl, i64 0, i64 0), i32 1)
ret void
}