#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 getDisplay(unsigned char *);
void *malloc(int);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strncpy(char *, unsigned char *, int);
int /*<<< orphan*/ strtol(char *, char **, int);
int main() {
  unsigned char sysEx[] = {0xF0, 0x00, 0x00, 0x66, 0x00, 0x12, 0X57, 0x4C,
                           0x35, 0x31, 0x52, 0x34, 0x39, 0x20, 0xF7};
  char *ptr;
  char *readable = sysEx + 7;
  strtol(readable, &ptr, 10);
  printf("String part is |%s|\n", ptr);
  printf("offset |0x%x : %d |", sysEx[6], sysEx[6]);
  printf("Display |%d|", getDisplay(sysEx));
  struct channel {
    char *trackName;
    char *displayLine1;
    char *displayLine2;
    char *assign;
    char *faderLevel;
    int leftPan;
    int rightPan;
  };
  struct channel oledDisplay1;
  oledDisplay1.displayLine1 = malloc(7);
  strncpy(oledDisplay1.displayLine1, sysEx + 7, 7);
  printf("\n oledDisplay1.displayLine1 :  |%s|  \n", oledDisplay1.displayLine1);
  printf("\n -------Handle a big sysEx data -------------- \n");
  unsigned char bigSysEx[] = {
      0xF0, 0x00, 0x00, 0x66, 0x00, 0x12, 0X57, 0x4C, 0x35, 0x31, 0x52, 0x34,
      0x39, 0x20, 0xF7, 0xF0, 0x00, 0x00, 0x66, 0x00, 0x12, 0x00, 0x4C, 0x34,
      0x32, 0x52, 0x50, 0x59, 0x20, 0xF7, 0xF0, 0x00, 0x00, 0x66, 0x00, 0x12,
      0x00, 0x4C, 0x35, 0x30, 0x52, 0x50, 0x59, 0x39, 0x39, 0xF7};
  int buffersize = 46;
  int i = 0;
  int start = 0;
  int frameCpt = 0;
  typedef struct {
    int start;
    int size;
    unsigned char *data;
  } t_frame;
  t_frame *frames;
  frames = malloc(3 * sizeof(t_frame));
  while (i < buffersize) {
    if (bigSysEx[i] == 0xF0) {
      frames[frameCpt].start = i;
      frameCpt++;
    }
    if (bigSysEx[i] == 0xF7) {
      frames[frameCpt - 1].size = 1 + i - start;
      frames[frameCpt - 1].data = malloc(frames[frameCpt - 1].size);
      memcpy(frames[frameCpt - 1].data, bigSysEx + frames[frameCpt - 1].start,
             frames[frameCpt - 1].size);
      printf(" Frame #%d |   start=%d  i=%d   \n", frameCpt, start, i);
      start = i + 1;
    }
    i++;
  }
  printf("\n --------------------- \n");
  int j = 0;
  for (j = 0; j < frameCpt; j++) {
    printf("|%d (size:%d)| %s|  \n", j, frames[j].size, frames[j].data + 7);
  }
  printf("\n --------------------- \n ");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe87(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xe85(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xe7f(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xe77(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x13(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    -0x20(%rbp),%rsi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movzbl -0xd(%rbp),%esi
movzbl -0xd(%rbp),%edx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x13(%rbp),%rdi
call   1050 <getDisplay@plt>
mov    %eax,%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x7,%edi
call   1080 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
lea    -0x13(%rbp),%rsi
add    $0x7,%rsi
mov    $0x7,%edx
call   1030 <strncpy@plt>
mov    -0x50(%rbp),%rsi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rdi
lea    0xdc5(%rip),%rsi
mov    $0x2e,%edx
call   1070 <memcpy@plt>
movl   $0x2e,-0x94(%rbp)
movl   $0x0,-0x98(%rbp)
movl   $0x0,-0x9c(%rbp)
movl   $0x0,-0xa0(%rbp)
mov    $0x30,%edi
call   1080 <malloc@plt>
mov    %rax,-0xa8(%rbp)
mov    -0x98(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    1419 <main+0x2b9>
movslq -0x98(%rbp),%rax
movzbl -0x90(%rbp,%rax,1),%eax
ff
cmp    $0xf0,%eax
jne    12e6 <main+0x186>
mov    -0x98(%rbp),%ecx
mov    -0xa8(%rbp),%rax
movslq -0xa0(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rax
mov    %ecx,(%rax)
mov    -0xa0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
movslq -0x98(%rbp),%rax
movzbl -0x90(%rbp,%rax,1),%eax
ff
cmp    $0xf7,%eax
jne    1405 <main+0x2a5>
mov    -0x98(%rbp),%ecx
add    $0x1,%ecx
sub    -0x9c(%rbp),%ecx
mov    -0xa8(%rbp),%rax
mov    -0xa0(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
shl    $0x4,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
mov    -0xa8(%rbp),%rax
mov    -0xa0(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edi
call   1080 <malloc@plt>
mov    %rax,%rcx
mov    -0xa8(%rbp),%rax
mov    -0xa0(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
shl    $0x4,%rdx
add    %rdx,%rax
mov    %rcx,0x8(%rax)
mov    -0xa8(%rbp),%rax
mov    -0xa0(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rdi
lea    -0x90(%rbp),%rsi
mov    -0xa8(%rbp),%rax
mov    -0xa0(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq (%rax),%rax
add    %rax,%rsi
mov    -0xa8(%rbp),%rax
mov    -0xa0(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edx
call   1070 <memcpy@plt>
mov    -0xa0(%rbp),%esi
mov    -0x9c(%rbp),%edx
mov    -0x98(%rbp),%ecx
lea    0xcde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    128e <main+0x12e>
lea    0xccf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xac(%rbp)
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0xa0(%rbp),%eax
jge    14aa <main+0x34a>
mov    -0xac(%rbp),%esi
mov    -0xa8(%rbp),%rax
movslq -0xac(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edx
mov    -0xa8(%rbp),%rax
movslq -0xac(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rcx
add    $0x7,%rcx
lea    0xc7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    143b <main+0x2db>
lea    0xc6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movabs $0xf72039345231354c,%rax
39 20 f7
mov    %rax,0xf(%rsp)
movabs $0x4c571200660000f0,%rax
12 57 4c
mov    %rax,0x8(%rsp)
lea    0xf(%rsp),%rbx
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    0x18(%rsp),%rsi
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0xe(%rsp),%edx
lea    0xe81(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rdi
call   1060 <getDisplay@plt>
lea    0xe7b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7,%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
mov    $0x7,%edx
call   1030 <strncpy@plt>
lea    0xe5b(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
movups 0xdf8(%rip),%xmm0
movups %xmm0,0x3e(%rsp)
movaps 0xdde(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xdc2(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    $0x30,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    $0xf0,%al
mov    $0x1,%r15d
xor    %r12d,%r12d
xor    %r14d,%r14d
xor    %ecx,%ecx
cmp    $0xf7,%al
je     12a0 <main+0x130>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0xf0,%al
jne    1293 <main+0x123>
movslq %r14d,%rax
shl    $0x4,%rax
mov    %r12d,(%rbx,%rax,1)
add    $0x1,%r14d
cmp    $0x2e,%r15
jne    1305 <main+0x195>
jmp    131c <main+0x1ac>
xchg   %ax,%ax
mov    %r15d,%ebp
sub    %ecx,%ebp
mov    %r14d,(%rsp)
movslq (%rsp),%r14
mov    %r14,%r13
shl    $0x4,%r13
mov    %ebp,-0xc(%r13,%rbx,1)
mov    %ebp,%edi
mov    %ecx,0x4(%rsp)
call   1090 <malloc@plt>
mov    %rax,-0x8(%r13,%rbx,1)
movslq -0x10(%r13,%rbx,1),%rcx
lea    (%rsp,%rcx,1),%rsi
add    $0x20,%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1080 <memcpy@plt>
lea    0xdb4(%rip),%rdi
mov    %r14d,%esi
mov    (%rsp),%r14d
mov    0x4(%rsp),%edx
mov    %r12d,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15d,%ecx
cmp    $0x2e,%r15
je     131c <main+0x1ac>
mov    0x20(%rsp,%r15,1),%al
add    $0x1,%r15
add    $0x1,%r12d
cmp    $0xf7,%al
jne    1280 <main+0x110>
jmp    12a0 <main+0x130>
lea    0xdfc(%rip),%rdi
call   1040 <puts@plt>
test   %r14d,%r14d
jle    1363 <main+0x1f3>
mov    %r14d,%r15d
add    $0x8,%rbx
lea    0xd82(%rip),%r14
xor    %ebp,%ebp
nopl   (%rax)
mov    -0x4(%rbx),%edx
mov    (%rbx),%rcx
add    $0x7,%rcx
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
add    $0x10,%rbx
cmp    %rbp,%r15
jne    1340 <main+0x1d0>
lea    0xd69(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.channel = type { i8*, i8*, i8*, i8*, i8*, i32, i32 }
%struct.t_frame = type { i32, i32, i8* }
@__const.main.sysEx = [15 x i8] c"\F0\00\00f\00\12WL51R49 \F7"
@.str = [21 x i8] c"String part is |%s|\0A\00"
@.str.1 = [20 x i8] c"offset |0x%x : %d |\00"
@.str.2 = [13 x i8] c"Display |%d|\00"
@.str.3 = [39 x i8] c"\0A oledDisplay1.displayLine1 : |%s| \0A\00"
@.str.4 = [50 x i8] c"\0A -------Handle a big sysEx data -------------- \0A\00"
@__const.main.bigSysEx = [46 x i8] c"\F0\00\00f\00\12WL51R49 \F7\F0\00\00f\00\12\00L42RPY \F7\F0\00\00f\00\12\00L50RPY99\F7"
@.str.5 = [34 x i8] c" Frame #%d | start=%d i=%d \0A\00"
@.str.6 = [26 x i8] c"\0A --------------------- \0A\00"
@.str.7 = [22 x i8] c"|%d (size:%d)| %s| \0A\00"
@.str.8 = [27 x i8] c"\0A --------------------- \0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.channel
%6 = alloca [46 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.t_frame*
%12 = alloca i32
store i32 0, i32* %1
%13 = bitcast [15 x i8]* %2 to i8*
%14 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds i8, i8* %14, i64 7
store i8* %15, i8** %4
%16 = load i8*, i8** %4
%17 = call i32 @strtol(i8* %16, i8** %3, i32 10)
%18 = load i8*, i8** %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 6
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 6
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %25)
%27 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%28 = call i32 @getDisplay(i8* %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = call i8* @malloc(i32 7)
%31 = getelementptr inbounds %struct.channel, %struct.channel* %5, i32 0, i32 1
store i8* %30, i8** %31
%32 = getelementptr inbounds %struct.channel, %struct.channel* %5, i32 0, i32 1
%33 = load i8*, i8** %32
%34 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%35 = getelementptr inbounds i8, i8* %34, i64 7
%36 = call i32 @strncpy(i8* %33, i8* %35, i32 7)
%37 = getelementptr inbounds %struct.channel, %struct.channel* %5, i32 0, i32 1
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
%41 = bitcast [46 x i8]* %6 to i8*
store i32 46, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%42 = call i8* @malloc(i32 48)
%43 = bitcast i8* %42 to %struct.t_frame*
store %struct.t_frame* %43, %struct.t_frame** %11
br label %44
44: ; preds = %127, %0
%45 = load i32, i32* %8
%46 = load i32, i32* %7
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %130
48: ; preds = %44
%49 = load i32, i32* %8
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [46 x i8], [46 x i8]* %6, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = icmp eq i32 %53, 240
br i1 %54, label %55, label %64
55: ; preds = %48
%56 = load i32, i32* %8
%57 = load %struct.t_frame*, %struct.t_frame** %11
%58 = load i32, i32* %10
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %57, i64 %59
%61 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %60, i32 0, i32 0
store i32 %56, i32* %61
%62 = load i32, i32* %10
%63 = add nsw i32 %62, 1
store i32 %63, i32* %10
br label %64
64: ; preds = %55, %48
%65 = load i32, i32* %8
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [46 x i8], [46 x i8]* %6, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = zext i8 %68 to i32
%70 = icmp eq i32 %69, 247
br i1 %70, label %71, label %127
71: ; preds = %64
%72 = load i32, i32* %8
%73 = add nsw i32 1, %72
%74 = load i32, i32* %9
%75 = sub nsw i32 %73, %74
%76 = load %struct.t_frame*, %struct.t_frame** %11
%77 = load i32, i32* %10
%78 = sub nsw i32 %77, 1
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %76, i64 %79
%81 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %80, i32 0, i32 1
store i32 %75, i32* %81
%82 = load %struct.t_frame*, %struct.t_frame** %11
%83 = load i32, i32* %10
%84 = sub nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %82, i64 %85
%87 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %86, i32 0, i32 1
%88 = load i32, i32* %87
%89 = call i8* @malloc(i32 %88)
%90 = load %struct.t_frame*, %struct.t_frame** %11
%91 = load i32, i32* %10
%92 = sub nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %90, i64 %93
%95 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %94, i32 0, i32 2
store i8* %89, i8** %95
%96 = load %struct.t_frame*, %struct.t_frame** %11
%97 = load i32, i32* %10
%98 = sub nsw i32 %97, 1
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %96, i64 %99
%101 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %100, i32 0, i32 2
%102 = load i8*, i8** %101
%103 = getelementptr inbounds [46 x i8], [46 x i8]* %6, i64 0, i64 0
%104 = load %struct.t_frame*, %struct.t_frame** %11
%105 = load i32, i32* %10
%106 = sub nsw i32 %105, 1
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %104, i64 %107
%109 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %108, i32 0, i32 0
%110 = load i32, i32* %109
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8, i8* %103, i64 %111
%113 = load %struct.t_frame*, %struct.t_frame** %11
%114 = load i32, i32* %10
%115 = sub nsw i32 %114, 1
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %113, i64 %116
%118 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %117, i32 0, i32 1
%119 = load i32, i32* %118
%120 = call i32 @memcpy(i8* %102, i8* %112, i32 %119)
%121 = load i32, i32* %10
%122 = load i32, i32* %9
%123 = load i32, i32* %8
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i32 %121, i32 %122, i32 %123)
%125 = load i32, i32* %8
%126 = add nsw i32 %125, 1
store i32 %126, i32* %9
br label %127
127: ; preds = %71, %64
%128 = load i32, i32* %8
%129 = add nsw i32 %128, 1
store i32 %129, i32* %8
br label %44
130: ; preds = %44
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %12
store i32 0, i32* %12
br label %132
132: ; preds = %152, %130
%133 = load i32, i32* %12
%134 = load i32, i32* %10
%135 = icmp slt i32 %133, %134
br i1 %135, label %136, label %155
136: ; preds = %132
%137 = load i32, i32* %12
%138 = load %struct.t_frame*, %struct.t_frame** %11
%139 = load i32, i32* %12
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %138, i64 %140
%142 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %141, i32 0, i32 1
%143 = load i32, i32* %142
%144 = load %struct.t_frame*, %struct.t_frame** %11
%145 = load i32, i32* %12
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %144, i64 %146
%148 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %147, i32 0, i32 2
%149 = load i8*, i8** %148
%150 = getelementptr inbounds i8, i8* %149, i64 7
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %137, i32 %143, i8* %150)
br label %152
152: ; preds = %136
%153 = load i32, i32* %12
%154 = add nsw i32 %153, 1
store i32 %154, i32* %12
br label %132
155: ; preds = %132
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.t_frame = type { i32, i32, i8* }
@__const.main.sysEx = [15 x i8] c"\F0\00\00f\00\12WL51R49 \F7"
@.str = [21 x i8] c"String part is |%s|\0A\00"
@.str.1 = [20 x i8] c"offset |0x%x : %d |\00"
@.str.2 = [13 x i8] c"Display |%d|\00"
@.str.3 = [39 x i8] c"\0A oledDisplay1.displayLine1 : |%s| \0A\00"
@__const.main.bigSysEx = [46 x i8] c"\F0\00\00f\00\12WL51R49 \F7\F0\00\00f\00\12\00L42RPY \F7\F0\00\00f\00\12\00L50RPY99\F7"
@.str.5 = [34 x i8] c" Frame #%d | start=%d i=%d \0A\00"
@.str.7 = [22 x i8] c"|%d (size:%d)| %s| \0A\00"
@.str.8 = [27 x i8] c"\0A --------------------- \0A \00"
@str = [49 x i8] c"\0A -------Handle a big sysEx data -------------- \00"
@str.9 = [25 x i8] c"\0A --------------------- \00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca i8*
%3 = alloca [46 x i8]
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%5 = bitcast i8** %2 to i8*
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 7
%7 = call i32 @strtol(i8* %6, i8** %2, i32 10)
%8 = load i8*, i8** %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 6
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %12)
%14 = call i32 @getDisplay(i8* %4)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = call dereferenceable_or_null(7) i8* @malloc(i32 7)
%17 = call i32 @strncpy(i8* %16, i8* %6, i32 7)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%20 = getelementptr inbounds [46 x i8], [46 x i8]* %3, i64 0, i64 0
%21 = call dereferenceable_or_null(48) i8* @malloc(i32 48)
%22 = bitcast i8* %21 to %struct.t_frame*
br label %23
23: ; preds = %54, %0
%24 = phi i8 [ -16, %0 ], [ %56, %54 ]
%25 = phi i64 [ 0, %0 ], [ %52, %54 ]
%26 = phi i32 [ 0, %0 ], [ %50, %54 ]
%27 = phi i32 [ 0, %0 ], [ %51, %54 ]
switch i8 %24, label %49 [
i8 -16, label %28
i8 -9, label %33
]
28: ; preds = %23
%29 = sext i32 %26 to i64
%30 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %22, i64 %29, i32 0
%31 = trunc i64 %25 to i32
store i32 %31, i32* %30
%32 = add nsw i32 %26, 1
br label %49
33: ; preds = %23
%34 = trunc i64 %25 to i32
%35 = add i32 %34, 1
%36 = sub nsw i32 %35, %27
%37 = add nsw i32 %26, -1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %22, i64 %38, i32 1
store i32 %36, i32* %39
%40 = call i8* @malloc(i32 %36)
%41 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %22, i64 %38, i32 2
store i8* %40, i8** %41
%42 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %22, i64 %38, i32 0
%43 = load i32, i32* %42
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [46 x i8], [46 x i8]* %3, i64 0, i64 %44
%46 = call i32 @memcpy(i8* %40, i8* %45, i32 %36)
%47 = trunc i64 %25 to i32
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i32 %26, i32 %27, i32 %47)
br label %49
49: ; preds = %23, %28, %33
%50 = phi i32 [ %26, %33 ], [ %32, %28 ], [ %26, %23 ]
%51 = phi i32 [ %35, %33 ], [ %27, %28 ], [ %27, %23 ]
%52 = add nuw nsw i64 %25, 1
%53 = icmp eq i64 %52, 46
br i1 %53, label %57, label %54
54: ; preds = %49
%55 = getelementptr inbounds [46 x i8], [46 x i8]* %3, i64 0, i64 %52
%56 = load i8, i8* %55
br label %23
57: ; preds = %49
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.9, i64 0, i64 0))
%59 = icmp sgt i32 %50, 0
br i1 %59, label %60, label %73
60: ; preds = %57
%61 = zext i32 %50 to i64
br label %62
62: ; preds = %60, %62
%63 = phi i64 [ 0, %60 ], [ %71, %62 ]
%64 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %22, i64 %63, i32 1
%65 = load i32, i32* %64
%66 = getelementptr inbounds %struct.t_frame, %struct.t_frame* %22, i64 %63, i32 2
%67 = load i8*, i8** %66
%68 = getelementptr inbounds i8, i8* %67, i64 7
%69 = trunc i64 %63 to i32
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %69, i32 %65, i8* %68)
%71 = add nuw nsw i64 %63, 1
%72 = icmp eq i64 %71, %61
br i1 %72, label %73, label %62
73: ; preds = %62, %57
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}