#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*/ fprintf(int /*<<< orphan*/, char *, void *, int, char *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ ring_back(void *);
scalar_t__ ring_empty(void *);
int /*<<< orphan*/ ring_front(void *);
int ring_size(void *);
int /*<<< orphan*/ stdout;
void ring_object_show(void *R) {
  fprintf(stdout,
          "\t__ring__ -> {\n"
          "\t  object=>0x%p,\n"
          "\t  size=>%d,\n"
          "\t  empty=>'%s',\n"
          "\t  front=>0x%p,\n"
          "\t  back=>0x%p,\n"
          "\t}\n",
          R, ring_size(R), (ring_empty(R) ? "yes" : "no"), ring_front(R),
          ring_back(R));
}


x86 assembly (clang, -O0):
<ring_object_show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <ring_size@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <ring_empty@plt>
mov    %rax,%rdx
lea    0xed5(%rip),%rax
lea    0xeca(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ring_front@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ring_back@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0xc(%rbp),%r9d
lea    0xe30(%rip),%rsi
mov    %eax,(%rsp)
call   1050 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ring_object_show>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    0x2e7a(%rip),%rax
mov    (%rax),%r14d
call   1070 <ring_size@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1060 <ring_empty@plt>
test   %rax,%rax
lea    0xee1(%rip),%rax
lea    0xed6(%rip),%rbp
cmove  %rax,%rbp
mov    %rbx,%rdi
call   1030 <ring_front@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   1040 <ring_back@plt>
mov    %eax,(%rsp)
lea    0xe55(%rip),%rsi
mov    %r14d,%edi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    %rbp,%r8
mov    %r12d,%r9d
call   1050 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [96 x i8] c"\09__ring__ -> {\0A\09 object=>0x%p,\0A\09 size=>%d,\0A\09 empty=>'%s',\0A\09 front=>0x%p,\0A\09 back=>0x%p,\0A\09}\0A\00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [3 x i8] c"no\00"
define void @ring_object_show(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @ring_size(i8* %5)
%7 = load i8*, i8** %2
%8 = call i64 @ring_empty(i8* %7)
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%12 = load i8*, i8** %2
%13 = call i32 @ring_front(i8* %12)
%14 = load i8*, i8** %2
%15 = call i32 @ring_back(i8* %14)
%16 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %6, i8* %11, i32 %13, i32 %15)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [96 x i8] c"\09__ring__ -> {\0A\09 object=>0x%p,\0A\09 size=>%d,\0A\09 empty=>'%s',\0A\09 front=>0x%p,\0A\09 back=>0x%p,\0A\09}\0A\00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [3 x i8] c"no\00"
define void @ring_object_show(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @ring_size(i8* %0)
%4 = tail call i64 @ring_empty(i8* %0)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%7 = tail call i32 @ring_front(i8* %0)
%8 = tail call i32 @ring_back(i8* %0)
%9 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %3, i8* %6, i32 %7, i32 %8)
ret void
}