#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 */
scalar_t__ compareStrings(char *, int /*<<< orphan*/);
int /*<<< orphan*/ get_sub_string(char *, int, int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char const *argv[]) {
  {
    char str[] = "abcdefgh";
    int i = 0;
    int j = 2;
    int k;
    if (compareStrings(str + 2, get_sub_string(str, 2, 7))) {
      printf("Test1 Passed\n");
    }
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x19(%rbp)
mov    0xeb1(%rip),%al
mov    %al,-0x11(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x2,-0x24(%rbp)
lea    -0x19(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
lea    -0x19(%rbp),%rdi
mov    $0x2,%esi
mov    $0x7,%edx
call   1050 <get_sub_string@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
call   1030 <compareStrings@plt>
cmp    $0x0,%rax
je     11a8 <main+0x78>
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x6867666564636261,%rax
66 67 68
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
lea    0x2(%rsp),%rbx
mov    %rsp,%rdi
mov    $0x2,%esi
mov    $0x7,%edx
call   1050 <get_sub_string@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <compareStrings@plt>
test   %rax,%rax
je     117a <main+0x4a>
lea    0xe94(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [9 x i8] c"abcdefgh\00"
@.str = [14 x i8] c"Test1 Passed\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [9 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [9 x i8]* %6 to i8*
store i32 0, i32* %7
store i32 2, i32* %8
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds i8, i8* %11, i64 2
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%14 = call i32 @get_sub_string(i8* %13, i32 2, i32 7)
%15 = call i64 @compareStrings(i8* %12, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %2
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [9 x i8] c"abcdefgh\00"
@str = [13 x i8] c"Test1 Passed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [9 x i8]
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 2
%6 = call i32 @get_sub_string(i8* %4, i32 2, i32 7)
%7 = call i64 @compareStrings(i8* %5, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
ret i32 0
}