#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 char uint8_t;
typedef int uint64_t;

/* Variables and functions */
void nios_pkt_retune_resp_pack(uint8_t *buf, uint64_t duration, uint8_t vcocap,
                               uint8_t flags) {
  buf[0] = 'T';
  buf[1 + 0] = duration & 0xff;
  buf[1 + 1] = (duration >> 8) & 0xff;
  buf[1 + 2] = (duration >> 16) & 0xff;
  buf[1 + 3] = (duration >> 24) & 0xff;
  buf[1 + 4] = (duration >> 32) & 0xff;
  buf[1 + 5] = (duration >> 40) & 0xff;
  buf[1 + 6] = (duration >> 48) & 0xff;
  buf[1 + 7] = (duration >> 56) & 0xff;
  buf[9] = vcocap;
  buf[10] = flags;
  buf[11 + 0] = 0x00;
  buf[11 + 1] = 0x00;
  buf[11 + 2] = 0x00;
  buf[11 + 3] = 0x00;
  buf[11 + 4] = 0x00;
}


x86 assembly (clang, -O0):
<nios_pkt_retune_resp_pack>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %dl,%cl
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %cl,-0xd(%rbp)
mov    %al,-0xe(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x54,(%rax)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x5(%rax)
mov    -0xc(%rbp),%eax
mov    $0x28,%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x6(%rax)
mov    -0xc(%rbp),%eax
mov    $0x30,%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x7(%rax)
mov    -0xc(%rbp),%eax
mov    $0x38,%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x8(%rax)
mov    -0xd(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x9(%rax)
mov    -0xe(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0xa(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0xb(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0xc(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0xd(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0xe(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0xf(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nios_pkt_retune_resp_pack>:
mov    %esi,%eax
movb   $0x54,(%rdi)
mov    %al,0x1(%rdi)
mov    %ah,0x2(%rdi)
shr    $0x10,%esi
mov    %sil,0x3(%rdi)
shr    $0x18,%eax
mov    %al,0x4(%rdi)
mov    %dl,0x9(%rdi)
mov    %cl,0xa(%rdi)
movl   $0x0,0xb(%rdi)
movb   $0x0,0xf(%rdi)
ret

LLVM IR (-O0):
define void @nios_pkt_retune_resp_pack(i8* %0, i32 %1, i8 signext %2, i8 signext %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%9 = load i8*, i8** %5
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 84, i8* %10
%11 = load i32, i32* %6
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %13, i8* %15
%16 = load i32, i32* %6
%17 = ashr i32 %16, 8
%18 = and i32 %17, 255
%19 = trunc i32 %18 to i8
%20 = load i8*, i8** %5
%21 = getelementptr inbounds i8, i8* %20, i64 2
store i8 %19, i8* %21
%22 = load i32, i32* %6
%23 = ashr i32 %22, 16
%24 = and i32 %23, 255
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i64 3
store i8 %25, i8* %27
%28 = load i32, i32* %6
%29 = ashr i32 %28, 24
%30 = and i32 %29, 255
%31 = trunc i32 %30 to i8
%32 = load i8*, i8** %5
%33 = getelementptr inbounds i8, i8* %32, i64 4
store i8 %31, i8* %33
%34 = load i32, i32* %6
%35 = ashr i32 %34, 32
%36 = and i32 %35, 255
%37 = trunc i32 %36 to i8
%38 = load i8*, i8** %5
%39 = getelementptr inbounds i8, i8* %38, i64 5
store i8 %37, i8* %39
%40 = load i32, i32* %6
%41 = ashr i32 %40, 40
%42 = and i32 %41, 255
%43 = trunc i32 %42 to i8
%44 = load i8*, i8** %5
%45 = getelementptr inbounds i8, i8* %44, i64 6
store i8 %43, i8* %45
%46 = load i32, i32* %6
%47 = ashr i32 %46, 48
%48 = and i32 %47, 255
%49 = trunc i32 %48 to i8
%50 = load i8*, i8** %5
%51 = getelementptr inbounds i8, i8* %50, i64 7
store i8 %49, i8* %51
%52 = load i32, i32* %6
%53 = ashr i32 %52, 56
%54 = and i32 %53, 255
%55 = trunc i32 %54 to i8
%56 = load i8*, i8** %5
%57 = getelementptr inbounds i8, i8* %56, i64 8
store i8 %55, i8* %57
%58 = load i8, i8* %7
%59 = load i8*, i8** %5
%60 = getelementptr inbounds i8, i8* %59, i64 9
store i8 %58, i8* %60
%61 = load i8, i8* %8
%62 = load i8*, i8** %5
%63 = getelementptr inbounds i8, i8* %62, i64 10
store i8 %61, i8* %63
%64 = load i8*, i8** %5
%65 = getelementptr inbounds i8, i8* %64, i64 11
store i8 0, i8* %65
%66 = load i8*, i8** %5
%67 = getelementptr inbounds i8, i8* %66, i64 12
store i8 0, i8* %67
%68 = load i8*, i8** %5
%69 = getelementptr inbounds i8, i8* %68, i64 13
store i8 0, i8* %69
%70 = load i8*, i8** %5
%71 = getelementptr inbounds i8, i8* %70, i64 14
store i8 0, i8* %71
%72 = load i8*, i8** %5
%73 = getelementptr inbounds i8, i8* %72, i64 15
store i8 0, i8* %73
ret void
}

LLVM IR (-O2):
define void @nios_pkt_retune_resp_pack(i8* nocapture writeonly %0, i32 %1, i8 signext %2, i8 signext %3) {
store i8 84, i8* %0
%5 = trunc i32 %1 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %1, 8
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %1, 16
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
%13 = lshr i32 %1, 24
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %14, i8* %15
%16 = getelementptr inbounds i8, i8* %0, i64 9
store i8 %2, i8* %16
%17 = getelementptr inbounds i8, i8* %0, i64 10
store i8 %3, i8* %17
%18 = getelementptr inbounds i8, i8* %0, i64 11
ret void
}