#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*/ SA_NOCLDSTOP;
int /*<<< orphan*/ SIGCHLD;
int /*<<< orphan*/ SIGINT;
int iop_install_handler(int /*<<< orphan*/, int /*<<< orphan*/, void (*)(int));
int iop_install_handlers(void (*chld_fun)(int), void (*intr_fun)(int)) {
  int retcode = iop_install_handler(SIGCHLD, SA_NOCLDSTOP, chld_fun);
  if (retcode != 0) {
    return retcode;
  }
  return iop_install_handler(SIGINT, 0, intr_fun);
}


x86 assembly (clang, -O0):
<iop_install_handlers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1030 <iop_install_handler@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1153 <iop_install_handlers+0x43>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116a <iop_install_handlers+0x5a>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
xor    %esi,%esi
call   1030 <iop_install_handler@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iop_install_handlers>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rdx
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <iop_install_handler@plt>
test   %eax,%eax
je     1134 <iop_install_handlers+0x24>
pop    %rbx
ret
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
mov    %rbx,%rdx
pop    %rbx
jmp    1030 <iop_install_handler@plt>

LLVM IR (-O0):
@SIGCHLD = global i32 0
@SA_NOCLDSTOP = global i32 0
@SIGINT = global i32 0
define i32 @iop_install_handlers(void (i32)* %0, void (i32)* %1) {
%3 = alloca i32
%4 = alloca void (i32)*
%5 = alloca void (i32)*
%6 = alloca i32
store void (i32)* %0, void (i32)** %4
store void (i32)* %1, void (i32)** %5
%7 = load i32, i32* @SIGCHLD
%8 = load i32, i32* @SA_NOCLDSTOP
%9 = load void (i32)*, void (i32)** %4
%10 = call i32 @iop_install_handler(i32 %7, i32 %8, void (i32)* %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32, i32* %6
store i32 %14, i32* %3
br label %19
15: ; preds = %2
%16 = load i32, i32* @SIGINT
%17 = load void (i32)*, void (i32)** %5
%18 = call i32 @iop_install_handler(i32 %16, i32 0, void (i32)* %17)
store i32 %18, i32* %3
br label %19
19: ; preds = %15, %13
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@SIGCHLD = global i32 0
@SA_NOCLDSTOP = global i32 0
@SIGINT = global i32 0
define i32 @iop_install_handlers(void (i32)* %0, void (i32)* %1) {
%3 = load i32, i32* @SIGCHLD
%4 = load i32, i32* @SA_NOCLDSTOP
%5 = tail call i32 @iop_install_handler(i32 %3, i32 %4, void (i32)* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* @SIGINT
%9 = tail call i32 @iop_install_handler(i32 %8, i32 0, void (i32)* %1)
br label %10
10: ; preds = %2, %7
%11 = phi i32 [ %9, %7 ], [ %5, %2 ]
ret i32 %11
}