#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 words_starting_with(char const *, char);
void test3(const char *dictionary, char letter) {
  int file_result;
  printf("\nTest3--------------------------------------------------------\n");
  file_result = words_starting_with(dictionary, letter);
  if (file_result == -2) {
    printf("Can't open %s\n", dictionary);
    return;
  }
  printf("Dictionary: %s\n", dictionary);
  printf("Number of words starting with %c: %i\n", letter, file_result);
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1040 <words_starting_with@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xfffffffe,-0x10(%rbp)
jne    1171 <test3+0x51>
mov    -0x8(%rbp),%rsi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1198 <test3+0x78>
mov    -0x8(%rbp),%rsi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x9(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <words_starting_with@plt>
cmp    $0xfffffffe,%eax
jne    116b <test3+0x3b>
lea    0xea3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>
mov    %eax,%ebp
lea    0xe9b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl %r14b,%esi
lea    0xe96(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"\0ATest3--------------------------------------------------------\0A\00"
@.str.1 = [15 x i8] c"Can't open %s\0A\00"
@.str.2 = [16 x i8] c"Dictionary: %s\0A\00"
@.str.3 = [38 x i8] c"Number of words starting with %c: %i\0A\00"
define void @test3(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i32
store i8* %0, i8** %3
store i8 %1, i8* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %3
%8 = load i8, i8* %4
%9 = call i32 @words_starting_with(i8* %7, i8 signext %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, -2
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %22
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = load i8, i8* %4
%19 = sext i8 %18 to i32
%20 = load i32, i32* %5
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %19, i32 %20)
br label %22
22: ; preds = %15, %12
ret void
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"Can't open %s\0A\00"
@.str.2 = [16 x i8] c"Dictionary: %s\0A\00"
@.str.3 = [38 x i8] c"Number of words starting with %c: %i\0A\00"
@str = [63 x i8] c"\0ATest3--------------------------------------------------------\00"
define void @test3(i8* %0, i8 signext %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @words_starting_with(i8* %0, i8 signext %1)
%5 = icmp eq i32 %4, -2
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %12
8: ; preds = %2
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%10 = sext i8 %1 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %10, i32 %4)
br label %12
12: ; preds = %8, %6
ret void
}