#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*/ STDERR_FILENO;
int /*<<< orphan*/ errno;
int my_strlen(char const *);
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ xwrite(int /*<<< orphan*/, char const *, int);
void print_errno_double_msg(const char *msg, const char *msg2) {
  char *err;
  xwrite(STDERR_FILENO, "minishell: ", 11);
  xwrite(STDERR_FILENO, msg, my_strlen(msg));
  xwrite(STDERR_FILENO, ": ", 2);
  xwrite(STDERR_FILENO, msg2, my_strlen(msg2));
  xwrite(STDERR_FILENO, ": ", 2);
  err = strerror(errno);
  xwrite(STDERR_FILENO, err, my_strlen(err));
  xwrite(STDERR_FILENO, "\n", 1);
}


x86 assembly (clang, -O0):
<print_errno_double_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    $0xb,%edx
call   1040 <xwrite@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <my_strlen@plt>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
call   1040 <xwrite@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
mov    $0x2,%edx
call   1040 <xwrite@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <my_strlen@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
call   1040 <xwrite@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
lea    0xe2f(%rip),%rsi
mov    $0x2,%edx
call   1040 <xwrite@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,-0x18(%rbp)
mov    0x2ddb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <my_strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1040 <xwrite@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xddb(%rip),%rsi
mov    $0x1,%edx
call   1040 <xwrite@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_errno_double_msg>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e94(%rip),%r15
mov    (%r15),%edi
lea    0xeb2(%rip),%rsi
mov    $0xb,%edx
call   1040 <xwrite@plt>
mov    (%r15),%ebp
mov    %rbx,%rdi
call   1030 <my_strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <xwrite@plt>
mov    (%r15),%edi
lea    0xe90(%rip),%rbx
mov    %rbx,%rsi
mov    $0x2,%edx
call   1040 <xwrite@plt>
mov    (%r15),%ebp
mov    %r14,%rdi
call   1030 <my_strlen@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <xwrite@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1040 <xwrite@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,%rbx
mov    (%r15),%ebp
mov    %rax,%rdi
call   1030 <my_strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <xwrite@plt>
mov    (%r15),%edi
lea    0xe2d(%rip),%rsi
mov    $0x1,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <xwrite@plt>

LLVM IR (-O0):
@STDERR_FILENO = global i32 0
@.str = [12 x i8] c"minishell: \00"
@.str.1 = [3 x i8] c": \00"
@errno = global i32 0
@.str.2 = [2 x i8] c"\0A\00"
define void @print_errno_double_msg(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i32, i32* @STDERR_FILENO
%7 = call i32 @xwrite(i32 %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 11)
%8 = load i32, i32* @STDERR_FILENO
%9 = load i8*, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @my_strlen(i8* %10)
%12 = call i32 @xwrite(i32 %8, i8* %9, i32 %11)
%13 = load i32, i32* @STDERR_FILENO
%14 = call i32 @xwrite(i32 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%15 = load i32, i32* @STDERR_FILENO
%16 = load i8*, i8** %4
%17 = load i8*, i8** %4
%18 = call i32 @my_strlen(i8* %17)
%19 = call i32 @xwrite(i32 %15, i8* %16, i32 %18)
%20 = load i32, i32* @STDERR_FILENO
%21 = call i32 @xwrite(i32 %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%22 = load i32, i32* @errno
%23 = call i8* @strerror(i32 %22)
store i8* %23, i8** %5
%24 = load i32, i32* @STDERR_FILENO
%25 = load i8*, i8** %5
%26 = load i8*, i8** %5
%27 = call i32 @my_strlen(i8* %26)
%28 = call i32 @xwrite(i32 %24, i8* %25, i32 %27)
%29 = load i32, i32* @STDERR_FILENO
%30 = call i32 @xwrite(i32 %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@STDERR_FILENO = global i32 0
@.str = [12 x i8] c"minishell: \00"
@.str.1 = [3 x i8] c": \00"
@errno = global i32 0
@.str.2 = [2 x i8] c"\0A\00"
define void @print_errno_double_msg(i8* %0, i8* %1) {
%3 = load i32, i32* @STDERR_FILENO
%4 = tail call i32 @xwrite(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 11)
%5 = load i32, i32* @STDERR_FILENO
%6 = tail call i32 @my_strlen(i8* %0)
%7 = tail call i32 @xwrite(i32 %5, i8* %0, i32 %6)
%8 = load i32, i32* @STDERR_FILENO
%9 = tail call i32 @xwrite(i32 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%10 = load i32, i32* @STDERR_FILENO
%11 = tail call i32 @my_strlen(i8* %1)
%12 = tail call i32 @xwrite(i32 %10, i8* %1, i32 %11)
%13 = load i32, i32* @STDERR_FILENO
%14 = tail call i32 @xwrite(i32 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%15 = load i32, i32* @errno
%16 = tail call i8* @strerror(i32 %15)
%17 = load i32, i32* @STDERR_FILENO
%18 = tail call i32 @my_strlen(i8* %16)
%19 = tail call i32 @xwrite(i32 %17, i8* %16, i32 %18)
%20 = load i32, i32* @STDERR_FILENO
%21 = tail call i32 @xwrite(i32 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
ret void
}