#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*/ printf(char *, int);
int string_match(char *, char *);
char *test_unsuccessful_match() {
  char *text = "hello";
  char *pattern = "nlo";
  do {
    if (!(string_match(text, pattern) == -1)) {
      printf("Line number is: %d\n", 56);
      return "error, found an non-existant substring";
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_unsuccessful_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xecc(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <string_match@plt>
cmp    $0xffffffff,%eax
je     1175 <test_unsuccessful_match+0x55>
lea    0xeaf(%rip),%rdi
mov    $0x38,%esi
call   1030 <printf@plt>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1182 <test_unsuccessful_match+0x62>
jmp    117a <test_unsuccessful_match+0x5a>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_unsuccessful_match>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1040 <string_match@plt>
cmp    $0xffffffff,%eax
je     1153 <test_unsuccessful_match+0x33>
lea    0xeca(%rip),%rdi
mov    $0x38,%esi
call   1030 <printf@plt>
lea    0xecd(%rip),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [4 x i8] c"nlo\00"
@.str.2 = [20 x i8] c"Line number is: %d\0A\00"
@.str.3 = [39 x i8] c"error, found an non-existant substring\00"
define i8* @test_unsuccessful_match() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %4
4: ; preds = %0
%5 = load i8*, i8** %2
%6 = load i8*, i8** %3
%7 = call i32 @string_match(i8* %5, i8* %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 56)
store i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8** %1
br label %13
11: ; preds = %4
br label %12
12: ; preds = %11
store i8* null, i8** %1
br label %13
13: ; preds = %12, %9
%14 = load i8*, i8** %1
ret i8* %14
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [4 x i8] c"nlo\00"
@.str.2 = [20 x i8] c"Line number is: %d\0A\00"
@.str.3 = [39 x i8] c"error, found an non-existant substring\00"
define i8* @test_unsuccessful_match() {
%1 = tail call i32 @string_match(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32 %1, -1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 56)
br label %5
5: ; preds = %0, %3
%6 = phi i8* [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), %3 ], [ null, %0 ]
ret i8* %6
}