#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 */
scalar_t__ getegid();
scalar_t__ geteuid();
scalar_t__ getgid();
scalar_t__ getpgrp();
scalar_t__ getpid();
scalar_t__ getppid();
scalar_t__ getuid();
int /*<<< orphan*/ printf(char *, ...);
void print_process_info(const char *process_label) {
  printf("%s identification: \n", process_label);
  printf("pid = %d,ppid = %d,pgrp = %d\n", (int)getpid(), (int)getppid(),
         (int)getpgrp());
  printf("uid = %d,gid = %d\n", (int)getuid(), (int)getgid());
  printf("euid = %d,egid = %d\n", (int)geteuid(), (int)getegid());
}


x86 assembly (clang, -O0):
<print_process_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1090 <getpgrp@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    %eax,%ecx
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <getuid@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1070 <getgid@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <geteuid@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1080 <getegid@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_process_info>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rsi
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %rax,%r14
xor    %eax,%eax
call   10a0 <getppid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1090 <getpgrp@plt>
lea    0xe5e(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <getuid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1070 <getgid@plt>
lea    0xe56(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <geteuid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1080 <getegid@plt>
lea    0xe46(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"%s identification: \0A\00"
@.str.1 = [30 x i8] c"pid = %d,ppid = %d,pgrp = %d\0A\00"
@.str.2 = [19 x i8] c"uid = %d,gid = %d\0A\00"
@.str.3 = [21 x i8] c"euid = %d,egid = %d\0A\00"
define void @print_process_info(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i64 (...) @getpid()
%6 = trunc i64 %5 to i32
%7 = call i64 (...) @getppid()
%8 = trunc i64 %7 to i32
%9 = call i64 (...) @getpgrp()
%10 = trunc i64 %9 to i32
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %8, i32 %10)
%12 = call i64 (...) @getuid()
%13 = trunc i64 %12 to i32
%14 = call i64 (...) @getgid()
%15 = trunc i64 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %15)
%17 = call i64 (...) @geteuid()
%18 = trunc i64 %17 to i32
%19 = call i64 (...) @getegid()
%20 = trunc i64 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %18, i32 %20)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"%s identification: \0A\00"
@.str.1 = [30 x i8] c"pid = %d,ppid = %d,pgrp = %d\0A\00"
@.str.2 = [19 x i8] c"uid = %d,gid = %d\0A\00"
@.str.3 = [21 x i8] c"euid = %d,egid = %d\0A\00"
define void @print_process_info(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i64 (...) @getpid()
%4 = trunc i64 %3 to i32
%5 = tail call i64 (...) @getppid()
%6 = trunc i64 %5 to i32
%7 = tail call i64 (...) @getpgrp()
%8 = trunc i64 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %6, i32 %8)
%10 = tail call i64 (...) @getuid()
%11 = trunc i64 %10 to i32
%12 = tail call i64 (...) @getgid()
%13 = trunc i64 %12 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %13)
%15 = tail call i64 (...) @geteuid()
%16 = trunc i64 %15 to i32
%17 = tail call i64 (...) @getegid()
%18 = trunc i64 %17 to i32
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %16, i32 %18)
ret void
}