#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 */
struct programArgs {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dosfsClose(int);
int dosfsOpen(char *, int *);
int processModifyAttributesFd(struct programArgs const *const, char *, int,
                              int);
int processModifyAttributes(const struct programArgs *const args, char *file,
                            int processDir) {
  int fd = 0;
  int dosfsErrno = dosfsOpen(file, &fd);
  if (dosfsErrno) {
    return dosfsErrno;
  }
  dosfsErrno = processModifyAttributesFd(args, file, fd, processDir);
  dosfsClose(fd);
  return dosfsErrno;
}


x86 assembly (clang, -O0):
<processModifyAttributes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <dosfsOpen@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     116f <processModifyAttributes+0x3f>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1193 <processModifyAttributes+0x63>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1050 <processModifyAttributesFd@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <dosfsClose@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processModifyAttributes>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r15
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <dosfsOpen@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    1178 <processModifyAttributes+0x48>
mov    0x4(%rsp),%edx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%ecx
call   1050 <processModifyAttributesFd@plt>
mov    %eax,%ebp
mov    0x4(%rsp),%edi
call   1030 <dosfsClose@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.programArgs = type { i32 }
define i32 @processModifyAttributes(%struct.programArgs* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.programArgs*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store %struct.programArgs* %0, %struct.programArgs** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 0, i32* %8
%10 = load i8*, i8** %6
%11 = call i32 @dosfsOpen(i8* %10, i32* %8)
store i32 %11, i32* %9
%12 = load i32, i32* %9
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = load i32, i32* %9
store i32 %15, i32* %4
br label %25
16: ; preds = %3
%17 = load %struct.programArgs*, %struct.programArgs** %5
%18 = load i8*, i8** %6
%19 = load i32, i32* %8
%20 = load i32, i32* %7
%21 = call i32 @processModifyAttributesFd(%struct.programArgs* %17, i8* %18, i32 %19, i32 %20)
store i32 %21, i32* %9
%22 = load i32, i32* %8
%23 = call i32 @dosfsClose(i32 %22)
%24 = load i32, i32* %9
store i32 %24, i32* %4
br label %25
25: ; preds = %16, %14
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
%struct.programArgs = type { i32 }
define i32 @processModifyAttributes(%struct.programArgs* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%6 = call i32 @dosfsOpen(i8* %1, i32* %4)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i32, i32* %4
%10 = call i32 @processModifyAttributesFd(%struct.programArgs* %0, i8* %1, i32 %9, i32 %2)
%11 = load i32, i32* %4
%12 = call i32 @dosfsClose(i32 %11)
br label %13
13: ; preds = %3, %8
%14 = phi i32 [ %10, %8 ], [ %6, %3 ]
ret i32 %14
}