#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 geteuid();
int getpid();
int getppid();
int getuid();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("我的id: %d\n", getuid());
  printf("我的有效id: %d\n", geteuid());
  printf("我的进程id: %d\n", getpid());
  printf("我的父进程id: %d\n", getppid());
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <getuid@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <geteuid@plt>
mov    %eax,%esi
lea    0xe95(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xe94(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <getppid@plt>
mov    %eax,%esi
lea    0xe93(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getuid@plt>
lea    0xea1(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <geteuid@plt>
lea    0xe9a(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xe99(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <getppid@plt>
lea    0xe98(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\E6\88\91\E7\9A\84id: %d\0A\00"
@.str.1 = [20 x i8] c"\E6\88\91\E7\9A\84\E6\9C\89\E6\95\88id: %d\0A\00"
@.str.2 = [20 x i8] c"\E6\88\91\E7\9A\84\E8\BF\9B\E7\A8\8Bid: %d\0A\00"
@.str.3 = [23 x i8] c"\E6\88\91\E7\9A\84\E7\88\B6\E8\BF\9B\E7\A8\8Bid: %d\0A\00"
define i32 @main() {
%1 = call i32 (...) @getuid()
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 (...) @geteuid()
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @getpid()
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @getppid()
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"\E6\88\91\E7\9A\84id: %d\0A\00"
@.str.1 = [20 x i8] c"\E6\88\91\E7\9A\84\E6\9C\89\E6\95\88id: %d\0A\00"
@.str.2 = [20 x i8] c"\E6\88\91\E7\9A\84\E8\BF\9B\E7\A8\8Bid: %d\0A\00"
@.str.3 = [23 x i8] c"\E6\88\91\E7\9A\84\E7\88\B6\E8\BF\9B\E7\A8\8Bid: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getuid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @geteuid()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @getpid()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 (...) @getppid()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %7)
ret i32 0
}