#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 */
struct crypt_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ logger(struct crypt_device *, int /*<<< orphan*/, char *,
                          int, char *, char);
void hexprintICB(struct crypt_device *cd, char *d, int n) {
  int i;
  for (i = 0; i < n; i++)
    logger(cd, 0,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/SteamMOD/"
           "android_bootable_steam_cryptsetup/refs/heads/master/lib/setup.c",
           2000, "%02hhx ", (char)d[i]);
}


x86 assembly (clang, -O0):
<hexprintICB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    116f <hexprintICB+0x5f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%r9
xor    %esi,%esi
lea    0xeb5(%rip),%rdx
mov    $0x7d0,%ecx
lea    0xf4c(%rip),%r8
movsbl (%rax,%r9,1),%r9d
call   1030 <logger@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112a <hexprintICB+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexprintICB>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1163 <hexprintICB+0x53>
mov    %rsi,%r14
mov    %rdi,%r13
mov    %edx,%ebx
xor    %ebp,%ebp
lea    0xed0(%rip),%r15
lea    0xf6c(%rip),%r12
nopw   0x0(%rax,%rax,1)
movsbl (%r14,%rbp,1),%r9d
mov    %r13,%rdi
xor    %esi,%esi
mov    %r15,%rdx
mov    $0x7d0,%ecx
mov    %r12,%r8
call   1030 <logger@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1140 <hexprintICB+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.crypt_device = type { i32 }
@.str = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/SteamMOD/android_bootable_steam_cryptsetup/refs/heads/master/lib/setup.c\00"
@.str.1 = [8 x i8] c"%02hhx \00"
define void @hexprintICB(%struct.crypt_device* %0, i8* %1, i32 %2) {
%4 = alloca %struct.crypt_device*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store %struct.crypt_device* %0, %struct.crypt_device** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %20, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %23
12: ; preds = %8
%13 = load %struct.crypt_device*, %struct.crypt_device** %4
%14 = load i8*, i8** %5
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = call i32 @logger(%struct.crypt_device* %13, i32 0, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i32 2000, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8 signext %18)
br label %20
20: ; preds = %12
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %8
23: ; preds = %8
ret void
}

LLVM IR (-O2):
%struct.crypt_device = type { i32 }
@.str = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/SteamMOD/android_bootable_steam_cryptsetup/refs/heads/master/lib/setup.c\00"
@.str.1 = [8 x i8] c"%02hhx \00"
define void @hexprintICB(%struct.crypt_device* %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds i8, i8* %1, i64 %8
%10 = load i8, i8* %9
%11 = tail call i32 @logger(%struct.crypt_device* %0, i32 0, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i32 2000, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8 signext %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %3
ret void
}