#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*/ DEBUGLOG_Putc(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int strlen(char const *);
void DEBUGLOG_AddStr(const char *str) {
  unsigned len = strlen(str) + 1;
  if (*str == '3' && *(str + 1) == '3') {
    printf("here\n");
  }
  while (len) {
    DEBUGLOG_Putc(*str++);
    len--;
  }
}


x86 assembly (clang, -O0):
<DEBUGLOG_AddStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x33,%eax
jne    1178 <DEBUGLOG_AddStr+0x48>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x33,%eax
jne    1178 <DEBUGLOG_AddStr+0x48>
lea    0xe8d(%rip),%rdi
call   1050 <printf@plt>
jmp    117d <DEBUGLOG_AddStr+0x4d>
cmpl   $0x0,-0xc(%rbp)
je     11ac <DEBUGLOG_AddStr+0x7c>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <DEBUGLOG_Putc@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    117d <DEBUGLOG_AddStr+0x4d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DEBUGLOG_AddStr>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <strlen@plt>
mov    %eax,%ebp
add    $0x1,%ebp
cmpb   $0x33,(%r14)
jne    115a <DEBUGLOG_AddStr+0x2a>
cmpb   $0x33,0x1(%r14)
jne    115a <DEBUGLOG_AddStr+0x2a>
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
je     1182 <DEBUGLOG_AddStr+0x52>
mov    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1030 <DEBUGLOG_Putc@plt>
add    $0x1,%rbx
cmp    %ebx,%ebp
jne    1170 <DEBUGLOG_AddStr+0x40>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"here\0A\00"
define void @DEBUGLOG_AddStr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 51
br i1 %10, label %11, label %19
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 51
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %11, %1
br label %20
20: ; preds = %23, %19
%21 = load i32, i32* %3
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %31
23: ; preds = %20
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %2
%26 = load i8, i8* %24
%27 = sext i8 %26 to i32
%28 = call i32 @DEBUGLOG_Putc(i32 %27)
%29 = load i32, i32* %3
%30 = add i32 %29, -1
store i32 %30, i32* %3
br label %20
31: ; preds = %20
ret void
}

LLVM IR (-O2):
@str = [5 x i8] c"here\00"
define void @DEBUGLOG_AddStr(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 51
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 51
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %10, %6, %1
%13 = icmp eq i32 %3, 0
br i1 %13, label %23, label %14
14: ; preds = %12, %14
%15 = phi i32 [ %21, %14 ], [ %3, %12 ]
%16 = phi i8* [ %17, %14 ], [ %0, %12 ]
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %16
%19 = sext i8 %18 to i32
%20 = tail call i32 @DEBUGLOG_Putc(i32 %19)
%21 = add i32 %15, -1
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %14
23: ; preds = %14, %12
ret void
}