#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ SIGPIPE;
scalar_t__ SIG_ERR;
int /*<<< orphan*/ SIG_IGN;
int crypto_init();
scalar_t__ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ ssh_set_error(char *);
int ssh_init(uint32_t flags) {
  if ((flags & (1 << 0)) == 0) {
    if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
      ssh_set_error("error ignoring signal");
      return -1;
    }
  }
  return crypto_init();
}


x86 assembly (clang, -O0):
<ssh_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    118e <ssh_init+0x5e>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
mov    0x2e8e(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
mov    0x2e70(%rip),%rcx
cmp    (%rcx),%rax
jne    1189 <ssh_init+0x59>
lea    0xe88(%rip),%rdi
call   1050 <ssh_set_error@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1198 <ssh_init+0x68>
jmp    118e <ssh_init+0x5e>
mov    $0x0,%al
call   1040 <crypto_init@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssh_init>:
push   %rax
test   $0x1,%dil
jne    116d <ssh_init+0x3d>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%rax
jne    116d <ssh_init+0x3d>
lea    0xe9f(%rip),%rdi
call   1050 <ssh_set_error@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
jmp    1040 <crypto_init@plt>

LLVM IR (-O0):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@.str = [22 x i8] c"error ignoring signal\00"
define i32 @ssh_init(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 1
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i32, i32* @SIGPIPE
%9 = load i32, i32* @SIG_IGN
%10 = call i64 @signal(i32 %8, i32 %9)
%11 = load i64, i64* @SIG_ERR
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 @ssh_set_error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %18
15: ; preds = %7
br label %16
16: ; preds = %15, %1
%17 = call i32 (...) @crypto_init()
store i32 %17, i32* %2
br label %18
18: ; preds = %16, %13
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@.str = [22 x i8] c"error ignoring signal\00"
define i32 @ssh_init(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = load i32, i32* @SIGPIPE
%6 = load i32, i32* @SIG_IGN
%7 = tail call i64 @signal(i32 %5, i32 %6)
%8 = load i64, i64* @SIG_ERR
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 @ssh_set_error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %14
12: ; preds = %4, %1
%13 = tail call i32 (...) @crypto_init()
br label %14
14: ; preds = %12, %10
%15 = phi i32 [ -1, %10 ], [ %13, %12 ]
ret i32 %15
}