/* embed_private_strings.c */
/* Guaranteed to allow up to 120 ASCII characters inside any function using gcc. */
/* It IS easily possible to get many, many more characters but this is a minimal approach. */
/* Without any modifications this will compile on these platforms:- */
/* Works on gcc 2.95.3 for the classic AMIGA OS 3.0.x using ADE the *NIX emulator, Motorola 68000+ architecture. */
/* Works on gcc 4.2.1 for OSX 10.14.x, 64 bit, Intel architecture. */
/* Works on gcc 7.3.0 for Linux Mint 19, 64 bit, Intel architecture. */
/* -- I have no idea whether this compiles on the current gcc 8.2.0 or greater, as of 20-02-2019. -- */

#include <stdio.h>

void Private_String(void)
{
	/* To keep this private string near the top of the executable code */
	/* this MUST be the first function. */
	/* This string will always be separate from the normal data section. */
	/* It MUST be an EVEN number of characters long, including a */
	/* single newline and any required NULL padding character(s) at the end. */
	asm("	jmp	exit_asm1;"
	"string1:"
	"	.asciz	\"'$VER (C)_Barry_Walker_CC0_Licence_[Public_Domain].'\\n\";"
	"exit_asm1:"
	"	nop;");
	/* IMPORTANT! DO NOT use the assembler RETURN instruction at all! */
	return;
}

void Test_Function(void)
{
	/* The comment will be inside this function code when the comment delimiters are removed */
	/* from around the 'asm()' function, all other strings will be in the data section. */
	/* asm("	jmp	exit_asm2;"
	"string2:"
	"	.asciz	\"'This is the Test_Function().'\\n\";"
	"exit_asm2:"
	"	nop;"); */
	/* This function is just a test function. */
	printf("\nA test function to check that the strings are in the data section.\n"); 
	return;
}

int main(void)
{
	/* The fun comment will be inside the 'main()' code, all other strings will be in the data section. */
	asm("	jmp	exit_asm3;"
	"string3:"
	"	.asciz	\"'What is long, thin, red and sometimes goes inside tarts? RHUBARB!'\\n\\0\";"
	"exit_asm3:"
	"	nop;");
	/* Note: 'Private_String()' does absolutely NOTHING. */
	Private_String();
	Test_Function();
	printf("\nThese strings should be in the data section.\n");
	printf("The hidden string(s) is(/are) outside the data section.\n");
	printf("'$VER (C)_Barry_Walker_CC0_Licence_[PD].'\n\n");
	return 0;
}

/* **********************************************************

Partial hexdump after compiling:
--------------------------------

0350: 00000D50 4E750000 4E550000 4EF90000    ...PNu..NU..N˘..
0360: 03702724 56455220 2843295F 42617272    .p'$VER (C)_Barr
0370: 795F5761 6C6B6572 5F434330 5F4C6963    y_Walker_CC0_Lic
0380: 656E6365 5F5B5075 626C6963 5F446F6D    ence_[Public_Dom
0390: 61696E5D 2E270A00 4E716000 00024E5D    ain].'..Nq`...N]
03A0: 4E750A41 20746573 74206675 6E637469    Nu.A test functi
03B0: 6F6E2074 6F206368 65636B20 74686174    on to check that
03C0: 20746865 20737472 696E6773 20617265     the strings are
03D0: 20696E20 74686520 64617461 20736563     in the data sec
03E0: 74696F6E 2E0A0000 4E550000 48790000    tion....NU..Hy..
03F0: 037A4EB9 00000D5C 588F6000 00024E5D    .zNÏ€...\X.`...N]
0400: 4E750A54 68657365 20737472 696E6773    Nu.These strings
0410: 2073686F 756C6420 62652069 6E207468     should be in th
0420: 65206461 74612073 65637469 6F6E2E0A    e data section..
0430: 00546865 20686964 64656E20 73747269    .The hidden stri
0440: 6E672873 29206973 282F6172 6529206F    ng(s) is(/are) o
0450: 75747369 64652074 68652064 61746120    utside the data 
0460: 73656374 696F6E2E 0A002724 56455220    section...'$VER 
0470: 2843295F 42617272 795F5761 6C6B6572    (C)_Barry_Walker
0480: 5F434330 5F4C6963 656E6365 5F5B5044    _CC0_Licence_[PD
0490: 5D2E270A 0A004E55 00004EB9 0000058C    ].'...NU..NÏ€....
04A0: 4EF90000 04C42757 68617420 6973206C    N˘...ƒ'What is l
04B0: 6F6E672C 20746869 6E2C2072 65642061    ong, thin, red a
04C0: 6E642073 6F6D6574 696D6573 20676F65    nd sometimes goe
04D0: 7320696E 73696465 20746172 74733F20    s inside tarts? 
04E0: 52485542 41524221 270A0000 4E716100    RHUBARB!'...Nqa.
04F0: FE686100 FEF44879 000003DA 4EB90000    ˛ha.˛ÙHy...⁄Nπ..
0500: 0D5C588F 48790000 04094EB9 00000D5C    .\X.Hy....NÏ€...\
0510: 588F4879 00000442 4EB90000 0D5C588F    X.Hy...BNÏ€...\X.
0520: 70006006 70006000 00024E5D 4E750000    p.`.p.`...N]Nu..

********************************************************** */