#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 gid_t;

/* Variables and functions */
int EXIT_SUCCESS;
int getuid();
int groupid_from_groupname(char *);
char *groupname_from_groupid(int);
int /*<<< orphan*/ printf(char *, ...);
int userid_from_username(char *);
char *username_from_userid(int);
int main(void) {
  uid_t uid = getuid();
  char *my_user_name = username_from_userid(uid);
  uid_t my_uid = userid_from_username(my_user_name);
  char *my_group_name = groupname_from_groupid(111);
  gid_t my_gid = groupid_from_groupname(my_group_name);
  printf("My user name is: %s\n", my_user_name);
  printf("My user ID is: %d\n", my_uid);
  printf("My group name is: %s\n", my_group_name);
  printf("My group ID is: %d\n", my_gid);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <getuid@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1080 <username_from_userid@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <userid_from_username@plt>
mov    %eax,-0x14(%rbp)
mov    $0x6f,%edi
call   1040 <groupname_from_groupid@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <groupid_from_groupname@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2de8(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <getuid@plt>
mov    %eax,%edi
call   1080 <username_from_userid@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <userid_from_username@plt>
mov    %eax,%r14d
mov    $0x6f,%edi
call   1040 <groupname_from_groupid@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1050 <groupid_from_groupname@plt>
mov    %eax,%r15d
lea    0xe5e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe62(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe64(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe69(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"My user name is: %s\0A\00"
@.str.1 = [19 x i8] c"My user ID is: %d\0A\00"
@.str.2 = [22 x i8] c"My group name is: %s\0A\00"
@.str.3 = [20 x i8] c"My group ID is: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (...) @getuid()
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i8* @username_from_userid(i32 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @userid_from_username(i8* %10)
store i32 %11, i32* %4
%12 = call i8* @groupname_from_groupid(i32 111)
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = call i32 @groupid_from_groupname(i8* %13)
store i32 %14, i32* %6
%15 = load i8*, i8** %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32, i32* %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = load i8*, i8** %5
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = load i32, i32* %6
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @EXIT_SUCCESS
ret i32 %23
}

LLVM IR (-O2):
@.str = [21 x i8] c"My user name is: %s\0A\00"
@.str.1 = [19 x i8] c"My user ID is: %d\0A\00"
@.str.2 = [22 x i8] c"My group name is: %s\0A\00"
@.str.3 = [20 x i8] c"My group ID is: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getuid()
%2 = tail call i8* @username_from_userid(i32 %1)
%3 = tail call i32 @userid_from_username(i8* %2)
%4 = tail call i8* @groupname_from_groupid(i32 111)
%5 = tail call i32 @groupid_from_groupname(i8* %4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %5)
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}