#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 /*<<< orphan*/ const pid_t;

/* Variables and functions */
int /*<<< orphan*/ logger(int /*<<< orphan*/ *, int, char *, int, char *,
                          int /*<<< orphan*/ const, char *,
                          int /*<<< orphan*/ const, char *, char const *);
scalar_t__ read_proc_info(int /*<<< orphan*/ const, int /*<<< orphan*/ const *,
                          char *, int);
void report_proc(const pid_t pid, const char *dev_name) {
  char name[1024], name2[1024];
  pid_t ppid, ppid2;
  if (read_proc_info(pid, &ppid, name, 1024) &&
      read_proc_info(ppid, &ppid2, name2, 1024))
    logger(
        NULL, -1,
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/SteamMOD/android_bootable_steam_cryptsetup/"
        "refs/heads/master/lib/utils_debug.c",
        93,
        "WARNING: Process PID %u %s [PPID %u %s] spying on internal device %s.",
        pid, name, ppid, name2, dev_name);
}


x86 assembly (clang, -O0):
<report_proc>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x848,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x420(%rbp),%rdx
lea    -0x824(%rbp),%rsi
mov    $0x400,%ecx
call   1040 <read_proc_info@plt>
cmp    $0x0,%rax
je     11d1 <report_proc+0xb1>
mov    -0x824(%rbp),%edi
lea    -0x820(%rbp),%rdx
lea    -0x828(%rbp),%rsi
mov    $0x400,%ecx
call   1040 <read_proc_info@plt>
cmp    $0x0,%rax
je     11d1 <report_proc+0xb1>
mov    -0xc(%rbp),%r9d
lea    -0x420(%rbp),%rbx
mov    -0x824(%rbp),%r11d
lea    -0x820(%rbp),%r10
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edi
mov    $0xffffffff,%esi
lea    0xe53(%rip),%rdx
mov    $0x5d,%ecx
lea    0xef0(%rip),%r8
mov    %rbx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <logger@plt>
add    $0x848,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<report_proc>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x818,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x8(%rsp),%rsi
lea    0x410(%rsp),%r14
mov    %r14,%rdx
mov    $0x400,%ecx
call   1040 <read_proc_info@plt>
test   %rax,%rax
je     11a1 <report_proc+0x81>
mov    0x8(%rsp),%edi
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%r15
mov    %r15,%rdx
mov    $0x400,%ecx
call   1040 <read_proc_info@plt>
test   %rax,%rax
je     11a1 <report_proc+0x81>
mov    0x8(%rsp),%eax
lea    0xe84(%rip),%rdx
lea    0xf26(%rip),%r8
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0x5d,%ecx
mov    %ebp,%r9d
push   %rbx
push   %r15
push   %rax
push   %r14
call   1030 <logger@plt>
add    $0x20,%rsp
add    $0x818,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/SteamMOD/android_bootable_steam_cryptsetup/refs/heads/master/lib/utils_debug.c\00"
@.str.1 = [70 x i8] c"WARNING: Process PID %u %s [PPID %u %s] spying on internal device %s.\00"
define void @report_proc(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%9 = load i32, i32* %3
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%11 = call i64 @read_proc_info(i32 %9, i32* %7, i8* %10, i32 1024)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %25
13: ; preds = %2
%14 = load i32, i32* %7
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%16 = call i64 @read_proc_info(i32 %14, i32* %8, i8* %15, i32 1024)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %13
%19 = load i32, i32* %3
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%21 = load i32, i32* %7
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%23 = load i8*, i8** %4
%24 = call i32 @logger(i32* null, i32 -1, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 93, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0), i32 %19, i8* %20, i32 %21, i8* %22, i8* %23)
br label %25
25: ; preds = %18, %13, %2
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/SteamMOD/android_bootable_steam_cryptsetup/refs/heads/master/lib/utils_debug.c\00"
@.str.1 = [70 x i8] c"WARNING: Process PID %u %s [PPID %u %s] spying on internal device %s.\00"
define void @report_proc(i32 %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = call i64 @read_proc_info(i32 %0, i32* %5, i8* %7, i32 1024)
%12 = icmp eq i64 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %2
%14 = load i32, i32* %5
%15 = call i64 @read_proc_info(i32 %14, i32* %6, i8* %8, i32 1024)
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %13
%18 = load i32, i32* %5
%19 = call i32 @logger(i32* null, i32 -1, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 93, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0), i32 %0, i8* %7, i32 %18, i8* %8, i8* %1)
br label %20
20: ; preds = %17, %13, %2
ret void
}