#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 scalar_t__ pid_t;

/* Variables and functions */
int PATH_MAX;
int /*<<< orphan*/ sprintf(char *, char *, long);
int /*<<< orphan*/ update_map(char *, int, int, int);
void update_uid_map(pid_t pid, int inside_id, int outside_id, int len) {
  char map_path[PATH_MAX];
  sprintf(map_path, "/proc/%ld/uid_map", (long)pid);
  update_map(map_path, inside_id, outside_id, len);
}


x86 assembly (clang, -O0):
<update_uid_map>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    0x2eb4(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xe94(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <update_map@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_uid_map>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%r12d
mov    %rdi,%rdx
mov    0x2eb2(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1030 <update_map@plt>
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.str = [18 x i8] c"/proc/%ld/uid_map\00"
define void @update_uid_map(i64 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
store i64 %0, i64* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* @PATH_MAX
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %9
%14 = alloca i8, i64 %12
store i64 %12, i64* %10
%15 = load i64, i64* %5
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %15)
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = call i32 @update_map(i8* %14, i32 %17, i32 %18, i32 %19)
%21 = load i8*, i8** %9
ret void
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [18 x i8] c"/proc/%ld/uid_map\00"
define void @update_uid_map(i64 %0, i32 %1, i32 %2, i32 %3) {
%5 = load i32, i32* @PATH_MAX
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %0)
%9 = call i32 @update_map(i8* %7, i32 %1, i32 %2, i32 %3)
ret void
}