#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 IntOrError(int, char **, int);
int Os9Create(char *, int, int, int *);
int /*<<< orphan*/ RestoreLastChar(char *, char);
char SetHiBitOfLastChar(char *);
int atoi(char *);
int picolCommand9Create(int argc, char **argv, void *pd) {
  char *path = argv[1];
  char final = SetHiBitOfLastChar(path);
  int mode = atoi(argv[2]);
  int attrs = atoi(argv[3]);
  int fd = 0;
  int e = Os9Create(path, mode, attrs, &fd);
  RestoreLastChar(path, final);
  return IntOrError(e, argv, fd);
}


x86 assembly (clang, -O0):
<picolCommand9Create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <SetHiBitOfLastChar@plt>
mov    %al,-0x21(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
lea    -0x30(%rbp),%rcx
call   1040 <Os9Create@plt>
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
movsbl -0x21(%rbp),%esi
call   1070 <RestoreLastChar@plt>
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x30(%rbp),%edx
call   1030 <IntOrError@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<picolCommand9Create>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%r14
mov    %r14,%rdi
call   1050 <SetHiBitOfLastChar@plt>
mov    %eax,%r15d
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    0x18(%rbx),%rdi
call   1060 <atoi@plt>
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rcx
mov    %r14,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1040 <Os9Create@plt>
mov    %eax,%ebp
movsbl %r15b,%esi
mov    %r14,%rdi
call   1070 <RestoreLastChar@plt>
mov    0x4(%rsp),%edx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <IntOrError@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @picolCommand9Create(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
store i8* %15, i8** %7
%16 = load i8*, i8** %7
%17 = call signext i8 @SetHiBitOfLastChar(i8* %16)
store i8 %17, i8* %8
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %9
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 3
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %10
store i32 0, i32* %11
%26 = load i8*, i8** %7
%27 = load i32, i32* %9
%28 = load i32, i32* %10
%29 = call i32 @Os9Create(i8* %26, i32 %27, i32 %28, i32* %11)
store i32 %29, i32* %12
%30 = load i8*, i8** %7
%31 = load i8, i8* %8
%32 = call i32 @RestoreLastChar(i8* %30, i8 signext %31)
%33 = load i32, i32* %12
%34 = load i8**, i8*** %5
%35 = load i32, i32* %11
%36 = call i32 @IntOrError(i32 %33, i8** %34, i32 %35)
ret i32 %36
}

LLVM IR (-O2):
define i32 @picolCommand9Create(i32 %0, i8** %1, i8* nocapture readnone %2) {
%4 = alloca i32
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call signext i8 @SetHiBitOfLastChar(i8* %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 3
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%15 = call i32 @Os9Create(i8* %6, i32 %10, i32 %13, i32* %4)
%16 = call i32 @RestoreLastChar(i8* %6, i8 signext %7)
%17 = load i32, i32* %4
%18 = call i32 @IntOrError(i32 %15, i8** %1, i32 %17)
ret i32 %18
}