#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
scalar_t__ substring(char *, char *);
int main() {
  char s1[100], s2[100];
  gets(s1);
  gets(s2);
  if (substring(s1, s2))
    printf("%s is substring of %s\n", s1, s2);
  else
    printf("%s is NOT a substring of %s\n", s1, s2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
call   1050 <gets@plt>
lea    -0xe0(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1040 <substring@plt>
cmp    $0x0,%rax
je     118d <main+0x5d>
lea    -0x70(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
jmp    11a4 <main+0x74>
lea    -0x70(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
lea    0x70(%rsp),%r14
mov    %r14,%rdi
call   1050 <gets@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <substring@plt>
test   %rax,%rax
lea    0xeb0(%rip),%rax
lea    0xe92(%rip),%rdi
cmove  %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"%s is substring of %s\0A\00"
@.str.1 = [29 x i8] c"%s is NOT a substring of %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = call i64 @substring(i8* %8, i8* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
br label %20
16: ; preds = %0
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %17, i8* %18)
br label %20
20: ; preds = %16, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"%s is substring of %s\0A\00"
@.str.1 = [29 x i8] c"%s is NOT a substring of %s\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %3)
%6 = call i32 @gets(i8* %4)
%7 = call i64 @substring(i8* %3, i8* %4)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0)
%10 = call i32 @printf(i8* %9, i8* %3, i8* %4)
ret i32 0
}