#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned char const);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
void nxt128_vect_cmp(const unsigned char *vector, const unsigned char *in) {
  unsigned char out[2 * 16 + 1];
  int i;
  out[2 * 16] = 0;
  for (i = 0; i < 16; i++) {
    sprintf((char *)out + 2 * i, "%02x", in[i]);
  }
  if (strcmp((char *)vector, (char *)out)) {
    fprintf(stderr, "Test failedn");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<nxt128_vect_cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x20(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x10,-0x44(%rbp)
jge    119a <nxt128_vect_cmp+0x5a>
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%eax
shl    $0x1,%eax
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
lea    0xe7d(%rip),%rsi
movzbl (%rax,%rcx,1),%edx
call   1050 <sprintf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    115b <nxt128_vect_cmp+0x1b>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11d4 <nxt128_vect_cmp+0x94>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
lea    0xe44(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nxt128_vect_cmp>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %rdi,%r15
movb   $0x0,0x20(%rsp)
movzbl (%rsi),%edx
lea    0xea0(%rip),%r12
mov    %rsp,%r14
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x2(%rsp),%rdi
movzbl 0x1(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x4(%rsp),%rdi
movzbl 0x2(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x6(%rsp),%rdi
movzbl 0x3(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x8(%rsp),%rdi
movzbl 0x4(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0xa(%rsp),%rdi
movzbl 0x5(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0xc(%rsp),%rdi
movzbl 0x6(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0xe(%rsp),%rdi
movzbl 0x7(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x10(%rsp),%rdi
movzbl 0x8(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x12(%rsp),%rdi
movzbl 0x9(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x14(%rsp),%rdi
movzbl 0xa(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x16(%rsp),%rdi
movzbl 0xb(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x18(%rsp),%rdi
movzbl 0xc(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x1a(%rsp),%rdi
movzbl 0xd(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x1c(%rsp),%rdi
movzbl 0xe(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
lea    0x1e(%rsp),%rdi
movzbl 0xf(%rbx),%edx
mov    %r12,%rsi
call   1050 <sprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1289 <nxt128_vect_cmp+0x149>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x2d50(%rip),%rax
mov    (%rax),%edi
lea    0xd6c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2d33(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
@stderr = global i32 0
@.str.1 = [13 x i8] c"Test failedn\00"
@EXIT_FAILURE = global i32 0
define void @nxt128_vect_cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [33 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [33 x i8], [33 x i8]* %5, i64 0, i64 32
store i8 0, i8* %7
store i32 0, i32* %6
br label %8
8: ; preds = %23, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 16
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = getelementptr inbounds [33 x i8], [33 x i8]* %5, i64 0, i64 0
%13 = load i32, i32* %6
%14 = mul nsw i32 2, %13
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %12, i64 %15
%17 = load i8*, i8** %4
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %21)
br label %23
23: ; preds = %11
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %8
26: ; preds = %8
%27 = load i8*, i8** %3
%28 = getelementptr inbounds [33 x i8], [33 x i8]* %5, i64 0, i64 0
%29 = call i64 @strcmp(i8* %27, i8* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %26
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%34 = load i32, i32* @EXIT_FAILURE
%35 = call i32 @exit(i32 %34)
unreachable
36: ; preds = %26
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
@stderr = global i32 0
@.str.1 = [13 x i8] c"Test failedn\00"
@EXIT_FAILURE = global i32 0
define void @nxt128_vect_cmp(i8* %0, i8* nocapture %1) {
%3 = alloca [33 x i8]
%4 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 32
store i8 0, i8* %5
%6 = load i8, i8* %1
%7 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
%8 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 2
%9 = getelementptr inbounds i8, i8* %1, i64 1
%10 = load i8, i8* %9
%11 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %10)
%12 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 4
%13 = getelementptr inbounds i8, i8* %1, i64 2
%14 = load i8, i8* %13
%15 = call i32 @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %14)
%16 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 6
%17 = getelementptr inbounds i8, i8* %1, i64 3
%18 = load i8, i8* %17
%19 = call i32 @sprintf(i8* %16, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %18)
%20 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 8
%21 = getelementptr inbounds i8, i8* %1, i64 4
%22 = load i8, i8* %21
%23 = call i32 @sprintf(i8* %20, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %22)
%24 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 10
%25 = getelementptr inbounds i8, i8* %1, i64 5
%26 = load i8, i8* %25
%27 = call i32 @sprintf(i8* %24, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %26)
%28 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 12
%29 = getelementptr inbounds i8, i8* %1, i64 6
%30 = load i8, i8* %29
%31 = call i32 @sprintf(i8* %28, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %30)
%32 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 14
%33 = getelementptr inbounds i8, i8* %1, i64 7
%34 = load i8, i8* %33
%35 = call i32 @sprintf(i8* %32, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %34)
%36 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 16
%37 = getelementptr inbounds i8, i8* %1, i64 8
%38 = load i8, i8* %37
%39 = call i32 @sprintf(i8* %36, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %38)
%40 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 18
%41 = getelementptr inbounds i8, i8* %1, i64 9
%42 = load i8, i8* %41
%43 = call i32 @sprintf(i8* %40, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %42)
%44 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 20
%45 = getelementptr inbounds i8, i8* %1, i64 10
%46 = load i8, i8* %45
%47 = call i32 @sprintf(i8* %44, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %46)
%48 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 22
%49 = getelementptr inbounds i8, i8* %1, i64 11
%50 = load i8, i8* %49
%51 = call i32 @sprintf(i8* %48, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %50)
%52 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 24
%53 = getelementptr inbounds i8, i8* %1, i64 12
%54 = load i8, i8* %53
%55 = call i32 @sprintf(i8* %52, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %54)
%56 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 26
%57 = getelementptr inbounds i8, i8* %1, i64 13
%58 = load i8, i8* %57
%59 = call i32 @sprintf(i8* %56, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %58)
%60 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 28
%61 = getelementptr inbounds i8, i8* %1, i64 14
%62 = load i8, i8* %61
%63 = call i32 @sprintf(i8* %60, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %62)
%64 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 30
%65 = getelementptr inbounds i8, i8* %1, i64 15
%66 = load i8, i8* %65
%67 = call i32 @sprintf(i8* %64, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %66)
%68 = call i64 @strcmp(i8* %0, i8* %4)
%69 = icmp eq i64 %68, 0
br i1 %69, label %75, label %70
70: ; preds = %2
%71 = load i32, i32* @stderr
%72 = call i32 @fprintf(i32 %71, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%73 = load i32, i32* @EXIT_FAILURE
%74 = call i32 @exit(i32 %73)
unreachable
75: ; preds = %2
ret void
}