#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memset(int *, int, int);
void ts_set_adaptation(uint8_t *p_ts, uint8_t i_length) {
  p_ts[3] |= 0x20;
  p_ts[4] = i_length;
  if (i_length)
    p_ts[5] = 0x0;
  if (i_length > 1)
    memset(&p_ts[6], 0xff, i_length - 1);
}


x86 assembly (clang, -O0):
<ts_set_adaptation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%ecx
or     $0x20,%ecx
mov    %ecx,0xc(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
cmpl   $0x0,-0xc(%rbp)
je     114b <ts_set_adaptation+0x3b>
mov    -0x8(%rbp),%rax
movl   $0x0,0x14(%rax)
cmpl   $0x1,-0xc(%rbp)
jle    116d <ts_set_adaptation+0x5d>
mov    -0x8(%rbp),%rdi
add    $0x18,%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    $0xff,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_set_adaptation>:
orb    $0x20,0xc(%rdi)
mov    %esi,0x10(%rdi)
test   %esi,%esi
je     113a <ts_set_adaptation+0x2a>
mov    %esi,%edx
movl   $0x0,0x14(%rdi)
cmp    $0x2,%esi
jl     113a <ts_set_adaptation+0x2a>
add    $0x18,%rdi
add    $0xffffffff,%edx
mov    $0xff,%esi
jmp    1030 <memset@plt>
ret

LLVM IR (-O0):
define void @ts_set_adaptation(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 3
%7 = load i32, i32* %6
%8 = or i32 %7, 32
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 4
store i32 %9, i32* %11
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 5
store i32 0, i32* %16
br label %17
17: ; preds = %14, %2
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %26
20: ; preds = %17
%21 = load i32*, i32** %3
%22 = getelementptr inbounds i32, i32* %21, i64 6
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, 1
%25 = call i32 @memset(i32* %22, i32 255, i32 %24)
br label %26
26: ; preds = %20, %17
ret void
}

LLVM IR (-O2):
define void @ts_set_adaptation(i32* %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 3
%4 = load i32, i32* %3
%5 = or i32 %4, 32
store i32 %5, i32* %3
%6 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %1, i32* %6
%7 = icmp eq i32 %1, 0
br i1 %7, label %15, label %8
8: ; preds = %2
%9 = getelementptr inbounds i32, i32* %0, i64 5
store i32 0, i32* %9
%10 = icmp sgt i32 %1, 1
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = getelementptr inbounds i32, i32* %0, i64 6
%13 = add nsw i32 %1, -1
%14 = tail call i32 @memset(i32* %12, i32 255, i32 %13)
br label %15
15: ; preds = %2, %11, %8
ret void
}