#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*/ notesDurations;
typedef int /*<<< orphan*/ notes;

/* Variables and functions */
int biscSendByte(unsigned char);
int biscDefineSong(unsigned char songNum, unsigned char *notes,
                   unsigned char *notesDurations, unsigned int notesLen) {
  if (songNum > 15)
    return -1;
  if (sizeof(notes) != sizeof(notesDurations))
    return -1;
  if (notesLen <= 0 || notesLen > 16)
    return -1;
  if (biscSendByte(140) == -1)
    return -1;
  if (biscSendByte(songNum) == -1)
    return -1;
  if (biscSendByte(notesLen) == -1)
    return -1;
  for (unsigned int i = 0; i < notesLen; i++) {
    if (notes[i] < 31 || notes[i] > 127)
      return -1;
    if (biscSendByte(notes[i]) == -1)
      return -1;
    if (biscSendByte(notesDurations[i]) == -1)
      return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<biscDefineSong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0xf,%eax
jle    1142 <biscDefineSong+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    126a <biscDefineSong+0x15a>
cmpl   $0x0,-0x1c(%rbp)
jbe    1156 <biscDefineSong+0x46>
cmpl   $0x10,-0x1c(%rbp)
jbe    1162 <biscDefineSong+0x52>
movl   $0xffffffff,-0x4(%rbp)
jmp    126a <biscDefineSong+0x15a>
mov    $0x8c,%edi
call   1030 <biscSendByte@plt>
cmp    $0xffffffff,%eax
jne    1181 <biscDefineSong+0x71>
movl   $0xffffffff,-0x4(%rbp)
jmp    126a <biscDefineSong+0x15a>
movzbl -0x5(%rbp),%edi
call   1030 <biscSendByte@plt>
cmp    $0xffffffff,%eax
jne    119f <biscDefineSong+0x8f>
movl   $0xffffffff,-0x4(%rbp)
jmp    126a <biscDefineSong+0x15a>
mov    -0x1c(%rbp),%eax
movzbl %al,%edi
call   1030 <biscSendByte@plt>
cmp    $0xffffffff,%eax
jne    11bf <biscDefineSong+0xaf>
movl   $0xffffffff,-0x4(%rbp)
jmp    126a <biscDefineSong+0x15a>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    1263 <biscDefineSong+0x153>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
cmp    $0x1f,%eax
jl     11fa <biscDefineSong+0xea>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
cmp    $0x7f,%eax
jle    1206 <biscDefineSong+0xf6>
movl   $0xffffffff,-0x4(%rbp)
jmp    126a <biscDefineSong+0x15a>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
movzbl (%rax,%rcx,1),%edi
call   1030 <biscSendByte@plt>
cmp    $0xffffffff,%eax
jne    122b <biscDefineSong+0x11b>
movl   $0xffffffff,-0x4(%rbp)
jmp    126a <biscDefineSong+0x15a>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
movzbl (%rax,%rcx,1),%edi
call   1030 <biscSendByte@plt>
cmp    $0xffffffff,%eax
jne    1250 <biscDefineSong+0x140>
movl   $0xffffffff,-0x4(%rbp)
jmp    126a <biscDefineSong+0x15a>
jmp    1255 <biscDefineSong+0x145>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11c6 <biscDefineSong+0xb6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<biscDefineSong>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%ebp
mov    $0xffffffff,%r14d
cmp    $0xf,%bpl
ja     11a1 <biscDefineSong+0x91>
mov    %ecx,%ebx
lea    -0x11(%rbx),%eax
cmp    $0xfffffff0,%eax
jb     11a1 <biscDefineSong+0x91>
mov    %rdx,%r15
mov    %rsi,%r12
mov    $0x8c,%edi
call   1030 <biscSendByte@plt>
cmp    $0xffffffff,%eax
je     11a1 <biscDefineSong+0x91>
movzbl %bpl,%edi
call   1030 <biscSendByte@plt>
cmp    $0xffffffff,%eax
je     11a1 <biscDefineSong+0x91>
movzbl %bl,%edi
call   1030 <biscSendByte@plt>
cmp    $0xffffffff,%eax
je     11a1 <biscDefineSong+0x91>
mov    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%r12,%rbp,1),%eax
cmp    $0x1f,%al
jl     11a1 <biscDefineSong+0x91>
movzbl %al,%edi
call   1030 <biscSendByte@plt>
cmp    $0xffffffff,%eax
je     11a1 <biscDefineSong+0x91>
movzbl (%r15,%rbp,1),%edi
call   1030 <biscSendByte@plt>
cmp    $0xffffffff,%eax
je     11a1 <biscDefineSong+0x91>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1170 <biscDefineSong+0x60>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @biscDefineSong(i8 zeroext %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%11 = load i8, i8* %6
%12 = zext i8 %11 to i32
%13 = icmp sgt i32 %12, 15
br i1 %13, label %14, label %15
14: ; preds = %4
store i32 -1, i32* %5
br label %82
15: ; preds = %4
%16 = load i32, i32* %9
%17 = icmp ule i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %9
%20 = icmp ugt i32 %19, 16
br i1 %20, label %21, label %22
21: ; preds = %18, %15
store i32 -1, i32* %5
br label %82
22: ; preds = %18
%23 = call i32 @biscSendByte(i8 zeroext -116)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 -1, i32* %5
br label %82
26: ; preds = %22
%27 = load i8, i8* %6
%28 = call i32 @biscSendByte(i8 zeroext %27)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 -1, i32* %5
br label %82
31: ; preds = %26
%32 = load i32, i32* %9
%33 = trunc i32 %32 to i8
%34 = call i32 @biscSendByte(i8 zeroext %33)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %37
36: ; preds = %31
store i32 -1, i32* %5
br label %82
37: ; preds = %31
store i32 0, i32* %10
br label %38
38: ; preds = %78, %37
%39 = load i32, i32* %10
%40 = load i32, i32* %9
%41 = icmp ult i32 %39, %40
br i1 %41, label %42, label %81
42: ; preds = %38
%43 = load i8*, i8** %7
%44 = load i32, i32* %10
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = icmp slt i32 %48, 31
br i1 %49, label %58, label %50
50: ; preds = %42
%51 = load i8*, i8** %7
%52 = load i32, i32* %10
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
%56 = zext i8 %55 to i32
%57 = icmp sgt i32 %56, 127
br i1 %57, label %58, label %59
58: ; preds = %50, %42
store i32 -1, i32* %5
br label %82
59: ; preds = %50
%60 = load i8*, i8** %7
%61 = load i32, i32* %10
%62 = zext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %60, i64 %62
%64 = load i8, i8* %63
%65 = call i32 @biscSendByte(i8 zeroext %64)
%66 = icmp eq i32 %65, -1
br i1 %66, label %67, label %68
67: ; preds = %59
store i32 -1, i32* %5
br label %82
68: ; preds = %59
%69 = load i8*, i8** %8
%70 = load i32, i32* %10
%71 = zext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %69, i64 %71
%73 = load i8, i8* %72
%74 = call i32 @biscSendByte(i8 zeroext %73)
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %77
76: ; preds = %68
store i32 -1, i32* %5
br label %82
77: ; preds = %68
br label %78
78: ; preds = %77
%79 = load i32, i32* %10
%80 = add i32 %79, 1
store i32 %80, i32* %10
br label %38
81: ; preds = %38
store i32 0, i32* %5
br label %82
82: ; preds = %81, %76, %67, %58, %36, %30, %25, %21, %14
%83 = load i32, i32* %5
ret i32 %83
}

LLVM IR (-O2):
define i32 @biscDefineSong(i8 zeroext %0, i8* nocapture %1, i8* nocapture %2, i32 %3) {
%5 = icmp ugt i8 %0, 15
%6 = add i32 %3, -17
%7 = icmp ult i32 %6, -16
%8 = or i1 %5, %7
br i1 %8, label %37, label %9
9: ; preds = %4
%10 = tail call i32 @biscSendByte(i8 zeroext -116)
%11 = icmp eq i32 %10, -1
br i1 %11, label %37, label %12
12: ; preds = %9
%13 = tail call i32 @biscSendByte(i8 zeroext %0)
%14 = icmp eq i32 %13, -1
br i1 %14, label %37, label %15
15: ; preds = %12
%16 = trunc i32 %3 to i8
%17 = tail call i32 @biscSendByte(i8 zeroext %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %37, label %19
19: ; preds = %15
%20 = zext i32 %3 to i64
br label %23
21: ; preds = %31
%22 = icmp eq i64 %36, %20
br i1 %22, label %37, label %23
23: ; preds = %19, %21
%24 = phi i64 [ 0, %19 ], [ %36, %21 ]
%25 = getelementptr inbounds i8, i8* %1, i64 %24
%26 = load i8, i8* %25
%27 = icmp slt i8 %26, 31
br i1 %27, label %37, label %28
28: ; preds = %23
%29 = tail call i32 @biscSendByte(i8 zeroext %26)
%30 = icmp eq i32 %29, -1
br i1 %30, label %37, label %31
31: ; preds = %28
%32 = getelementptr inbounds i8, i8* %2, i64 %24
%33 = load i8, i8* %32
%34 = tail call i32 @biscSendByte(i8 zeroext %33)
%35 = icmp eq i32 %34, -1
%36 = add nuw nsw i64 %24, 1
br i1 %35, label %37, label %21
37: ; preds = %31, %28, %23, %21, %15, %12, %9, %4
%38 = phi i32 [ -1, %4 ], [ -1, %9 ], [ -1, %12 ], [ -1, %15 ], [ -1, %31 ], [ -1, %28 ], [ -1, %23 ], [ 0, %21 ]
ret i32 %38
}