#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*/ fflush(int /*<<< orphan*/);
int getpgrp();
int getpid();
int getppid();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
int testTerm();
void prIds(char *name) {
  printf("%s: ", name);
  printf("ppid = %d, pid = %d, grpid = %d, has term = %d\n", getppid(),
         getpid(), getpgrp(), testTerm());
  fflush(stdout);
}


x86 assembly (clang, -O0):
<prIds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1070 <getpgrp@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1060 <testTerm@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    %eax,%r8d
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prIds>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rsi
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <getppid@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1070 <getpgrp@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <testTerm@plt>
lea    0xe66(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s: \00"
@.str.1 = [48 x i8] c"ppid = %d, pid = %d, grpid = %d, has term = %d\0A\00"
@stdout = global i32 0
define void @prIds(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (...) @getppid()
%6 = call i32 (...) @getpid()
%7 = call i32 (...) @getpgrp()
%8 = call i32 (...) @testTerm()
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %6, i32 %7, i32 %8)
%10 = load i32, i32* @stdout
%11 = call i32 @fflush(i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
@.str.1 = [48 x i8] c"ppid = %d, pid = %d, grpid = %d, has term = %d\0A\00"
@stdout = global i32 0
define void @prIds(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @getppid()
%4 = tail call i32 (...) @getpid()
%5 = tail call i32 (...) @getpgrp()
%6 = tail call i32 (...) @testTerm()
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %3, i32 %4, i32 %5, i32 %6)
%8 = load i32, i32* @stdout
%9 = tail call i32 @fflush(i32 %8)
ret void
}