#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);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ raw2hex(char *, unsigned char *, int);
scalar_t__ strcmp(char *, char *);
int main() {
  char buf[32 + 1];
  int ret = 0, tests = 0;
  {
    raw2hex(buf, (unsigned char *)"\x01\x05\x0a", sizeof("\x01\x05\x0a") - 1);
    {
      tests++;
      if (!((strcmp((buf), ("01050a")) == 0))) {
        ret++;
        puts("test "
             "str_equal(buf, \"01050a\")"
             " failed");
      }
    };
  };
  {
    raw2hex(buf, (unsigned char *)"\xff\xde\xad\xc0\xde\x00\x01",
            sizeof("\xff\xde\xad\xc0\xde\x00\x01") - 1);
    {
      tests++;
      if (!((strcmp((buf), ("ffdeadc0de0001")) == 0))) {
        ret++;
        puts("test "
             "str_equal(buf, \"ffdeadc0de0001\")"
             " failed");
      }
    };
  };
  {
    raw2hex(buf,
            (unsigned char *)"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb"
                             "\xcc\xdd\xee\xff",
            sizeof("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd"
                   "\xee\xff") -
                1);
    {
      tests++;
      if (!((strcmp((buf), ("00112233445566778899aabbccddeeff")) == 0))) {
        ret++;
        puts("test "
             "str_equal(buf, \"00112233445566778899aabbccddeeff\")"
             " failed");
      }
    };
  };
  printf("%d out of %d tests failed.\n", ret, tests);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe98(%rip),%rsi
mov    $0x3,%edx
call   1030 <raw2hex@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11aa <main+0x6a>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
lea    0xe66(%rip),%rdi
call   1040 <puts@plt>
lea    -0x30(%rbp),%rdi
lea    0xf33(%rip),%rsi
mov    $0x7,%edx
call   1030 <raw2hex@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe5d(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11f7 <main+0xb7>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
lea    0xe4d(%rip),%rdi
call   1040 <puts@plt>
lea    -0x30(%rbp),%rdi
lea    0xeee(%rip),%rsi
mov    $0x10,%edx
call   1030 <raw2hex@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe4c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1244 <main+0x104>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
lea    0xe4e(%rip),%rdi
call   1040 <puts@plt>
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
lea    0xe7b(%rip),%rdi
call   1050 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xeb2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <raw2hex@plt>
lea    0xe9f(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1185 <main+0x45>
lea    0xe92(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebx
jmp    1187 <main+0x47>
xor    %ebx,%ebx
lea    0xf5a(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x7,%edx
call   1030 <raw2hex@plt>
lea    0xe8b(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11c1 <main+0x81>
add    $0x1,%ebx
lea    0xe83(%rip),%rdi
call   1040 <puts@plt>
lea    0xf28(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x10,%edx
call   1030 <raw2hex@plt>
lea    0xe8d(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11fb <main+0xbb>
add    $0x1,%ebx
lea    0xe97(%rip),%rdi
call   1040 <puts@plt>
lea    0xeca(%rip),%rdi
mov    %ebx,%esi
mov    $0x3,%edx
call   1050 <printf@plt>
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"\01\05\0A\00"
@.str.1 = [7 x i8] c"01050a\00"
@.str.2 = [37 x i8] c"test str_equal(buf, \2201050a\22) failed\00"
@.str.3 = [8 x i8] c"\FF\DE\AD\C0\DE\00\01\00"
@.str.4 = [15 x i8] c"ffdeadc0de0001\00"
@.str.5 = [45 x i8] c"test str_equal(buf, \22ffdeadc0de0001\22) failed\00"
@.str.6 = [17 x i8] c"\00\11\223DUfw\88\99\AA\BB\CC\DD\EE\FF\00"
@.str.7 = [33 x i8] c"00112233445566778899aabbccddeeff\00"
@.str.8 = [63 x i8] c"test str_equal(buf, \2200112233445566778899aabbccddeeff\22) failed\00"
@.str.9 = [28 x i8] c"%d out of %d tests failed.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [33 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
%5 = getelementptr inbounds [33 x i8], [33 x i8]* %2, i64 0, i64 0
%6 = call i32 @raw2hex(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
store i32 %8, i32* %4
%9 = getelementptr inbounds [33 x i8], [33 x i8]* %2, i64 0, i64 0
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %0
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
%15 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %12, %0
%17 = getelementptr inbounds [33 x i8], [33 x i8]* %2, i64 0, i64 0
%18 = call i32 @raw2hex(i8* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 7)
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
%21 = getelementptr inbounds [33 x i8], [33 x i8]* %2, i64 0, i64 0
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %16
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
%27 = call i32 @puts(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
br label %28
28: ; preds = %24, %16
%29 = getelementptr inbounds [33 x i8], [33 x i8]* %2, i64 0, i64 0
%30 = call i32 @raw2hex(i8* %29, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 16)
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
%33 = getelementptr inbounds [33 x i8], [33 x i8]* %2, i64 0, i64 0
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %28
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
%39 = call i32 @puts(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.8, i64 0, i64 0))
br label %40
40: ; preds = %36, %28
%41 = load i32, i32* %3
%42 = load i32, i32* %4
%43 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 %41, i32 %42)
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str = [4 x i8] c"\01\05\0A\00"
@.str.1 = [7 x i8] c"01050a\00"
@.str.2 = [37 x i8] c"test str_equal(buf, \2201050a\22) failed\00"
@.str.3 = [8 x i8] c"\FF\DE\AD\C0\DE\00\01\00"
@.str.4 = [15 x i8] c"ffdeadc0de0001\00"
@.str.5 = [45 x i8] c"test str_equal(buf, \22ffdeadc0de0001\22) failed\00"
@.str.6 = [17 x i8] c"\00\11\223DUfw\88\99\AA\BB\CC\DD\EE\FF\00"
@.str.7 = [33 x i8] c"00112233445566778899aabbccddeeff\00"
@.str.8 = [63 x i8] c"test str_equal(buf, \2200112233445566778899aabbccddeeff\22) failed\00"
@.str.9 = [28 x i8] c"%d out of %d tests failed.\0A\00"
define i32 @main() {
%1 = alloca [33 x i8]
%2 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 0
%3 = call i32 @raw2hex(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%4 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = phi i32 [ 0, %0 ], [ 1, %6 ]
%10 = call i32 @raw2hex(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 7)
%11 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = add nuw nsw i32 %9, 1
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
br label %16
16: ; preds = %13, %8
%17 = phi i32 [ %9, %8 ], [ %14, %13 ]
%18 = call i32 @raw2hex(i8* %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 16)
%19 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %16
%22 = add nuw nsw i32 %17, 1
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.8, i64 0, i64 0))
br label %24
24: ; preds = %21, %16
%25 = phi i32 [ %17, %16 ], [ %22, %21 ]
%26 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32 %25, i32 3)
ret i32 %25
}