#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 /*<<< orphan*/ assert(int);
int /*<<< orphan*/ destroy_store();
int exists(int /*<<< orphan*/);
int /*<<< orphan*/ expire_slots();
int get(int /*<<< orphan*/);
int /*<<< orphan*/ get_deadline(int);
int /*<<< orphan*/ init_store();
int /*<<< orphan*/ set(int /*<<< orphan*/, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ sleep(int);
void test_getset_ephem() {
  init_store();
  set(0, 998, get_deadline(750), 2);
  assert(exists(0));
  assert(get(0) == 998);
  sleep(1);
  expire_slots();
  assert(!exists(0));
  assert(get(0) == 0);
  destroy_store();
}


x86 assembly (clang, -O0):
<test_getset_ephem>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1090 <init_store@plt>
mov    $0x2ee,%edi
call   1070 <get_deadline@plt>
mov    %eax,%edx
xor    %edi,%edi
mov    $0x3e6,%esi
mov    $0x2,%ecx
call   10b0 <set@plt>
xor    %edi,%edi
call   1080 <exists@plt>
mov    %eax,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1050 <get@plt>
cmp    $0x3e6,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    $0x0,%al
call   1060 <expire_slots@plt>
xor    %edi,%edi
call   1080 <exists@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1050 <get@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x0,%al
call   1040 <destroy_store@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_getset_ephem>:
push   %rax
xor    %eax,%eax
call   1090 <init_store@plt>
mov    $0x2ee,%edi
call   1070 <get_deadline@plt>
xor    %edi,%edi
mov    $0x3e6,%esi
mov    %eax,%edx
mov    $0x2,%ecx
call   10b0 <set@plt>
xor    %edi,%edi
call   1080 <exists@plt>
mov    %eax,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1050 <get@plt>
xor    %edi,%edi
cmp    $0x3e6,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1060 <expire_slots@plt>
xor    %edi,%edi
call   1080 <exists@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
call   1050 <get@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <destroy_store@plt>

LLVM IR (-O0):
define void @test_getset_ephem() {
%1 = call i32 (...) @init_store()
%2 = call i32 @get_deadline(i32 750)
%3 = call i32 @set(i32 0, i32 998, i32 %2, i32 2)
%4 = call i32 @exists(i32 0)
%5 = call i32 @assert(i32 %4)
%6 = call i32 @get(i32 0)
%7 = icmp eq i32 %6, 998
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 @sleep(i32 1)
%11 = call i32 (...) @expire_slots()
%12 = call i32 @exists(i32 0)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i32 @get(i32 0)
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 (...) @destroy_store()
ret void
}

LLVM IR (-O2):
define void @test_getset_ephem() {
%1 = tail call i32 (...) @init_store()
%2 = tail call i32 @get_deadline(i32 750)
%3 = tail call i32 @set(i32 0, i32 998, i32 %2, i32 2)
%4 = tail call i32 @exists(i32 0)
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @get(i32 0)
%7 = icmp eq i32 %6, 998
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 @sleep(i32 1)
%11 = tail call i32 (...) @expire_slots()
%12 = tail call i32 @exists(i32 0)
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i32 @get(i32 0)
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
%20 = tail call i32 (...) @destroy_store()
ret void
}