#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 */
char *decode_cc(unsigned short, unsigned char);
int /*<<< orphan*/ printf(char *, char *, int, unsigned char, char *);
void show_error(char *tag, int rv, unsigned char cc) {
  if (rv > 0 && cc == 0)
    cc = (unsigned char)rv;
  printf("%s: error %d ccode = %x %s\n", tag, rv, cc,
         decode_cc((unsigned short)0, cc));
  return;
}


x86 assembly (clang, -O0):
<show_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1151 <show_error+0x31>
movzbl -0xd(%rbp),%eax
cmp    $0x0,%eax
jne    1151 <show_error+0x31>
mov    -0xc(%rbp),%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xd(%rbp),%al
mov    %al,-0xe(%rbp)
xor    %edi,%edi
movzbl -0xd(%rbp),%esi
call   1040 <decode_cc@plt>
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    %rax,%r8
mov    -0xe(%rbp),%al
lea    0xe7c(%rip),%rdi
movzbl %al,%ecx
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_error>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
test   %edx,%edx
mov    %edx,%eax
cmove  %esi,%eax
test   %esi,%esi
cmovle %edx,%eax
movzbl %al,%ebp
xor    %edi,%edi
mov    %ebp,%esi
call   1040 <decode_cc@plt>
lea    0xeb8(%rip),%rdi
mov    %r14,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %rax,%r8
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"%s: error %d ccode = %x %s\0A\00"
define void @show_error(i8* %0, i32 %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%7 = load i32, i32* %5
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %3
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %5
%15 = trunc i32 %14 to i8
store i8 %15, i8* %6
br label %16
16: ; preds = %13, %9, %3
%17 = load i8*, i8** %4
%18 = load i32, i32* %5
%19 = load i8, i8* %6
%20 = load i8, i8* %6
%21 = call i8* @decode_cc(i16 zeroext 0, i8 zeroext %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %17, i32 %18, i8 zeroext %19, i8* %21)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"%s: error %d ccode = %x %s\0A\00"
define void @show_error(i8* %0, i32 %1, i8 zeroext %2) {
%4 = icmp sgt i32 %1, 0
%5 = icmp eq i8 %2, 0
%6 = and i1 %4, %5
%7 = trunc i32 %1 to i8
%8 = select i1 %6, i8 %7, i8 %2
%9 = tail call i8* @decode_cc(i16 zeroext 0, i8 zeroext %8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8 zeroext %8, i8* %9)
ret void
}