#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*/ sn3218_lcd_raw(char *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
int /*<<< orphan*/ strncat(char *, char *, int);
void backlight_array(int LED[5][2]) {
  char v[60], vt[10];
  int i, j;
  v[0] = '\0';
  for (i = 0; i <= 5; i++) {
    sprintf(vt, "%02X%02X%02X", LED[i][2], LED[i][1], LED[i][0]);
    strncat(v, vt, 6);
  }
  sn3218_lcd_raw(v);
}


x86 assembly (clang, -O0):
<backlight_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x50(%rbp)
movl   $0x0,-0x60(%rbp)
cmpl   $0x5,-0x60(%rbp)
jg     11a5 <backlight_array+0x75>
lea    -0x5a(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    0x8(%rax,%rcx,8),%edx
mov    -0x8(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    0x4(%rax,%rcx,8),%ecx
mov    -0x8(%rbp),%rax
movslq -0x60(%rbp),%rsi
mov    (%rax,%rsi,8),%r8d
lea    0xe80(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x50(%rbp),%rdi
lea    -0x5a(%rbp),%rsi
mov    $0x6,%edx
call   1040 <strncat@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1147 <backlight_array+0x17>
lea    -0x50(%rbp),%rdi
call   1030 <sn3218_lcd_raw@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<backlight_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%rbx
movb   $0x0,0x10(%rsp)
mov    0x8(%rdi),%edx
mov    (%rdi),%r8d
mov    0x4(%rdi),%ecx
lea    0xead(%rip),%r12
lea    0x6(%rsp),%r14
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1040 <strncat@plt>
mov    0x10(%rbx),%edx
mov    0x8(%rbx),%r8d
mov    0xc(%rbx),%ecx
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <sprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1040 <strncat@plt>
mov    0x18(%rbx),%edx
mov    0x10(%rbx),%r8d
mov    0x14(%rbx),%ecx
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <sprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1040 <strncat@plt>
mov    0x20(%rbx),%edx
mov    0x18(%rbx),%r8d
mov    0x1c(%rbx),%ecx
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <sprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1040 <strncat@plt>
mov    0x28(%rbx),%edx
mov    0x20(%rbx),%r8d
mov    0x24(%rbx),%ecx
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <sprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1040 <strncat@plt>
mov    0x30(%rbx),%edx
mov    0x28(%rbx),%r8d
mov    0x2c(%rbx),%ecx
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <sprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1040 <strncat@plt>
mov    %r15,%rdi
call   1030 <sn3218_lcd_raw@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%02X%02X%02X\00"
define void @backlight_array([2 x i32]* %0) {
%2 = alloca [2 x i32]*
%3 = alloca [60 x i8]
%4 = alloca [10 x i8]
%5 = alloca i32
%6 = alloca i32
store [2 x i32]* %0, [2 x i32]** %2
%7 = getelementptr inbounds [60 x i8], [60 x i8]* %3, i64 0, i64 0
store i8 0, i8* %7
store i32 0, i32* %5
br label %8
8: ; preds = %35, %1
%9 = load i32, i32* %5
%10 = icmp sle i32 %9, 5
br i1 %10, label %11, label %38
11: ; preds = %8
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%13 = load [2 x i32]*, [2 x i32]** %2
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 %15
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %16, i64 0, i64 2
%18 = load i32, i32* %17
%19 = load [2 x i32]*, [2 x i32]** %2
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %19, i64 %21
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %22, i64 0, i64 1
%24 = load i32, i32* %23
%25 = load [2 x i32]*, [2 x i32]** %2
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %25, i64 %27
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %28, i64 0, i64 0
%30 = load i32, i32* %29
%31 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %24, i32 %30)
%32 = getelementptr inbounds [60 x i8], [60 x i8]* %3, i64 0, i64 0
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%34 = call i32 @strncat(i8* %32, i8* %33, i32 6)
br label %35
35: ; preds = %11
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %8
38: ; preds = %8
%39 = getelementptr inbounds [60 x i8], [60 x i8]* %3, i64 0, i64 0
%40 = call i32 @sn3218_lcd_raw(i8* %39)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%02X%02X%02X\00"
define void @backlight_array([2 x i32]* nocapture %0) {
%2 = alloca [60 x i8]
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
store i8 0, i8* %4
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 0, i64 2
%7 = load i32, i32* %6
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 0, i64 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 0, i64 0
%11 = load i32, i32* %10
%12 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9, i32 %11)
%13 = call i32 @strncat(i8* %4, i8* %5, i32 6)
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 1, i64 2
%15 = load i32, i32* %14
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 1, i64 1
%17 = load i32, i32* %16
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 1, i64 0
%19 = load i32, i32* %18
%20 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %17, i32 %19)
%21 = call i32 @strncat(i8* %4, i8* %5, i32 6)
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 2, i64 2
%23 = load i32, i32* %22
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 2, i64 1
%25 = load i32, i32* %24
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 2, i64 0
%27 = load i32, i32* %26
%28 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %25, i32 %27)
%29 = call i32 @strncat(i8* %4, i8* %5, i32 6)
%30 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 3, i64 2
%31 = load i32, i32* %30
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 3, i64 1
%33 = load i32, i32* %32
%34 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 3, i64 0
%35 = load i32, i32* %34
%36 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %31, i32 %33, i32 %35)
%37 = call i32 @strncat(i8* %4, i8* %5, i32 6)
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 4, i64 2
%39 = load i32, i32* %38
%40 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 4, i64 1
%41 = load i32, i32* %40
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 4, i64 0
%43 = load i32, i32* %42
%44 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %39, i32 %41, i32 %43)
%45 = call i32 @strncat(i8* %4, i8* %5, i32 6)
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 5, i64 2
%47 = load i32, i32* %46
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 5, i64 1
%49 = load i32, i32* %48
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %0, i64 5, i64 0
%51 = load i32, i32* %50
%52 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %47, i32 %49, i32 %51)
%53 = call i32 @strncat(i8* %4, i8* %5, i32 6)
%54 = call i32 @sn3218_lcd_raw(i8* %4)
ret void
}