#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char, char);
int /*<<< orphan*/ printf(char *, int);
int strlen(char *);
void tst(FILE *fo, char input[], int counter) {
  if (strlen(input) >= 8)
    fprintf(fo, "8%c%c0 ", input[5], input[8]);
  else
    printf("Unable to resolve code written at line %d\n", counter);
  return;
}


x86 assembly (clang, -O0):
<tst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x8,%eax
jl     117c <tst+0x4c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x5(%rax),%cl
mov    -0x10(%rbp),%rax
lea    0xe95(%rip),%rsi
movsbl %cl,%edx
movsbl 0x8(%rax),%ecx
call   1050 <fprintf@plt>
jmp    118b <tst+0x5b>
mov    -0x14(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tst>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
cmp    $0x8,%eax
jl     1165 <tst+0x35>
movsbl 0x5(%rbp),%edx
movsbl 0x8(%rbp),%ecx
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <fprintf@plt>
lea    0xe9c(%rip),%rdi
mov    %r14d,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"8%c%c0 \00"
@.str.1 = [43 x i8] c"Unable to resolve code written at line %d\0A\00"
define void @tst(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = call i32 @strlen(i8* %7)
%9 = icmp sge i32 %8, 8
br i1 %9, label %10, label %19
10: ; preds = %3
%11 = load i32*, i32** %4
%12 = load i8*, i8** %5
%13 = getelementptr inbounds i8, i8* %12, i64 5
%14 = load i8, i8* %13
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 8
%17 = load i8, i8* %16
%18 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %14, i8 signext %17)
br label %22
19: ; preds = %3
%20 = load i32, i32* %6
%21 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %19, %10
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"8%c%c0 \00"
@.str.1 = [43 x i8] c"Unable to resolve code written at line %d\0A\00"
define void @tst(i32* nocapture %0, i8* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp sgt i32 %4, 7
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %1, i64 5
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %1, i64 8
%10 = load i8, i8* %9
%11 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %8, i8 signext %10)
br label %14
12: ; preds = %3
%13 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %2)
br label %14
14: ; preds = %12, %6
ret void
}