#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*/ TestEmbedBit(char, char *, int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
void TestEmbedChars() {
  char test1[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  char test2[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
  char teststr1[] = {0, 0};
  char teststr2[] = {0xff, 0};
  char teststr3[] = "I";
  char result1[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  char result2[] = {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
  char result3[] = {0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE};
  char result4[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
  char result5[] = {0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01};
  char result6[] = {0xff, 0xfe, 0xfe, 0xff, 0xfe, 0xfe, 0xff, 0xfe, 0xff};
  printf("\n");
  printf("------------------------------\n");
  printf("Test Embed char functions\n");
  printf("------------------------------\n");
  TestEmbedBit(0x00, test1, 9, 0, result1);
  TestEmbedBit(0xFF, test1, 9, 0, result2);
  TestEmbedBit(0x00, test2, 9, 0, result3);
  TestEmbedBit(0xFF, test2, 9, 0, result4);
  TestEmbedBit('I', test1, 9, 0, result5);
  TestEmbedBit('I', test2, 9, 0, result6);
  printf("------------------------------\n");
  printf("Done\n");
  printf("------------------------------\n");
}


x86 assembly (clang, -O0):
<TestEmbedChars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x9(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1040 <memset@plt>
mov    0xeb1(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xeaf(%rip),%al
mov    %al,-0xa(%rbp)
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <memset@plt>
mov    0xec3(%rip),%ax
mov    %ax,-0x16(%rbp)
mov    0xeba(%rip),%ax
mov    %ax,-0x18(%rbp)
lea    -0x21(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1040 <memset@plt>
mov    0xe70(%rip),%rax
mov    %rax,-0x2a(%rbp)
mov    0xe6e(%rip),%al
mov    %al,-0x22(%rbp)
mov    0xe65(%rip),%rax
mov    %rax,-0x33(%rbp)
mov    0xe63(%rip),%al
mov    %al,-0x2b(%rbp)
mov    0xe5a(%rip),%rax
mov    %rax,-0x3c(%rbp)
mov    0xe58(%rip),%al
mov    %al,-0x34(%rbp)
mov    0xe4f(%rip),%rax
mov    %rax,-0x45(%rbp)
mov    0xe4d(%rip),%al
mov    %al,-0x3d(%rbp)
mov    0xe44(%rip),%rax
mov    %rax,-0x4e(%rbp)
mov    0xe42(%rip),%al
mov    %al,-0x46(%rbp)
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
lea    0xe19(%rip),%rdi
call   1030 <printf@plt>
lea    -0x9(%rbp),%rsi
lea    -0x21(%rbp),%r8
xor    %ecx,%ecx
mov    $0x9,%edx
mov    %ecx,%edi
call   1050 <TestEmbedBit@plt>
lea    -0x9(%rbp),%rsi
lea    -0x2a(%rbp),%r8
mov    $0xffffffff,%edi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1050 <TestEmbedBit@plt>
lea    -0x12(%rbp),%rsi
lea    -0x33(%rbp),%r8
xor    %ecx,%ecx
mov    $0x9,%edx
mov    %ecx,%edi
call   1050 <TestEmbedBit@plt>
lea    -0x12(%rbp),%rsi
lea    -0x3c(%rbp),%r8
mov    $0xffffffff,%edi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1050 <TestEmbedBit@plt>
lea    -0x9(%rbp),%rsi
lea    -0x45(%rbp),%r8
mov    $0x49,%edi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1050 <TestEmbedBit@plt>
lea    -0x12(%rbp),%rsi
lea    -0x4e(%rbp),%r8
mov    $0x49,%edi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1050 <TestEmbedBit@plt>
lea    0xd7d(%rip),%rdi
call   1030 <printf@plt>
lea    0xdac(%rip),%rdi
call   1030 <printf@plt>
lea    0xd65(%rip),%rdi
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestEmbedChars>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
movb   $0x0,0x78(%rsp)
movq   $0x0,0x70(%rsp)
movb   $0xff,0x68(%rsp)
movq   $0xffffffffffffffff,0x60(%rsp)
ff ff
movb   $0x0,0x58(%rsp)
movq   $0x0,0x50(%rsp)
movabs $0x101010101010101,%rax
01 01 01
mov    %rax,0x40(%rsp)
movb   $0x1,0x48(%rsp)
movabs $0xfefefefefefefefe,%rax
fe fe fe
mov    %rax,0x30(%rsp)
movb   $0xfe,0x38(%rsp)
movb   $0xff,0x28(%rsp)
movq   $0xffffffffffffffff,0x20(%rsp)
ff ff
movabs $0x1000001000001,%rax
mov    %rax,0x10(%rsp)
movb   $0x1,0x18(%rsp)
movabs $0xfefffefefffefeff,%rax
fe ff fe
mov    %rax,(%rsp)
movb   $0xff,0x8(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe5d(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xe2f(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0x70(%rsp),%r15
lea    0x50(%rsp),%r8
xor    %edi,%edi
mov    %r15,%rsi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1050 <TestEmbedBit@plt>
lea    0x40(%rsp),%r8
mov    $0xffffffff,%edi
mov    %r15,%rsi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1050 <TestEmbedBit@plt>
lea    0x60(%rsp),%rbx
lea    0x30(%rsp),%r8
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1050 <TestEmbedBit@plt>
lea    0x20(%rsp),%r8
mov    $0xffffffff,%edi
mov    %rbx,%rsi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1050 <TestEmbedBit@plt>
lea    0x10(%rsp),%r8
mov    $0x49,%edi
mov    %r15,%rsi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1050 <TestEmbedBit@plt>
mov    %rsp,%r8
mov    $0x49,%edi
mov    %rbx,%rsi
mov    $0x9,%edx
xor    %ecx,%ecx
call   1050 <TestEmbedBit@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xd95(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.TestEmbedChars.test2 = [9 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\FF"
@__const.TestEmbedChars.teststr2 = [2 x i8] c"\FF\00"
@__const.TestEmbedChars.teststr3 = [2 x i8] c"I\00"
@__const.TestEmbedChars.result2 = [9 x i8] c"\01\01\01\01\01\01\01\01\01"
@__const.TestEmbedChars.result3 = [9 x i8] c"\FE\FE\FE\FE\FE\FE\FE\FE\FE"
@__const.TestEmbedChars.result4 = [9 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\FF"
@__const.TestEmbedChars.result5 = [9 x i8] c"\01\00\00\01\00\00\01\00\01"
@__const.TestEmbedChars.result6 = [9 x i8] c"\FF\FE\FE\FF\FE\FE\FF\FE\FF"
@.str = [2 x i8] c"\0A\00"
@.str.1 = [32 x i8] c"------------------------------\0A\00"
@.str.2 = [27 x i8] c"Test Embed char functions\0A\00"
@.str.3 = [6 x i8] c"Done\0A\00"
define void @TestEmbedChars() {
%1 = alloca [9 x i8]
%2 = alloca [9 x i8]
%3 = alloca [2 x i8]
%4 = alloca [2 x i8]
%5 = alloca [2 x i8]
%6 = alloca [9 x i8]
%7 = alloca [9 x i8]
%8 = alloca [9 x i8]
%9 = alloca [9 x i8]
%10 = alloca [9 x i8]
%11 = alloca [9 x i8]
%12 = bitcast [9 x i8]* %1 to i8*
%13 = bitcast [9 x i8]* %2 to i8*
%14 = bitcast [2 x i8]* %3 to i8*
%15 = bitcast [2 x i8]* %4 to i8*
%16 = bitcast [2 x i8]* %5 to i8*
%17 = bitcast [9 x i8]* %6 to i8*
%18 = bitcast [9 x i8]* %7 to i8*
%19 = bitcast [9 x i8]* %8 to i8*
%20 = bitcast [9 x i8]* %9 to i8*
%21 = bitcast [9 x i8]* %10 to i8*
%22 = bitcast [9 x i8]* %11 to i8*
%23 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%27 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%28 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%29 = call i32 @TestEmbedBit(i8 signext 0, i8* %27, i32 9, i32 0, i8* %28)
%30 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%31 = getelementptr inbounds [9 x i8], [9 x i8]* %7, i64 0, i64 0
%32 = call i32 @TestEmbedBit(i8 signext -1, i8* %30, i32 9, i32 0, i8* %31)
%33 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%34 = getelementptr inbounds [9 x i8], [9 x i8]* %8, i64 0, i64 0
%35 = call i32 @TestEmbedBit(i8 signext 0, i8* %33, i32 9, i32 0, i8* %34)
%36 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%37 = getelementptr inbounds [9 x i8], [9 x i8]* %9, i64 0, i64 0
%38 = call i32 @TestEmbedBit(i8 signext -1, i8* %36, i32 9, i32 0, i8* %37)
%39 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%40 = getelementptr inbounds [9 x i8], [9 x i8]* %10, i64 0, i64 0
%41 = call i32 @TestEmbedBit(i8 signext 73, i8* %39, i32 9, i32 0, i8* %40)
%42 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%43 = getelementptr inbounds [9 x i8], [9 x i8]* %11, i64 0, i64 0
%44 = call i32 @TestEmbedBit(i8 signext 73, i8* %42, i32 9, i32 0, i8* %43)
%45 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%46 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%47 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.TestEmbedChars.result5 = [9 x i8] c"\01\00\00\01\00\00\01\00\01"
@__const.TestEmbedChars.result6 = [9 x i8] c"\FF\FE\FE\FF\FE\FE\FF\FE\FF"
@str.4 = [26 x i8] c"Test Embed char functions\00"
@str.7 = [5 x i8] c"Done\00"
@str.8 = [31 x i8] c"------------------------------\00"
define void @TestEmbedChars() {
%1 = alloca [9 x i8]
%2 = alloca [9 x i8]
%3 = alloca [9 x i8]
%4 = alloca [9 x i8]
%5 = alloca [9 x i8]
%6 = alloca [9 x i8]
%7 = alloca [9 x i8]
%8 = alloca [9 x i8]
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds [9 x i8], [9 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [9 x i8], [9 x i8]* %8, i64 0, i64 0
%17 = tail call i32 @putchar(i32 10)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.4, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0))
%21 = call i32 @TestEmbedBit(i8 signext 0, i8* %9, i32 9, i32 0, i8* %11)
%22 = call i32 @TestEmbedBit(i8 signext -1, i8* %9, i32 9, i32 0, i8* %12)
%23 = call i32 @TestEmbedBit(i8 signext 0, i8* %10, i32 9, i32 0, i8* %13)
%24 = call i32 @TestEmbedBit(i8 signext -1, i8* %10, i32 9, i32 0, i8* %14)
%25 = call i32 @TestEmbedBit(i8 signext 73, i8* %9, i32 9, i32 0, i8* %15)
%26 = call i32 @TestEmbedBit(i8 signext 73, i8* %10, i32 9, i32 0, i8* %16)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0))
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.7, i64 0, i64 0))
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0))
ret void
}