#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 u_int32_t;
typedef int int32_t;

/* Variables and functions */
int conf_get_num(char *, char *, int /*<<< orphan*/);
u_int32_t dpd_timer_interval(u_int32_t offset) {
  int32_t v = 0;
  if (!v)
    v = conf_get_num("General", "DPD-check-interval", 0);
  if (v < 1)
    return 0;
  v -= offset;
  return v < 1 ? 1 : v;
}


x86 assembly (clang, -O0):
<dpd_timer_interval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1144 <dpd_timer_interval+0x34>
lea    0xecd(%rip),%rdi
lea    0xece(%rip),%rsi
xor    %edx,%edx
call   1030 <conf_get_num@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jge    115a <dpd_timer_interval+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1188 <dpd_timer_interval+0x78>
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jge    117c <dpd_timer_interval+0x6c>
mov    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1182 <dpd_timer_interval+0x72>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dpd_timer_interval>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xee4(%rip),%rdi
lea    0xee5(%rip),%rsi
xor    %ebp,%ebp
xor    %edx,%edx
call   1030 <conf_get_num@plt>
mov    %eax,%edx
sub    %ebx,%edx
test   %edx,%edx
mov    $0x1,%ecx
cmovg  %edx,%ecx
test   %eax,%eax
cmovle %ebp,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"General\00"
@.str.1 = [19 x i8] c"DPD-check-interval\00"
define i32 @dpd_timer_interval(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @conf_get_num(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 0)
store i32 %8, i32* %4
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 0, i32* %2
br label %24
13: ; preds = %9
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = sub nsw i32 %15, %14
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 1
br i1 %18, label %19, label %20
19: ; preds = %13
br label %22
20: ; preds = %13
%21 = load i32, i32* %4
br label %22
22: ; preds = %20, %19
%23 = phi i32 [ 1, %19 ], [ %21, %20 ]
store i32 %23, i32* %2
br label %24
24: ; preds = %22, %12
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [8 x i8] c"General\00"
@.str.1 = [19 x i8] c"DPD-check-interval\00"
define i32 @dpd_timer_interval(i32 %0) {
%2 = tail call i32 @conf_get_num(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 0)
%3 = sub nsw i32 %2, %0
%4 = icmp sgt i32 %3, 1
%5 = select i1 %4, i32 %3, i32 1
%6 = icmp sgt i32 %2, 0
%7 = select i1 %6, i32 %5, i32 0
ret i32 %7
}