#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 */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct lsm_tree {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ destroy(struct lsm_tree *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ timersub(struct timeval *, struct timeval *,
                            struct timeval *);
void quit(struct lsm_tree *tree) {
  struct timeval tval_before, tval_after, tval_result;
  printf("Destroying LSM tree... ");
  gettimeofday(&tval_before, NULL);
  destroy(tree);
  gettimeofday(&tval_after, NULL);
  timersub(&tval_after, &tval_before, &tval_result);
  printf("done.\n");
  printf("Time elapsed: %ld.%06ld\n", (long)tval_result.tv_sec,
         (long)tval_result.tv_usec);
  exit(0);
}


x86 assembly (clang, -O0):
<quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    -0x8(%rbp),%rdi
call   1050 <destroy@plt>
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
lea    -0x28(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1070 <timersub@plt>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<quit>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%rbx
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x28(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %rbx,%rdi
call   1060 <destroy@plt>
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <timersub@plt>
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%rsi
lea    0xe4d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.lsm_tree = type { i32 }
%struct.timeval = type { i64, i64 }
@.str = [24 x i8] c"Destroying LSM tree... \00"
@.str.1 = [7 x i8] c"done.\0A\00"
@.str.2 = [25 x i8] c"Time elapsed: %ld.%06ld\0A\00"
define void @quit(%struct.lsm_tree* %0) {
%2 = alloca %struct.lsm_tree*
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
store %struct.lsm_tree* %0, %struct.lsm_tree** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%8 = load %struct.lsm_tree*, %struct.lsm_tree** %2
%9 = call i32 @destroy(%struct.lsm_tree* %8)
%10 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%11 = call i32 @timersub(%struct.timeval* %4, %struct.timeval* %3, %struct.timeval* %5)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%14 = load i64, i64* %13
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%16 = load i64, i64* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 %14, i64 %16)
%18 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.lsm_tree = type { i32 }
%struct.timeval = type { i64, i64 }
@.str = [24 x i8] c"Destroying LSM tree... \00"
@.str.2 = [25 x i8] c"Time elapsed: %ld.%06ld\0A\00"
@str = [6 x i8] c"done.\00"
define void @quit(%struct.lsm_tree* %0) {
%2 = alloca %struct.timeval
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = bitcast %struct.timeval* %2 to i8*
%6 = bitcast %struct.timeval* %3 to i8*
%7 = bitcast %struct.timeval* %4 to i8*
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%10 = tail call i32 @destroy(%struct.lsm_tree* %0)
%11 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%12 = call i32 @timersub(%struct.timeval* %3, %struct.timeval* %2, %struct.timeval* %4)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%15 = load i64, i64* %14
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%17 = load i64, i64* %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 %15, i64 %17)
%19 = call i32 @exit(i32 0)
unreachable
}