#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 *, ...);
int getpid();
int /*<<< orphan*/ stderr;
int render_dump(char *str1, int ip, int it, char *str2, int *p_lock, void *ptr,
                int num) {
  fprintf(stderr, "%s: pid=%d   %d %d   %s   ", str1, getpid(), ip, it, str2);
  if (p_lock != 0)
    fprintf(stderr, "lock = %d %p   ", *p_lock, p_lock);
  if (ptr != 0)
    fprintf(stderr, "%p %d", ptr, num);
  fprintf(stderr, "\n");
  return 1;
}


x86 assembly (clang, -O0):
<render_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rdx
mov    %eax,%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    -0x18(%rbp),%rax
lea    0xe88(%rip),%rsi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x0,-0x20(%rbp)
je     11af <render_dump+0x8f>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
mov    -0x20(%rbp),%rcx
lea    0xe73(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x0,-0x28(%rbp)
je     11d8 <render_dump+0xb8>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    0x10(%rbp),%ecx
lea    0xe5a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render_dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,%rbx
mov    %rcx,%r15
mov    %edx,%r12d
mov    %esi,%r13d
mov    %rdi,%rbp
mov    0x2e97(%rip),%rax
mov    (%rax),%r14d
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %r15,(%rsp)
lea    0xea2(%rip),%rsi
mov    %r14d,%edi
mov    0x2e78(%rip),%r14
mov    %rbp,%rdx
mov    %eax,%ecx
mov    %r13d,%r8d
mov    %r12d,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %rbx,%rbx
je     1195 <render_dump+0x75>
mov    (%r14),%edi
mov    (%rbx),%edx
lea    0xe90(%rip),%rsi
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x10(%rsp),%rdx
test   %rdx,%rdx
je     11b4 <render_dump+0x94>
mov    0x50(%rsp),%ecx
mov    (%r14),%edi
lea    0xe7e(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xe73(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"%s: pid=%d %d %d %s \00"
@.str.1 = [16 x i8] c"lock = %d %p \00"
@.str.2 = [6 x i8] c"%p %d\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @render_dump(i8* %0, i32 %1, i32 %2, i8* %3, i32* %4, i8* %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca i8*
%14 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i8* %3, i8** %11
store i32* %4, i32** %12
store i8* %5, i8** %13
store i32 %6, i32* %14
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %8
%17 = call i32 (...) @getpid()
%18 = load i32, i32* %9
%19 = load i32, i32* %10
%20 = load i8*, i8** %11
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %16, i32 %17, i32 %18, i32 %19, i8* %20)
%22 = load i32*, i32** %12
%23 = icmp ne i32* %22, null
br i1 %23, label %24, label %30
24: ; preds = %7
%25 = load i32, i32* @stderr
%26 = load i32*, i32** %12
%27 = load i32, i32* %26
%28 = load i32*, i32** %12
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32* %28)
br label %30
30: ; preds = %24, %7
%31 = load i8*, i8** %13
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i32, i32* @stderr
%35 = load i8*, i8** %13
%36 = load i32, i32* %14
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %35, i32 %36)
br label %38
38: ; preds = %33, %30
%39 = load i32, i32* @stderr
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"%s: pid=%d %d %d %s \00"
@.str.1 = [16 x i8] c"lock = %d %p \00"
@.str.2 = [6 x i8] c"%p %d\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @render_dump(i8* %0, i32 %1, i32 %2, i8* %3, i32* %4, i8* %5, i32 %6) {
%8 = load i32, i32* @stderr
%9 = tail call i32 (...) @getpid()
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %9, i32 %1, i32 %2, i8* %3)
%11 = icmp eq i32* %4, null
br i1 %11, label %16, label %12
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = load i32, i32* %4
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32* %4)
br label %16
16: ; preds = %12, %7
%17 = icmp eq i8* %5, null
br i1 %17, label %21, label %18
18: ; preds = %16
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %5, i32 %6)
br label %21
21: ; preds = %18, %16
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 1
}