#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 scm_timestamping {
  int /*<<< orphan*/ *ts;
};

/* Variables and functions */
#define SCM_TSTAMP_ACK 130
#define SCM_TSTAMP_SCHED 129
#define SCM_TSTAMP_SND 128
int /*<<< orphan*/ __print_timestamp(char const *, int /*<<< orphan*/ *, int,
                                     int);
int /*<<< orphan*/ error(int, int /*<<< orphan*/, char *, int);
void print_timestamp(struct scm_timestamping *tss, int tstype, int tskey,
                     int payload_len) {
  const char *tsname;
  switch (tstype) {
  case SCM_TSTAMP_SCHED:
    tsname = "  ENQ";
    break;
  case SCM_TSTAMP_SND:
    tsname = "  SND";
    break;
  case SCM_TSTAMP_ACK:
    tsname = "  ACK";
    break;
  default:
    error(1, 0, "unknown timestamp type: %u", tstype);
  }
  __print_timestamp(tsname, &tss->ts[0], tskey, payload_len);
}


x86 assembly (clang, -O0):
<print_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x80,%eax
je     1181 <print_timestamp+0x61>
jmp    114b <print_timestamp+0x2b>
mov    -0x24(%rbp),%eax
sub    $0x81,%eax
je     1171 <print_timestamp+0x51>
jmp    115e <print_timestamp+0x3e>
mov    -0x24(%rbp),%eax
sub    $0x82,%eax
je     1191 <print_timestamp+0x71>
jmp    11a1 <print_timestamp+0x81>
lea    0xe88(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11b7 <print_timestamp+0x97>
lea    0xe7e(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11b7 <print_timestamp+0x97>
lea    0xe74(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11b7 <print_timestamp+0x97>
mov    -0xc(%rbp),%ecx
mov    $0x1,%edi
xor    %esi,%esi
lea    0xe60(%rip),%rdx
call   1030 <error@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <__print_timestamp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_timestamp>:
push   %rax
mov    %esi,%eax
lea    -0x80(%rax),%esi
cmp    $0x3,%esi
jae    1148 <print_timestamp+0x28>
movslq %esi,%rax
lea    0xefb(%rip),%rsi
movslq (%rsi,%rax,4),%rax
add    %rsi,%rax
mov    (%rdi),%rsi
mov    %rax,%rdi
pop    %rax
jmp    1040 <__print_timestamp@plt>
lea    0xec3(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
mov    %eax,%ecx
call   1030 <error@plt>

LLVM IR (-O0):
%struct.scm_timestamping = type { i32* }
@.str = [6 x i8] c" ENQ\00"
@.str.1 = [6 x i8] c" SND\00"
@.str.2 = [6 x i8] c" ACK\00"
@.str.3 = [27 x i8] c"unknown timestamp type: %u\00"
define void @print_timestamp(%struct.scm_timestamping* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.scm_timestamping*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store %struct.scm_timestamping* %0, %struct.scm_timestamping** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %6
switch i32 %10, label %14 [
i32 129, label %11
i32 128, label %12
i32 130, label %13
]
11: ; preds = %4
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %9
br label %17
12: ; preds = %4
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %17
13: ; preds = %4
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %9
br label %17
14: ; preds = %4
%15 = load i32, i32* %6
%16 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %13, %12, %11
%18 = load i8*, i8** %9
%19 = load %struct.scm_timestamping*, %struct.scm_timestamping** %5
%20 = getelementptr inbounds %struct.scm_timestamping, %struct.scm_timestamping* %19, i32 0, i32 0
%21 = load i32*, i32** %20
%22 = getelementptr inbounds i32, i32* %21, i64 0
%23 = load i32, i32* %7
%24 = load i32, i32* %8
%25 = call i32 @__print_timestamp(i8* %18, i32* %22, i32 %23, i32 %24)
ret void
}

LLVM IR (-O2):
%struct.scm_timestamping = type { i32* }
@.str = [6 x i8] c" ENQ\00"
@.str.1 = [6 x i8] c" SND\00"
@.str.2 = [6 x i8] c" ACK\00"
@.str.3 = [27 x i8] c"unknown timestamp type: %u\00"
@reltable.print_timestamp = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.print_timestamp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.print_timestamp to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.print_timestamp to i64)) to i32)]
define void @print_timestamp(%struct.scm_timestamping* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = add i32 %1, -128
%6 = icmp ult i32 %5, 3
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %1)
unreachable
9: ; preds = %4
%10 = sext i32 %5 to i64
%11 = shl i64 %10, 2
%12 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.print_timestamp to i8*), i64 %11)
%13 = getelementptr inbounds %struct.scm_timestamping, %struct.scm_timestamping* %0, i64 0, i32 0
%14 = load i32*, i32** %13
%15 = tail call i32 @__print_timestamp(i8* %12, i32* %14, i32 %2, i32 %3)
ret void
}