#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 /*<<< orphan*/ S_IFREG;
int /*<<< orphan*/ mac_selinux_create_file_clear();
int mac_selinux_create_file_prepare(char const *, int /*<<< orphan*/);
int write_env_file(char const *, char **);
int write_env_file_label(const char *fname, char **l) {
  int r;
  r = mac_selinux_create_file_prepare(fname, S_IFREG);
  if (r < 0)
    return r;
  r = write_env_file(fname, l);
  mac_selinux_create_file_clear();
  return r;
}


x86 assembly (clang, -O0):
<write_env_file_label>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e9d(%rip),%rax
mov    (%rax),%esi
call   1030 <mac_selinux_create_file_prepare@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    116a <write_env_file_label+0x3a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1187 <write_env_file_label+0x57>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <write_env_file@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <mac_selinux_create_file_clear@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_env_file_label>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
call   1030 <mac_selinux_create_file_prepare@plt>
test   %eax,%eax
js     1162 <write_env_file_label+0x32>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <write_env_file@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <mac_selinux_create_file_clear@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@S_IFREG = global i32 0
define i32 @write_env_file_label(i8* %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
%7 = load i8*, i8** %4
%8 = load i32, i32* @S_IFREG
%9 = call i32 @mac_selinux_create_file_prepare(i8* %7, i32 %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i32, i32* %6
store i32 %13, i32* %3
br label %20
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = load i8**, i8*** %5
%17 = call i32 @write_env_file(i8* %15, i8** %16)
store i32 %17, i32* %6
%18 = call i32 (...) @mac_selinux_create_file_clear()
%19 = load i32, i32* %6
store i32 %19, i32* %3
br label %20
20: ; preds = %14, %12
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@S_IFREG = global i32 0
define i32 @write_env_file_label(i8* %0, i8** %1) {
%3 = load i32, i32* @S_IFREG
%4 = tail call i32 @mac_selinux_create_file_prepare(i8* %0, i32 %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @write_env_file(i8* %0, i8** %1)
%8 = tail call i32 (...) @mac_selinux_create_file_clear()
br label %9
9: ; preds = %2, %6
%10 = phi i32 [ %7, %6 ], [ %4, %2 ]
ret i32 %10
}