#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 dataStructureMethod(char *);
int noDataStructureMethod(char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char *goodString = "helowitc";
  char *badString = "abcdefghijlkmnopqrstuvwxyzabcdefghijlkmnopqrstuvwxyz";
  printf("Data structure method where 1 is true and 0 is false:\n");
  printf("Good string: %i\n", dataStructureMethod(goodString));
  printf("Bad string:  %i\n", dataStructureMethod(badString));
  printf("Without data structure method where 1 is true and 0 is false:\n");
  printf("Good string: %i\n", noDataStructureMethod(goodString));
  printf("Bad string:  %i\n", noDataStructureMethod(badString));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xebf(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <dataStructureMethod@plt>
mov    %eax,%esi
lea    0xf07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <dataStructureMethod@plt>
mov    %eax,%esi
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <noDataStructureMethod@plt>
mov    %eax,%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <noDataStructureMethod@plt>
mov    %eax,%esi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xf11(%rip),%rdi
call   1040 <puts@plt>
lea    0xea5(%rip),%r14
mov    %r14,%rdi
call   1030 <dataStructureMethod@plt>
lea    0xed4(%rip),%r15
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe8c(%rip),%r12
mov    %r12,%rdi
call   1030 <dataStructureMethod@plt>
lea    0xec3(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xef7(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1050 <noDataStructureMethod@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
call   1050 <noDataStructureMethod@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"helowitc\00"
@.str.1 = [53 x i8] c"abcdefghijlkmnopqrstuvwxyzabcdefghijlkmnopqrstuvwxyz\00"
@.str.2 = [55 x i8] c"Data structure method where 1 is true and 0 is false:\0A\00"
@.str.3 = [17 x i8] c"Good string: %i\0A\00"
@.str.4 = [17 x i8] c"Bad string: %i\0A\00"
@.str.5 = [63 x i8] c"Without data structure method where 1 is true and 0 is false:\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%4 = load i8*, i8** %1
%5 = call i32 @dataStructureMethod(i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %2
%8 = call i32 @dataStructureMethod(i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.5, i64 0, i64 0))
%11 = load i8*, i8** %1
%12 = call i32 @noDataStructureMethod(i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = load i8*, i8** %2
%15 = call i32 @noDataStructureMethod(i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"helowitc\00"
@.str.1 = [53 x i8] c"abcdefghijlkmnopqrstuvwxyzabcdefghijlkmnopqrstuvwxyz\00"
@.str.3 = [17 x i8] c"Good string: %i\0A\00"
@.str.4 = [17 x i8] c"Bad string: %i\0A\00"
@str = [54 x i8] c"Data structure method where 1 is true and 0 is false:\00"
@str.6 = [62 x i8] c"Without data structure method where 1 is true and 0 is false:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @dataStructureMethod(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %2)
%4 = tail call i32 @dataStructureMethod(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.6, i64 0, i64 0))
%7 = tail call i32 @noDataStructureMethod(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = tail call i32 @noDataStructureMethod(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %9)
ret i32 0
}