#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 /*<<< orphan*/ time_t;
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ eap_res_identity(int, struct sockaddr const *);
int filte_req_identity(int, struct sockaddr const *);
char *format_time();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int eap_keep_alive(int skfd, struct sockaddr const *skaddr) {
  int status;
  time_t stime, etime;
  stime = time((time_t *)NULL);
  for (;;) {
    status = filte_req_identity(skfd, skaddr);
    if (0 == status) {
      etime = time((time_t *)NULL);
      ((void)0);
      if (difftime(etime, stime) <= 10) {
        stime = time((time_t *)NULL);
        continue;
      }
      stime = time((time_t *)NULL);
      fprintf(stderr, "%s: [EAP:KPALV] get a request-identity\n",
              format_time());
      ;
      eap_res_identity(skfd, skaddr);
    }
    status = -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<eap_keep_alive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <filte_req_identity@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmp    -0x14(%rbp),%eax
jne    1203 <eap_keep_alive+0xa3>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <difftime@plt>
cmp    $0xa,%eax
jg     11c6 <eap_keep_alive+0x66>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x18(%rbp)
jmp    117b <eap_keep_alive+0x1b>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e07(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1080 <format_time@plt>
mov    -0x20(%rbp),%edi
mov    %rax,%rdx
lea    0xe0e(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <eap_res_identity@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    117b <eap_keep_alive+0x1b>

x86 assembly (clang, -O2):
<eap_keep_alive>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%r15d
mov    0x2e5f(%rip),%r13
lea    0xe78(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <filte_req_identity@plt>
test   %eax,%eax
jne    1190 <eap_keep_alive+0x30>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
mov    %r15d,%esi
call   1030 <difftime@plt>
mov    %eax,%r12d
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%r15d
cmp    $0xb,%r12d
jl     1190 <eap_keep_alive+0x30>
mov    0x0(%r13),%r12d
xor    %eax,%eax
call   1080 <format_time@plt>
mov    %r12d,%edi
mov    %r14,%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <eap_res_identity@plt>
jmp    1190 <eap_keep_alive+0x30>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [40 x i8] c"%s: [EAP:KPALV] get a request-identity\0A\00"
define i32 @eap_keep_alive(i32 %0, %struct.sockaddr* %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store %struct.sockaddr* %1, %struct.sockaddr** %4
%8 = call i32 @time(i32* null)
store i32 %8, i32* %6
br label %9
9: ; preds = %31, %21, %2
%10 = load i32, i32* %3
%11 = load %struct.sockaddr*, %struct.sockaddr** %4
%12 = call i32 @filte_req_identity(i32 %10, %struct.sockaddr* %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp eq i32 0, %13
br i1 %14, label %15, label %31
15: ; preds = %9
%16 = call i32 @time(i32* null)
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = call i32 @difftime(i32 %17, i32 %18)
%20 = icmp sle i32 %19, 10
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = call i32 @time(i32* null)
store i32 %22, i32* %6
br label %9
23: ; preds = %15
%24 = call i32 @time(i32* null)
store i32 %24, i32* %6
%25 = load i32, i32* @stderr
%26 = call i8* (...) @format_time()
%27 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = load i32, i32* %3
%29 = load %struct.sockaddr*, %struct.sockaddr** %4
%30 = call i32 @eap_res_identity(i32 %28, %struct.sockaddr* %29)
br label %31
31: ; preds = %23, %9
store i32 -1, i32* %5
br label %9
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [40 x i8] c"%s: [EAP:KPALV] get a request-identity\0A\00"
define i32 @eap_keep_alive(i32 %0, %struct.sockaddr* %1) {
%3 = tail call i32 @time(i32* null)
br label %4
4: ; preds = %19, %2
%5 = phi i32 [ %3, %2 ], [ %13, %19 ]
br label %6
6: ; preds = %4, %6
%7 = tail call i32 @filte_req_identity(i32 %0, %struct.sockaddr* %1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %6
9: ; preds = %6
%10 = tail call i32 @time(i32* null)
%11 = tail call i32 @difftime(i32 %10, i32 %5)
%12 = icmp slt i32 %11, 11
%13 = tail call i32 @time(i32* null)
br i1 %12, label %19, label %14
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = tail call i8* (...) @format_time()
%17 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = tail call i32 @eap_res_identity(i32 %0, %struct.sockaddr* %1)
br label %19
19: ; preds = %14, %9
br label %4
}