#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
    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    1184 <Dump+0x64>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Dump>:
test   %esi,%esi
js     1135 <Dump+0x15>
mov    %rdi,%rdx
lea    0xeeb(%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    0xeb0(%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>

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 %21
17: ; preds = %2
%18 = load i32, i32* %4
%19 = load i8*, i8** %3
%20 = call i32 (i8*, i32, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %18, i8* %19)
br label %21
21: ; preds = %17, %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 %12
10: ; preds = %2
%11 = 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 %12
12: ; preds = %10, %4
ret void
}