#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 sg_ll_send_diag(int, int, int, int, int, int, int, void *, int, int, int);
int do_senddiag(int sg_fd, int sf_code, int pf_bit, int sf_bit, int devofl_bit,
                int unitofl_bit, void *outgoing_pg, int outgoing_len, int noisy,
                int verbose) {
  int long_duration = 0;
  if ((0 == sf_bit) && ((5 == sf_code) || (6 == sf_code)))
    long_duration = 1;
  return sg_ll_send_diag(sg_fd, sf_code, pf_bit, sf_bit, devofl_bit,
                         unitofl_bit, long_duration, outgoing_pg, outgoing_len,
                         noisy, verbose);
}


x86 assembly (clang, -O0):
<do_senddiag>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%eax
jne    1171 <do_senddiag+0x61>
mov    $0x5,%eax
cmp    -0x18(%rbp),%eax
je     116a <do_senddiag+0x5a>
mov    $0x6,%eax
cmp    -0x18(%rbp),%eax
jne    1171 <do_senddiag+0x61>
movl   $0x1,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    -0x2c(%rbp),%r14d
mov    0x10(%rbp),%rbx
mov    0x18(%rbp),%r11d
mov    0x20(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %r14d,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
call   1030 <sg_ll_send_diag@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_senddiag>:
push   %rbp
push   %r14
push   %rbx
mov    0x28(%rsp),%r10d
mov    0x30(%rsp),%r11d
mov    0x38(%rsp),%r14d
test   %ecx,%ecx
sete   %bl
lea    -0x5(%rsi),%ebp
cmp    $0x2,%ebp
setb   %al
and    %bl,%al
movzbl %al,%eax
sub    $0x8,%rsp
push   %r14
push   %r11
push   %r10
push   0x40(%rsp)
push   %rax
call   1030 <sg_ll_send_diag@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @do_senddiag(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i8* %6, i32 %7, i32 %8, i32 %9) {
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32 %0, i32* %11
store i32 %1, i32* %12
store i32 %2, i32* %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store i8* %6, i8** %17
store i32 %7, i32* %18
store i32 %8, i32* %19
store i32 %9, i32* %20
store i32 0, i32* %21
%22 = load i32, i32* %14
%23 = icmp eq i32 0, %22
br i1 %23, label %24, label %31
24: ; preds = %10
%25 = load i32, i32* %12
%26 = icmp eq i32 5, %25
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load i32, i32* %12
%29 = icmp eq i32 6, %28
br i1 %29, label %30, label %31
30: ; preds = %27, %24
store i32 1, i32* %21
br label %31
31: ; preds = %30, %27, %10
%32 = load i32, i32* %11
%33 = load i32, i32* %12
%34 = load i32, i32* %13
%35 = load i32, i32* %14
%36 = load i32, i32* %15
%37 = load i32, i32* %16
%38 = load i32, i32* %21
%39 = load i8*, i8** %17
%40 = load i32, i32* %18
%41 = load i32, i32* %19
%42 = load i32, i32* %20
%43 = call i32 @sg_ll_send_diag(i32 %32, i32 %33, i32 %34, i32 %35, i32 %36, i32 %37, i32 %38, i8* %39, i32 %40, i32 %41, i32 %42)
ret i32 %43
}

LLVM IR (-O2):
define i32 @do_senddiag(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i8* %6, i32 %7, i32 %8, i32 %9) {
%11 = icmp eq i32 %3, 0
%12 = add i32 %1, -5
%13 = icmp ult i32 %12, 2
%14 = and i1 %13, %11
%15 = zext i1 %14 to i32
%16 = tail call i32 @sg_ll_send_diag(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %15, i8* %6, i32 %7, i32 %8, i32 %9)
ret i32 %16
}