#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 verify_output(size_t test_len, size_t good_len, char *test_out,
                  char *good_out) {
  if (test_len != good_len) {
    printf("Length mismatch [%zd != %zd]\n", test_len, good_len);
    return 0;
  }
  for (size_t i = 0; i < good_len; i++) {
    if (test_out[i] != good_out[i]) {
      printf("Output mismatch at %zd\n", i);
      return 0;
    }
  }
  printf("\n");
  return 1;
}


x86 assembly (clang, -O0):
<verify_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     1158 <verify_output+0x48>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d7 <verify_output+0xc7>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11c2 <verify_output+0xb2>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     11ac <verify_output+0x9c>
mov    -0x30(%rbp),%rsi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d7 <verify_output+0xc7>
jmp    11b1 <verify_output+0xa1>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1160 <verify_output+0x50>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_output>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rax
cmp    %rsi,%rdi
jne    1163 <verify_output+0x43>
test   %rax,%rax
je     1152 <verify_output+0x32>
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdx,%rsi,1),%ebx
cmp    (%rcx,%rsi,1),%bl
jne    117e <verify_output+0x5e>
add    $0x1,%rsi
cmp    %rsi,%rax
jne    1140 <verify_output+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebp
jmp    118e <verify_output+0x6e>
mov    %rsi,%rbx
lea    0xe93(%rip),%rdi
xor    %ebp,%ebp
mov    %rax,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    118e <verify_output+0x6e>
lea    0xe99(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Length mismatch [%zd != %zd]\0A\00"
@.str.1 = [24 x i8] c"Output mismatch at %zd\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @verify_output(i64 %0, i64 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
store i64 %0, i64* %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%11 = load i64, i64* %6
%12 = load i64, i64* %7
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %18
14: ; preds = %4
%15 = load i64, i64* %6
%16 = load i64, i64* %7
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i64 %15, i64 %16)
store i32 0, i32* %5
br label %44
18: ; preds = %4
store i64 0, i64* %10
br label %19
19: ; preds = %39, %18
%20 = load i64, i64* %10
%21 = load i64, i64* %7
%22 = icmp ult i64 %20, %21
br i1 %22, label %23, label %42
23: ; preds = %19
%24 = load i8*, i8** %8
%25 = load i64, i64* %10
%26 = getelementptr inbounds i8, i8* %24, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = load i8*, i8** %9
%30 = load i64, i64* %10
%31 = getelementptr inbounds i8, i8* %29, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %28, %33
br i1 %34, label %35, label %38
35: ; preds = %23
%36 = load i64, i64* %10
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %36)
store i32 0, i32* %5
br label %44
38: ; preds = %23
br label %39
39: ; preds = %38
%40 = load i64, i64* %10
%41 = add i64 %40, 1
store i64 %41, i64* %10
br label %19
42: ; preds = %19
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %5
br label %44
44: ; preds = %42, %35, %14
%45 = load i32, i32* %5
ret i32 %45
}

LLVM IR (-O2):
@.str = [30 x i8] c"Length mismatch [%zd != %zd]\0A\00"
@.str.1 = [24 x i8] c"Output mismatch at %zd\0A\00"
define i32 @verify_output(i64 %0, i64 %1, i8* nocapture %2, i8* nocapture %3) {
%5 = icmp eq i64 %0, %1
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = icmp eq i64 %0, 0
br i1 %7, label %22, label %10
8: ; preds = %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %1)
br label %24
10: ; preds = %6, %17
%11 = phi i64 [ %18, %17 ], [ 0, %6 ]
%12 = getelementptr inbounds i8, i8* %2, i64 %11
%13 = load i8, i8* %12
%14 = getelementptr inbounds i8, i8* %3, i64 %11
%15 = load i8, i8* %14
%16 = icmp eq i8 %13, %15
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = add nuw i64 %11, 1
%19 = icmp eq i64 %18, %0
br i1 %19, label %22, label %10
20: ; preds = %10
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %11)
br label %24
22: ; preds = %17, %6
%23 = tail call i32 @putchar(i32 10)
br label %24
24: ; preds = %20, %22, %8
%25 = phi i32 [ 0, %8 ], [ 0, %20 ], [ 1, %22 ]
ret i32 %25
}