#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*/ close(int const);
int /*<<< orphan*/ remove(char const *const);
void free_resources(const char *const fifo_name, int const ctrl_fifo,
                    int const ctrl_sock, int const lsock) {
  if (lsock)
    close(lsock);
  if (ctrl_sock)
    close(ctrl_sock);
  if (ctrl_fifo) {
    close(ctrl_fifo);
    remove(fifo_name);
  }
}


x86 assembly (clang, -O0):
<free_resources>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1147 <free_resources+0x27>
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
cmpl   $0x0,-0x10(%rbp)
je     1159 <free_resources+0x39>
mov    -0x10(%rbp),%edi
call   1040 <close@plt>
cmpl   $0x0,-0xc(%rbp)
je     1174 <free_resources+0x54>
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
mov    -0x8(%rbp),%rdi
call   1030 <remove@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_resources>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
test   %ecx,%ecx
je     1136 <free_resources+0x16>
mov    %ecx,%edi
call   1040 <close@plt>
test   %ebx,%ebx
je     1141 <free_resources+0x21>
mov    %ebx,%edi
call   1040 <close@plt>
test   %ebp,%ebp
je     1158 <free_resources+0x38>
mov    %ebp,%edi
call   1040 <close@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <remove@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @free_resources(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @close(i32 %3)
br label %8
8: ; preds = %6, %4
%9 = icmp eq i32 %2, 0
br i1 %9, label %12, label %10
10: ; preds = %8
%11 = tail call i32 @close(i32 %2)
br label %12
12: ; preds = %10, %8
%13 = icmp eq i32 %1, 0
br i1 %13, label %17, label %14
14: ; preds = %12
%15 = tail call i32 @close(i32 %1)
%16 = tail call i32 @remove(i8* %0)
br label %17
17: ; preds = %14, %12
ret void
}