#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*/ TestFile(char *, char *, char *);
int /*<<< orphan*/ printf(char *);
void TestFiles() {
  char small_25_expected[] = {
      0x26, 0x2e, 0x65, 0x30, 0x2c, 0x05, 0x11, 0x30, 0x51, 0x34, 0x36, 0x6a,
      0x5e, 0x21, 0x19, 0x3c, 0x5a, 0x0b, 0x79, 0x2f, 0x68, 0x61, 0x67, 0x64,
      0x4d, 0x61, 0x4f, 0x48, 0x76, 0x4d, 0x29, 0x10, 0x63, 0x3a, 0x75, 0x28,
      0x48, 0x27, 0x59, 0x7a, 0x62, 0x71, 0x14, 0x54, 0x7d, 0x31, 0x05, 0x5e,
      0x61, 0x5b, 0x1f, 0x43, 0x0e, 0x61, 0x7b, 0x38, 0x23, 0x1e, 0x15, 0x06,
      0x25, 0x51, 0x5b, 0x64, 0x19, 0x4d, 0x22, 0x16, 0x35, 0x7b, 0x2b, 0x7c,
      0x34, 0x78, 0x7c, 0x58, 0x70, 0x1a, 0x5c, 0x72, 0x22, 0x36, 0x27, 0x24,
      0x1b, 0x5b, 0x28, 0x66, 0x6f, 0x2e};
  char small_25_str[] = "dangerous";
  char small_25_fname[] = "../inputs/images/small_25.pgm";
  char small_41_expected[] = {
      0x24, 0x60, 0x4f, 0x2f, 0x7a, 0x0f, 0x1f, 0x6a, 0x0f, 0x40, 0x18, 0x2a,
      0x42, 0x5b, 0x59, 0x38, 0x3e, 0x01, 0x04, 0x22, 0x51, 0x09, 0x63, 0x26,
      0x09, 0x7d, 0x5d, 0x54, 0x04, 0x2d, 0x51, 0x30, 0x51, 0x48, 0x15, 0x4e,
      0x74, 0x4f, 0x11, 0x58, 0x2a, 0x42, 0x6c, 0x26, 0x7c, 0x7a, 0x5e, 0x72,
      0x64, 0x30, 0x48, 0x51, 0x64, 0x21, 0x25, 0x2d, 0x55, 0x47, 0x2b, 0x25,
      0x16, 0x1c, 0x68, 0x34, 0x61, 0x1a, 0x4f, 0x5f, 0x79, 0x12, 0x03, 0x26,
      0x4f, 0x0a, 0x7b, 0x6d, 0x0f, 0x4e, 0x64, 0x2e};
  char small_41_str[] = "large";
  char small_41_fname[] = "../inputs/images/small_41.pgm";
  printf("\n");
  printf("------------------------------\n");
  printf("Test Embed string functions\n");
  printf("------------------------------\n");
  printf("\n");
  TestFile(small_25_fname, small_25_str, small_25_expected);
  TestFile(small_41_fname, small_41_str, small_41_expected);
  printf("------------------------------\n");
  printf("Done\n");
  printf("------------------------------\n");
}


x86 assembly (clang, -O0):
<TestFiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    -0x60(%rbp),%rdi
lea    0xeba(%rip),%rsi
mov    $0x5a,%edx
call   1040 <memcpy@plt>
mov    0xf59(%rip),%rax
mov    %rax,-0x6a(%rbp)
mov    0xf56(%rip),%ax
mov    %ax,-0x62(%rbp)
mov    0xfa3(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0xf9d(%rip),%rax
mov    %rax,-0x88(%rbp)
mov    0xf97(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xf95(%rip),%eax
mov    %eax,-0x78(%rbp)
mov    0xf8f(%rip),%ax
mov    %ax,-0x74(%rbp)
lea    -0xe0(%rbp),%rdi
lea    0xeb1(%rip),%rsi
mov    $0x50,%edx
call   1040 <memcpy@plt>
mov    0xefb(%rip),%eax
mov    %eax,-0xe6(%rbp)
mov    0xef2(%rip),%ax
mov    %ax,-0xe2(%rbp)
mov    0xf56(%rip),%rax
mov    %rax,-0x110(%rbp)
mov    0xf50(%rip),%rax
mov    %rax,-0x108(%rbp)
mov    0xf4a(%rip),%rax
mov    %rax,-0x100(%rbp)
mov    0xf45(%rip),%eax
mov    %eax,-0xf8(%rbp)
mov    0xf3c(%rip),%ax
mov    %ax,-0xf4(%rbp)
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
lea    -0x6a(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1050 <TestFile@plt>
lea    -0x110(%rbp),%rdi
lea    -0xe6(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1050 <TestFile@plt>
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestFiles>:
push   %rbx
sub    $0x110,%rsp
movups 0xf0b(%rip),%xmm0
movups %xmm0,0xaa(%rsp)
movaps 0xef2(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xed3(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe95(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe79(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movabs $0x756f7265676e6164,%rax
72 6f 75
mov    %rax,0x10(%rsp)
movw   $0x73,0x18(%rsp)
movups 0xf65(%rip),%xmm0
movups %xmm0,0x4e(%rsp)
movaps 0xf4b(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0xea1(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0xe82(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xe63(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movw   $0x65,0xc(%rsp)
movl   $0x6772616c,0x8(%rsp)
67
movups 0xf13(%rip),%xmm0
movups %xmm0,0x2e(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xea4(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe74(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x40(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x60(%rsp),%rdx
call   1050 <TestFile@plt>
lea    0x20(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0xc0(%rsp),%rdx
call   1050 <TestFile@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe3f(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
add    $0x110,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.TestFiles.small_25_expected = [90 x i8] c"&.e0,\05\110Q46j^!\19<Z\0By/hagdMaOHvM)\10c:u(H'Yzbq\14T}1\05^a[\1FC\0Ea{8#\1E\15\06%Q[d\19M\22\165{+|4x|Xp\1A\\r\226'$\1B[(fo."
@__const.TestFiles.small_25_str = [10 x i8] c"dangerous\00"
@__const.TestFiles.small_25_fname = [30 x i8] c"../inputs/images/small_25.pgm\00"
@__const.TestFiles.small_41_expected = [80 x i8] c"$`O/z\0F\1Fj\0F@\18*B[Y8>\01\04\22Q\09c&\09}]T\04-Q0QH\15NtO\11X*Bl&|z^rd0HQd!%-UG+%\16\1Ch4a\1AO_y\12\03&O\0A{m\0FNd."
@__const.TestFiles.small_41_str = [6 x i8] c"large\00"
@__const.TestFiles.small_41_fname = [30 x i8] c"../inputs/images/small_41.pgm\00"
@.str = [2 x i8] c"\0A\00"
@.str.1 = [32 x i8] c"------------------------------\0A\00"
@.str.2 = [29 x i8] c"Test Embed string functions\0A\00"
@.str.3 = [6 x i8] c"Done\0A\00"
define void @TestFiles() {
%1 = alloca [90 x i8]
%2 = alloca [10 x i8]
%3 = alloca [30 x i8]
%4 = alloca [80 x i8]
%5 = alloca [6 x i8]
%6 = alloca [30 x i8]
%7 = bitcast [90 x i8]* %1 to i8*
%8 = bitcast [10 x i8]* %2 to i8*
%9 = bitcast [30 x i8]* %3 to i8*
%10 = bitcast [80 x i8]* %4 to i8*
%11 = bitcast [6 x i8]* %5 to i8*
%12 = bitcast [30 x i8]* %6 to i8*
%13 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%20 = getelementptr inbounds [90 x i8], [90 x i8]* %1, i64 0, i64 0
%21 = call i32 @TestFile(i8* %18, i8* %19, i8* %20)
%22 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%23 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%25 = call i32 @TestFile(i8* %22, i8* %23, i8* %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.TestFiles.small_25_expected = [90 x i8] c"&.e0,\05\110Q46j^!\19<Z\0By/hagdMaOHvM)\10c:u(H'Yzbq\14T}1\05^a[\1FC\0Ea{8#\1E\15\06%Q[d\19M\22\165{+|4x|Xp\1A\\r\226'$\1B[(fo."
@__const.TestFiles.small_25_str = [10 x i8] c"dangerous\00"
@__const.TestFiles.small_25_fname = [30 x i8] c"../inputs/images/small_25.pgm\00"
@__const.TestFiles.small_41_expected = [80 x i8] c"$`O/z\0F\1Fj\0F@\18*B[Y8>\01\04\22Q\09c&\09}]T\04-Q0QH\15NtO\11X*Bl&|z^rd0HQd!%-UG+%\16\1Ch4a\1AO_y\12\03&O\0A{m\0FNd."
@__const.TestFiles.small_41_str = [6 x i8] c"large\00"
@__const.TestFiles.small_41_fname = [30 x i8] c"../inputs/images/small_41.pgm\00"
@str.4 = [28 x i8] c"Test Embed string functions\00"
@str.7 = [5 x i8] c"Done\00"
@str.8 = [31 x i8] c"------------------------------\00"
define void @TestFiles() {
%1 = alloca [90 x i8]
%2 = alloca [10 x i8]
%3 = alloca [30 x i8]
%4 = alloca [80 x i8]
%5 = alloca [6 x i8]
%6 = alloca [30 x i8]
%7 = getelementptr inbounds [90 x i8], [90 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%13 = tail call i32 @putchar(i32 10)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.4, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0))
%17 = tail call i32 @putchar(i32 10)
%18 = call i32 @TestFile(i8* %9, i8* %8, i8* %7)
%19 = call i32 @TestFile(i8* %12, i8* %11, i8* %10)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0))
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.7, i64 0, i64 0))
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0))
ret void
}