#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*/ printf(char *, int, char *, ...);
char *trio_strerror(int);
void Dump(char *buffer, int rc) {
  if (rc < 0) {
    printf("Err = %d (%s), Pos = %d\n", ((-(rc)) & 0x00FF), trio_strerror(rc),
           ((-(rc)) >> 8));
  } else if (buffer)
    printf("buffer[% 3d] = \"%s\"\n", rc, buffer);
}


x86 assembly (clang, -O0):
<Dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    116f <Dump+0x4f>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <trio_strerror@plt>
mov    -0x10(%rbp),%esi
mov    %rax,%rdx
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
sar    $0x8,%ecx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1194 <Dump+0x74>
cmpq   $0x0,-0x8(%rbp)
je     118f <Dump+0x6f>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1194 <Dump+0x74>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Dump>:
test   %esi,%esi
js     113a <Dump+0x1a>
mov    %rdi,%rdx
test   %rdi,%rdi
je     1169 <Dump+0x49>
lea    0xee6(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
neg    %ebx
movzbl %bl,%ebp
mov    %esi,%edi
call   1040 <trio_strerror@plt>
shr    $0x8,%ebx
lea    0xeab(%rip),%rdi
mov    %ebp,%esi
mov    %rax,%rdx
mov    %ebx,%ecx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Err = %d (%s), Pos = %d\0A\00"
@.str.1 = [21 x i8] c"buffer[% 3d] = \22%s\22\0A\00"
define void @Dump(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = load i32, i32* %4
%9 = sub nsw i32 0, %8
%10 = and i32 %9, 255
%11 = load i32, i32* %4
%12 = call i8* @trio_strerror(i32 %11)
%13 = load i32, i32* %4
%14 = sub nsw i32 0, %13
%15 = ashr i32 %14, 8
%16 = call i32 (i8*, i32, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %12, i32 %15)
br label %25
17: ; preds = %2
%18 = load i8*, i8** %3
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* %4
%22 = load i8*, i8** %3
%23 = call i32 (i8*, i32, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %21, i8* %22)
br label %24
24: ; preds = %20, %17
br label %25
25: ; preds = %24, %7
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Err = %d (%s), Pos = %d\0A\00"
@.str.1 = [21 x i8] c"buffer[% 3d] = \22%s\22\0A\00"
define void @Dump(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = sub nsw i32 0, %1
%6 = and i32 %5, 255
%7 = tail call i8* @trio_strerror(i32 %1)
%8 = lshr i32 %5, 8
%9 = tail call i32 (i8*, i32, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %7, i32 %8)
br label %14
10: ; preds = %2
%11 = icmp eq i8* %0, null
br i1 %11, label %14, label %12
12: ; preds = %10
%13 = tail call i32 (i8*, i32, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %0)
br label %14
14: ; preds = %10, %12, %4
ret void
}