#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_len_zero() {
  char *text1 = "hello";
  char *pattern1 = "";
  do {
    if (!(string_match(text1, pattern1) == -4)) {
      printf("Line number is: %d\n", 63);
      return "error, found an empty character";
    }
  } while (0);
  char *text2 = "";
  char *pattern2 = "";
  do {
    if (!(string_match(text2, pattern2) == -4)) {
      printf("Line number is: %d\n", 67);
      return "error, found an empty character";
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_len_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xedf(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <string_match@plt>
cmp    $0xfffffffc,%eax
je     1175 <test_len_zero+0x55>
lea    0xeab(%rip),%rdi
mov    $0x3f,%esi
call   1030 <printf@plt>
lea    0xeae(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d4 <test_len_zero+0xb4>
jmp    117a <test_len_zero+0x5a>
lea    0xe98(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe8d(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <string_match@plt>
cmp    $0xfffffffc,%eax
je     11c7 <test_len_zero+0xa7>
lea    0xe59(%rip),%rdi
mov    $0x43,%esi
call   1030 <printf@plt>
lea    0xe5c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d4 <test_len_zero+0xb4>
jmp    11cc <test_len_zero+0xac>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_len_zero>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xeea(%rip),%rsi
call   1040 <string_match@plt>
mov    $0x3f,%esi
cmp    $0xfffffffc,%eax
jne    115b <test_len_zero+0x3b>
lea    0xed4(%rip),%rdi
mov    %rdi,%rsi
call   1040 <string_match@plt>
mov    $0x43,%esi
cmp    $0xfffffffc,%eax
jne    115b <test_len_zero+0x3b>
xor    %eax,%eax
pop    %rcx
ret
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
lea    0xeac(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [20 x i8] c"Line number is: %d\0A\00"
@.str.3 = [32 x i8] c"error, found an empty character\00"
define i8* @test_len_zero() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %6
6: ; preds = %0
%7 = load i8*, i8** %2
%8 = load i8*, i8** %3
%9 = call i32 @string_match(i8* %7, i8* %8)
%10 = icmp eq i32 %9, -4
br i1 %10, label %13, label %11
11: ; preds = %6
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 63)
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8** %1
br label %24
13: ; preds = %6
br label %14
14: ; preds = %13
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %15
15: ; preds = %14
%16 = load i8*, i8** %4
%17 = load i8*, i8** %5
%18 = call i32 @string_match(i8* %16, i8* %17)
%19 = icmp eq i32 %18, -4
br i1 %19, label %22, label %20
20: ; preds = %15
%21 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 67)
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8** %1
br label %24
22: ; preds = %15
br label %23
23: ; preds = %22
store i8* null, i8** %1
br label %24
24: ; preds = %23, %20, %11
%25 = load i8*, i8** %1
ret i8* %25
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [20 x i8] c"Line number is: %d\0A\00"
@.str.3 = [32 x i8] c"error, found an empty character\00"
define i8* @test_len_zero() {
%1 = tail call i32 @string_match(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32 %1, -4
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @string_match(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32 %4, -4
br i1 %5, label %9, label %6
6: ; preds = %3, %0
%7 = phi i32 [ 63, %0 ], [ 67, %3 ]
%8 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6, %3
%10 = phi i8* [ null, %3 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), %6 ]
ret i8* %10
}