#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*/ convert2ASCII(char const, char *);
int /*<<< orphan*/ drv_generic_serial_write(char const *, unsigned int const);
int /*<<< orphan*/ message(int, char *, ...);
void drv_PICGraphic_send(const char *data, const unsigned int len) {
  unsigned int i;
  char hexDigits[3];
  hexDigits[2] = 0;
  drv_generic_serial_write(data, len);
  message(1, "sending %d bytes: ", len);
  for (i = 0; i < (10 < len ? 10 : len); i++) {
    convert2ASCII(data[i], hexDigits);
    message(2,
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/Johny-C/smartwatch-repo/refs/heads/"
            "master/drv_PICGraphic.c"
            ": "
            "0x%s (%c)",
            hexDigits, data[i]);
  }
}


x86 assembly (clang, -O0):
<drv_PICGraphic_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movb   $0x0,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <drv_generic_serial_write@plt>
mov    -0xc(%rbp),%edx
mov    $0x1,%edi
lea    0xea2(%rip),%rsi
mov    $0x0,%al
call   1030 <message@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0xa,%eax
cmp    -0xc(%rbp),%eax
jae    118d <drv_PICGraphic_send+0x5d>
mov    $0xa,%eax
mov    %eax,-0x1c(%rbp)
jmp    1193 <drv_PICGraphic_send+0x63>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
cmp    %ecx,%eax
jae    11e7 <drv_PICGraphic_send+0xb7>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,1),%al
lea    -0x13(%rbp),%rsi
movsbl %al,%edi
call   1040 <convert2ASCII@plt>
lea    -0x13(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movsbl (%rax,%rcx,1),%ecx
mov    $0x2,%edi
lea    0xe41(%rip),%rsi
mov    $0x0,%al
call   1030 <message@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116c <drv_PICGraphic_send+0x3c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_PICGraphic_send>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
movb   $0x0,0xf(%rsp)
call   1050 <drv_generic_serial_write@plt>
lea    0xeae(%rip),%rsi
mov    $0x1,%edi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <message@plt>
cmp    $0xa,%ebp
mov    $0xa,%eax
cmovb  %ebp,%eax
test   %eax,%eax
je     11ab <drv_PICGraphic_send+0x7b>
mov    %eax,%r12d
lea    0xd(%rsp),%r14
lea    0xe95(%rip),%r15
xor    %ebp,%ebp
movsbl (%rbx,%rbp,1),%edi
mov    %r14,%rsi
call   1040 <convert2ASCII@plt>
movsbl (%rbx,%rbp,1),%ecx
mov    $0x2,%edi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <message@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1180 <drv_PICGraphic_send+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"sending %d bytes: \00"
@.str.1 = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Johny-C/smartwatch-repo/refs/heads/master/drv_PICGraphic.c: 0x%s (%c)\00"
define void @drv_PICGraphic_send(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [3 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 2
store i8 0, i8* %7
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = call i32 @drv_generic_serial_write(i8* %8, i32 %9)
%11 = load i32, i32* %4
%12 = call i32 (i32, i8*, ...) @message(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 0, i32* %5
br label %13
13: ; preds = %39, %2
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = icmp ult i32 10, %15
br i1 %16, label %17, label %18
17: ; preds = %13
br label %20
18: ; preds = %13
%19 = load i32, i32* %4
br label %20
20: ; preds = %18, %17
%21 = phi i32 [ 10, %17 ], [ %19, %18 ]
%22 = icmp ult i32 %14, %21
br i1 %22, label %23, label %42
23: ; preds = %20
%24 = load i8*, i8** %3
%25 = load i32, i32* %5
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%30 = call i32 @convert2ASCII(i8 signext %28, i8* %29)
%31 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%32 = load i8*, i8** %3
%33 = load i32, i32* %5
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = call i32 (i32, i8*, ...) @message(i32 2, i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str.1, i64 0, i64 0), i8* %31, i32 %37)
br label %39
39: ; preds = %23
%40 = load i32, i32* %5
%41 = add i32 %40, 1
store i32 %41, i32* %5
br label %13
42: ; preds = %20
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"sending %d bytes: \00"
@.str.1 = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Johny-C/smartwatch-repo/refs/heads/master/drv_PICGraphic.c: 0x%s (%c)\00"
define void @drv_PICGraphic_send(i8* %0, i32 %1) {
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
store i8 0, i8* %5
%6 = tail call i32 @drv_generic_serial_write(i8* %0, i32 %1)
%7 = tail call i32 (i32, i8*, ...) @message(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
%8 = icmp ult i32 %1, 10
%9 = select i1 %8, i32 %1, i32 10
%10 = icmp eq i32 %9, 0
br i1 %10, label %23, label %11
11: ; preds = %2
%12 = zext i32 %9 to i64
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ 0, %11 ], [ %21, %13 ]
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = call i32 @convert2ASCII(i8 signext %16, i8* %4)
%18 = load i8, i8* %15
%19 = sext i8 %18 to i32
%20 = call i32 (i32, i8*, ...) @message(i32 2, i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %19)
%21 = add nuw nsw i64 %14, 1
%22 = icmp eq i64 %21, %12
br i1 %22, label %23, label %13
23: ; preds = %13, %2
ret void
}