#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 uid_t;
typedef int pid_t;
typedef int gid_t;

/* Variables and functions */
int getegid();
int geteuid();
int getgid();
int getpid();
int getppid();
int getuid();
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int);
int main(int argc, char *argv[]) {
  pid_t pid = getpid();
  pid_t ppid = getppid();
  uid_t uid = getuid();
  uid_t euid = geteuid();
  gid_t gid = getgid();
  gid_t egid = getegid();
  printf(
      "pid = %ul, ppid = %ul, uid = %ul, euid = %ul, gid = %ul, egid = %ul\n",
      pid, ppid, uid, euid, gid, egid);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1090 <getppid@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getuid@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1060 <geteuid@plt>
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1070 <getgid@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1080 <getegid@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x28(%rbp),%eax
lea    0xe23(%rip),%rdi
mov    %eax,(%rsp)
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1040 <getuid@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1060 <geteuid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1070 <getgid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1080 <getegid@plt>
mov    %eax,(%rsp)
lea    0xe43(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %r12d,%ecx
mov    %ebp,%r8d
mov    %ebx,%r9d
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [69 x i8] c"pid = %ul, ppid = %ul, uid = %ul, euid = %ul, gid = %ul, egid = %ul\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getpid()
%4 = tail call i32 (...) @getppid()
%5 = tail call i32 (...) @getuid()
%6 = tail call i32 (...) @geteuid()
%7 = tail call i32 (...) @getgid()
%8 = tail call i32 (...) @getegid()
%9 = tail call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8)
ret i32 0
}