#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 */

/* Variables and functions */
int /*<<< orphan*/ drv_Sample_send(char *, int);
void drv_Sample_defchar(const int ascii, const unsigned char *matrix) {
  char cmd[10];
  int i;
  cmd[0] = 0x03;
  cmd[1] = ascii;
  for (i = 0; i < 8; i++) {
    cmd[i + 2] = *matrix++;
  }
  drv_Sample_send(cmd, 10);
}


x86 assembly (clang, -O0):
<drv_Sample_defchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x3,-0x1a(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x19(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x8,-0x20(%rbp)
jge    1165 <drv_Sample_defchar+0x55>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x20(%rbp),%eax
add    $0x2,%eax
cltq
mov    %cl,-0x1a(%rbp,%rax,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1130 <drv_Sample_defchar+0x20>
lea    -0x1a(%rbp),%rdi
mov    $0xa,%esi
call   1030 <drv_Sample_send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_Sample_defchar>:
sub    $0x18,%rsp
movb   $0x3,0xe(%rsp)
mov    %dil,0xf(%rsp)
mov    (%rsi),%rax
mov    %rax,0x10(%rsp)
lea    0xe(%rsp),%rdi
mov    $0xa,%esi
call   1030 <drv_Sample_send@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @drv_Sample_defchar(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [10 x i8]
%6 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
store i8 3, i8* %7
%8 = load i32, i32* %3
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 1
store i8 %9, i8* %10
store i32 0, i32* %6
br label %11
11: ; preds = %22, %2
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %25
14: ; preds = %11
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %4
%17 = load i8, i8* %15
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 %20
store i8 %17, i8* %21
br label %22
22: ; preds = %14
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
store i32 %24, i32* %6
br label %11
25: ; preds = %11
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%27 = call i32 @drv_Sample_send(i8* %26, i32 10)
ret void
}

LLVM IR (-O2):
define void @drv_Sample_defchar(i32 %0, i8* nocapture %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
store i8 3, i8* %4
%5 = trunc i32 %0 to i8
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 1
store i8 %5, i8* %6
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 2
%8 = bitcast i8* %1 to i64*
%9 = bitcast i8* %7 to i64*
%10 = load i64, i64* %8
store i64 %10, i64* %9
%11 = call i32 @drv_Sample_send(i8* %4, i32 10)
ret void
}