#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 void *uid_t;
typedef void *gid_t;

/* Variables and functions */
void *atoi(char *);
char *getenv(char *);
void fake_peer_uid_gid(uid_t *uid, gid_t *gid) {
  char *val;
  val = getenv("SSSD_INTG_PEER_UID");
  if (val != NULL) {
    *uid = atoi(val);
  }
  val = getenv("SSSD_INTG_PEER_GID");
  if (val != NULL) {
    *gid = atoi(val);
  }
}


x86 assembly (clang, -O0):
<fake_peer_uid_gid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115e <fake_peer_uid_gid+0x3e>
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
lea    0xeae(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118c <fake_peer_uid_gid+0x6c>
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fake_peer_uid_gid>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1146 <fake_peer_uid_gid+0x26>
mov    %rax,%rdi
call   1040 <atoi@plt>
mov    %rax,(%rbx)
lea    0xec6(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1162 <fake_peer_uid_gid+0x42>
mov    %rax,%rdi
call   1040 <atoi@plt>
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"SSSD_INTG_PEER_UID\00"
@.str.1 = [19 x i8] c"SSSD_INTG_PEER_GID\00"
define void @fake_peer_uid_gid(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i8*
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%6 = call i8* @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i8*, i8** %5
%11 = call i8* @atoi(i8* %10)
%12 = load i8**, i8*** %3
store i8* %11, i8** %12
br label %13
13: ; preds = %9, %2
%14 = call i8* @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
store i8* %14, i8** %5
%15 = load i8*, i8** %5
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i8*, i8** %5
%19 = call i8* @atoi(i8* %18)
%20 = load i8**, i8*** %4
store i8* %19, i8** %20
br label %21
21: ; preds = %17, %13
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"SSSD_INTG_PEER_UID\00"
@.str.1 = [19 x i8] c"SSSD_INTG_PEER_GID\00"
define void @fake_peer_uid_gid(i8** nocapture writeonly %0, i8** nocapture writeonly %1) {
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i8* @atoi(i8* %3)
store i8* %6, i8** %0
br label %7
7: ; preds = %5, %2
%8 = tail call i8* @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i8* @atoi(i8* %8)
store i8* %11, i8** %1
br label %12
12: ; preds = %10, %7
ret void
}