#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 scalar_t__ time_t;
struct dhcp_binding {
  int dummy;
};

/* Variables and functions */
int bootp_transaction(struct dhcp_binding *);
scalar_t__ get_dhcp_next_event(struct dhcp_binding *);
time_t dhcp_step(struct dhcp_binding *binding) {
  time_t next;
  next = get_dhcp_next_event(binding);
  if (next == 0) {
    int ret;
    ret = bootp_transaction(binding);
    if (ret != 0) {
      next = (time_t)ret;
    } else {
      next = get_dhcp_next_event(binding);
    }
  }
  return next;
}


x86 assembly (clang, -O0):
<dhcp_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <get_dhcp_next_event@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1179 <dhcp_step+0x59>
mov    -0x8(%rbp),%rdi
call   1030 <bootp_transaction@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1167 <dhcp_step+0x47>
movslq -0x14(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1174 <dhcp_step+0x54>
mov    -0x8(%rbp),%rdi
call   1040 <get_dhcp_next_event@plt>
mov    %rax,-0x10(%rbp)
jmp    1179 <dhcp_step+0x59>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dhcp_step>:
push   %rbx
mov    %rdi,%rbx
call   1040 <get_dhcp_next_event@plt>
test   %rax,%rax
je     1130 <dhcp_step+0x10>
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <bootp_transaction@plt>
test   %eax,%eax
je     1140 <dhcp_step+0x20>
cltq
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <get_dhcp_next_event@plt>

LLVM IR (-O0):
%struct.dhcp_binding = type { i32 }
define i64 @dhcp_step(%struct.dhcp_binding* %0) {
%2 = alloca %struct.dhcp_binding*
%3 = alloca i64
%4 = alloca i32
store %struct.dhcp_binding* %0, %struct.dhcp_binding** %2
%5 = load %struct.dhcp_binding*, %struct.dhcp_binding** %2
%6 = call i64 @get_dhcp_next_event(%struct.dhcp_binding* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %1
%10 = load %struct.dhcp_binding*, %struct.dhcp_binding** %2
%11 = call i32 @bootp_transaction(%struct.dhcp_binding* %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
store i64 %16, i64* %3
br label %20
17: ; preds = %9
%18 = load %struct.dhcp_binding*, %struct.dhcp_binding** %2
%19 = call i64 @get_dhcp_next_event(%struct.dhcp_binding* %18)
store i64 %19, i64* %3
br label %20
20: ; preds = %17, %14
br label %21
21: ; preds = %20, %1
%22 = load i64, i64* %3
ret i64 %22
}

LLVM IR (-O2):
%struct.dhcp_binding = type { i32 }
define i64 @dhcp_step(%struct.dhcp_binding* %0) {
%2 = tail call i64 @get_dhcp_next_event(%struct.dhcp_binding* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = tail call i32 @bootp_transaction(%struct.dhcp_binding* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = sext i32 %5 to i64
br label %11
9: ; preds = %4
%10 = tail call i64 @get_dhcp_next_event(%struct.dhcp_binding* %0)
br label %11
11: ; preds = %7, %9, %1
%12 = phi i64 [ %2, %1 ], [ %8, %7 ], [ %10, %9 ]
ret i64 %12
}