#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 /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ storeu(int /*<<< orphan*/ const *, int /*<<< orphan*/);
void store_partial_left(const uint8_t *p, __m128i x, const size_t num_bytes) {
  if (num_bytes == 0) {
    return;
  } else if (num_bytes >= 16) {
    storeu(p, x);
  } else {
    size_t i;
    char *p_ = (char *)p;
    char *x_ = (char *)&x;
    for (i = 0; i < num_bytes; ++i) {
      p_[i] = x_[i];
    }
  }
}


x86 assembly (clang, -O0):
<store_partial_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1133 <store_partial_left+0x23>
jmp    11a6 <store_partial_left+0x96>
cmpq   $0x10,-0x18(%rbp)
jb     114f <store_partial_left+0x3f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <storeu@plt>
jmp    11a1 <store_partial_left+0x91>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    119c <store_partial_left+0x8c>
mov    -0x30(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1167 <store_partial_left+0x57>
jmp    11a1 <store_partial_left+0x91>
jmp    11a6 <store_partial_left+0x96>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<store_partial_left>:
push   %rax
mov    %esi,0x4(%rsp)
test   %rdx,%rdx
je     1140 <store_partial_left+0x20>
cmp    $0x10,%rdx
jb     1136 <store_partial_left+0x16>
pop    %rax
jmp    1030 <storeu@plt>
lea    0x4(%rsp),%rsi
call   1040 <memcpy@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @store_partial_left(i32* %0, i32 %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%10 = load i64, i64* %6
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %3
br label %41
13: ; preds = %3
%14 = load i64, i64* %6
%15 = icmp uge i64 %14, 16
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32*, i32** %4
%18 = load i32, i32* %5
%19 = call i32 @storeu(i32* %17, i32 %18)
br label %40
20: ; preds = %13
%21 = load i32*, i32** %4
%22 = bitcast i32* %21 to i8*
store i8* %22, i8** %8
%23 = bitcast i32* %5 to i8*
store i8* %23, i8** %9
store i64 0, i64* %7
br label %24
24: ; preds = %36, %20
%25 = load i64, i64* %7
%26 = load i64, i64* %6
%27 = icmp ult i64 %25, %26
br i1 %27, label %28, label %39
28: ; preds = %24
%29 = load i8*, i8** %9
%30 = load i64, i64* %7
%31 = getelementptr inbounds i8, i8* %29, i64 %30
%32 = load i8, i8* %31
%33 = load i8*, i8** %8
%34 = load i64, i64* %7
%35 = getelementptr inbounds i8, i8* %33, i64 %34
store i8 %32, i8* %35
br label %36
36: ; preds = %28
%37 = load i64, i64* %7
%38 = add i64 %37, 1
store i64 %38, i64* %7
br label %24
39: ; preds = %24
br label %40
40: ; preds = %39, %16
br label %41
41: ; preds = %12, %40
ret void
}

LLVM IR (-O2):
define void @store_partial_left(i32* %0, i32 %1, i64 %2) {
%4 = bitcast i32* %0 to i8*
%5 = alloca i32
store i32 %1, i32* %5
%6 = icmp eq i64 %2, 0
br i1 %6, label %13, label %7
7: ; preds = %3
%8 = icmp ugt i64 %2, 15
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @storeu(i32* %0, i32 %1)
br label %13
11: ; preds = %7
%12 = bitcast i32* %5 to i8*
br label %13
13: ; preds = %11, %9, %3
ret void
}