#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 */
typedef int uint64_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
#define AT_BASE_PLATFORM 131
#define AT_EXECFN 130
#define AT_PLATFORM 129
#define AT_RANDOM 128
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ read_mem_rand(char **, size_t *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ read_mem_str(char **, size_t *, int /*<<< orphan*/ *, int);
int pp_aux_ref(uint64_t key, uint64_t val, char **line, size_t *n, FILE *m,
               FILE *o) {
  switch (key) {
  case AT_BASE_PLATFORM:
  case AT_EXECFN:
  case AT_PLATFORM:
    if (read_mem_str(line, n, m, val))
      return -1;
    fprintf(o, " %s", *line);
    break;
  case AT_RANDOM:
    if (read_mem_rand(line, n, m, val))
      return -1;
    fprintf(o, " %s", *line);
  default:
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<pp_aux_ref>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x80,%eax
je     11bf <pp_aux_ref+0x8f>
jmp    1164 <pp_aux_ref+0x34>
mov    -0x34(%rbp),%eax
add    $0xffffff7f,%eax
sub    $0x2,%eax
ja     11ff <pp_aux_ref+0xcf>
jmp    117a <pp_aux_ref+0x4a>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0xc(%rbp),%ecx
call   1030 <read_mem_str@plt>
cmp    $0x0,%eax
je     11a3 <pp_aux_ref+0x73>
movl   $0xffffffff,-0x4(%rbp)
jmp    120b <pp_aux_ref+0xdb>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xe4b(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1204 <pp_aux_ref+0xd4>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0xc(%rbp),%ecx
call   1050 <read_mem_rand@plt>
cmp    $0x0,%eax
je     11e8 <pp_aux_ref+0xb8>
movl   $0xffffffff,-0x4(%rbp)
jmp    120b <pp_aux_ref+0xdb>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xe06(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1204 <pp_aux_ref+0xd4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pp_aux_ref>:
push   %r15
push   %r14
push   %rbx
mov    %r9,%r14
mov    %rdx,%r15
mov    %esi,%ebx
xor    %eax,%eax
lea    -0x81(%rdi),%edx
cmp    $0x3,%edx
jae    115c <pp_aux_ref+0x2c>
mov    %r15,%rdi
mov    %rcx,%rsi
mov    %r8,%rdx
mov    %ebx,%ecx
call   1030 <read_mem_str@plt>
jmp    1174 <pp_aux_ref+0x44>
cmp    $0x80,%edi
jne    1193 <pp_aux_ref+0x63>
mov    %r15,%rdi
mov    %rcx,%rsi
mov    %r8,%rdx
mov    %ebx,%ecx
call   1050 <read_mem_rand@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   %ecx,%ecx
jne    1193 <pp_aux_ref+0x63>
mov    (%r15),%rdx
lea    0xe77(%rip),%rsi
mov    %r14,%rdi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %s\00"
define i32 @pp_aux_ref(i32 %0, i32 %1, i8** %2, i64* %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8**
%11 = alloca i64*
%12 = alloca i32*
%13 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i8** %2, i8*** %10
store i64* %3, i64** %11
store i32* %4, i32** %12
store i32* %5, i32** %13
%14 = load i32, i32* %8
switch i32 %14, label %41 [
i32 131, label %15
i32 130, label %15
i32 129, label %15
i32 128, label %28
]
15: ; preds = %6, %6, %6
%16 = load i8**, i8*** %10
%17 = load i64*, i64** %11
%18 = load i32*, i32** %12
%19 = load i32, i32* %9
%20 = call i32 @read_mem_str(i8** %16, i64* %17, i32* %18, i32 %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %15
store i32 -1, i32* %7
br label %43
23: ; preds = %15
%24 = load i32*, i32** %13
%25 = load i8**, i8*** %10
%26 = load i8*, i8** %25
%27 = call i32 @fprintf(i32* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %26)
br label %42
28: ; preds = %6
%29 = load i8**, i8*** %10
%30 = load i64*, i64** %11
%31 = load i32*, i32** %12
%32 = load i32, i32* %9
%33 = call i32 @read_mem_rand(i8** %29, i64* %30, i32* %31, i32 %32)
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %28
store i32 -1, i32* %7
br label %43
36: ; preds = %28
%37 = load i32*, i32** %13
%38 = load i8**, i8*** %10
%39 = load i8*, i8** %38
%40 = call i32 @fprintf(i32* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %39)
br label %41
41: ; preds = %6, %36
br label %42
42: ; preds = %41, %23
store i32 0, i32* %7
br label %43
43: ; preds = %42, %35, %22
%44 = load i32, i32* %7
ret i32 %44
}

LLVM IR (-O2):
@.str = [4 x i8] c" %s\00"
define i32 @pp_aux_ref(i32 %0, i32 %1, i8** %2, i64* %3, i32* %4, i32* nocapture %5) {
switch i32 %0, label %16 [
i32 131, label %7
i32 130, label %7
i32 129, label %7
i32 128, label %10
]
7: ; preds = %6, %6, %6
%8 = tail call i32 @read_mem_str(i8** %2, i64* %3, i32* %4, i32 %1)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %16
10: ; preds = %6
%11 = tail call i32 @read_mem_rand(i8** %2, i64* %3, i32* %4, i32 %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10, %7
%14 = load i8*, i8** %2
%15 = tail call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %13, %6, %10, %7
%17 = phi i32 [ -1, %7 ], [ -1, %10 ], [ 0, %6 ], [ 0, %13 ]
ret i32 %17
}