#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 */
typedef int off_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_diff(off_t from, int max, const unsigned char *o,
                const unsigned char *n) {
  int i, len = max;
  if (len > 16)
    len = 16;
  printf("OLD:");
  for (i = 0; i < len; i++)
    printf(" %02x", o[from + i]);
  printf("%s\n    ", max != len ? " ..." : "");
  for (i = 0; i < len; i++)
    printf(" %2c", o[from + i] > ' ' ? o[from + i] : '.');
  printf("\nNEW:");
  for (i = 0; i < len; i++)
    printf(" %02x", n[from + i]);
  printf("%s\n    ", max != len ? " ..." : "");
  for (i = 0; i < len; i++)
    printf(" %2c", n[from + i] > ' ' ? n[from + i] : '.');
  printf("\n");
}


x86 assembly (clang, -O0):
<print_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x10,-0x20(%rbp)
jle    113d <print_diff+0x2d>
movl   $0x10,-0x20(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    118b <print_diff+0x7b>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1152 <print_diff+0x42>
mov    -0x8(%rbp),%ecx
mov    -0x20(%rbp),%edx
lea    0xe8c(%rip),%rsi
lea    0xe74(%rip),%rax
cmp    %edx,%ecx
cmovne %rax,%rsi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1225 <print_diff+0x115>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jle    11f9 <print_diff+0xe9>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x24(%rbp)
jmp    1206 <print_diff+0xf6>
mov    $0x2e,%eax
mov    %eax,-0x24(%rbp)
jmp    1206 <print_diff+0xf6>
mov    -0x24(%rbp),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ba <print_diff+0xaa>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1273 <print_diff+0x163>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    123a <print_diff+0x12a>
mov    -0x8(%rbp),%ecx
mov    -0x20(%rbp),%edx
lea    0xda4(%rip),%rsi
lea    0xd8c(%rip),%rax
cmp    %edx,%ecx
cmovne %rax,%rsi
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    130d <print_diff+0x1fd>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jle    12e1 <print_diff+0x1d1>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x28(%rbp)
jmp    12ee <print_diff+0x1de>
mov    $0x2e,%eax
mov    %eax,-0x28(%rbp)
jmp    12ee <print_diff+0x1de>
mov    -0x28(%rbp),%esi
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12a2 <print_diff+0x192>
lea    0xd0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_diff>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r12
mov    %rdx,%rbp
mov    %esi,%ebx
mov    %edi,%r14d
cmp    $0x11,%esi
mov    $0x10,%r15d
cmovl  %esi,%r15d
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    12c3 <print_diff+0x1a3>
mov    %ebx,(%rsp)
cmp    $0x2,%r15d
mov    $0x1,%r13d
cmovge %r15d,%r13d
movslq %r14d,%rax
mov    %rax,0x10(%rsp)
add    %rax,%rbp
lea    0xe86(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl 0x0(%rbp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1190 <print_diff+0x70>
mov    (%rsp),%r14d
cmp    $0x11,%r14d
lea    0xe5c(%rip),%rax
lea    0xe54(%rip),%rbx
cmovge %rax,%rbx
lea    0xe42(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
jle    12db <print_diff+0x1bb>
mov    %rbx,0x8(%rsp)
mov    %r15d,0x4(%rsp)
mov    $0x2e,%r14d
lea    0xe25(%rip),%rbx
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
movzbl 0x0(%rbp,%r15,1),%eax
cmp    $0x21,%al
cmovb  %r14d,%eax
movzbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r13
jne    1200 <print_diff+0xe0>
lea    0xdf4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%r14d
test   %r14d,%r14d
jle    12eb <print_diff+0x1cb>
add    0x10(%rsp),%r12
lea    0xdbc(%rip),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movzbl (%r12,%rbp,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1250 <print_diff+0x130>
lea    0xd9c(%rip),%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
mov    0x4(%rsp),%eax
jle    1301 <print_diff+0x1e1>
cmp    $0x2,%eax
mov    $0x1,%ebp
cmovge %eax,%ebp
mov    $0x2e,%r14d
lea    0xd7c(%rip),%r15
xor    %ebx,%ebx
xchg   %ax,%ax
movzbl (%r12,%rbx,1),%eax
cmp    $0x21,%al
cmovb  %r14d,%eax
movzbl %al,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    12a0 <print_diff+0x180>
jmp    1301 <print_diff+0x1e1>
lea    0xd41(%rip),%rdi
lea    0xd41(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd3b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12f0 <print_diff+0x1d0>
mov    0x8(%rsp),%rbx
lea    0xd14(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"OLD:\00"
@.str.1 = [6 x i8] c" %02x\00"
@.str.2 = [8 x i8] c"%s\0A \00"
@.str.3 = [5 x i8] c" ...\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [5 x i8] c" %2c\00"
@.str.6 = [6 x i8] c"\0ANEW:\00"
@.str.7 = [2 x i8] c"\0A\00"
define void @print_diff(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%11 = load i32, i32* %6
store i32 %11, i32* %10
%12 = load i32, i32* %10
%13 = icmp sgt i32 %12, 16
br i1 %13, label %14, label %15
14: ; preds = %4
store i32 16, i32* %10
br label %15
15: ; preds = %14, %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %9
br label %17
17: ; preds = %31, %15
%18 = load i32, i32* %9
%19 = load i32, i32* %10
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %34
21: ; preds = %17
%22 = load i8*, i8** %7
%23 = load i32, i32* %5
%24 = load i32, i32* %9
%25 = add nsw i32 %23, %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %22, i64 %26
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %21
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %9
br label %17
34: ; preds = %17
%35 = load i32, i32* %6
%36 = load i32, i32* %10
%37 = icmp ne i32 %35, %36
%38 = zext i1 %37 to i64
%39 = select i1 %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %39)
store i32 0, i32* %9
br label %41
41: ; preds = %68, %34
%42 = load i32, i32* %9
%43 = load i32, i32* %10
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %71
45: ; preds = %41
%46 = load i8*, i8** %7
%47 = load i32, i32* %5
%48 = load i32, i32* %9
%49 = add nsw i32 %47, %48
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %46, i64 %50
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = icmp sgt i32 %53, 32
br i1 %54, label %55, label %64
55: ; preds = %45
%56 = load i8*, i8** %7
%57 = load i32, i32* %5
%58 = load i32, i32* %9
%59 = add nsw i32 %57, %58
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %56, i64 %60
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
br label %65
64: ; preds = %45
br label %65
65: ; preds = %64, %55
%66 = phi i32 [ %63, %55 ], [ 46, %64 ]
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %66)
br label %68
68: ; preds = %65
%69 = load i32, i32* %9
%70 = add nsw i32 %69, 1
store i32 %70, i32* %9
br label %41
71: ; preds = %41
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %9
br label %73
73: ; preds = %87, %71
%74 = load i32, i32* %9
%75 = load i32, i32* %10
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %90
77: ; preds = %73
%78 = load i8*, i8** %8
%79 = load i32, i32* %5
%80 = load i32, i32* %9
%81 = add nsw i32 %79, %80
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %78, i64 %82
%84 = load i8, i8* %83
%85 = zext i8 %84 to i32
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %85)
br label %87
87: ; preds = %77
%88 = load i32, i32* %9
%89 = add nsw i32 %88, 1
store i32 %89, i32* %9
br label %73
90: ; preds = %73
%91 = load i32, i32* %6
%92 = load i32, i32* %10
%93 = icmp ne i32 %91, %92
%94 = zext i1 %93 to i64
%95 = select i1 %93, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0)
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %95)
store i32 0, i32* %9
br label %97
97: ; preds = %124, %90
%98 = load i32, i32* %9
%99 = load i32, i32* %10
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %127
101: ; preds = %97
%102 = load i8*, i8** %8
%103 = load i32, i32* %5
%104 = load i32, i32* %9
%105 = add nsw i32 %103, %104
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8, i8* %102, i64 %106
%108 = load i8, i8* %107
%109 = zext i8 %108 to i32
%110 = icmp sgt i32 %109, 32
br i1 %110, label %111, label %120
111: ; preds = %101
%112 = load i8*, i8** %8
%113 = load i32, i32* %5
%114 = load i32, i32* %9
%115 = add nsw i32 %113, %114
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i8, i8* %112, i64 %116
%118 = load i8, i8* %117
%119 = zext i8 %118 to i32
br label %121
120: ; preds = %101
br label %121
121: ; preds = %120, %111
%122 = phi i32 [ %119, %111 ], [ 46, %120 ]
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %122)
br label %124
124: ; preds = %121
%125 = load i32, i32* %9
%126 = add nsw i32 %125, 1
store i32 %126, i32* %9
br label %97
127: ; preds = %97
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"OLD:\00"
@.str.1 = [6 x i8] c" %02x\00"
@.str.2 = [8 x i8] c"%s\0A \00"
@.str.3 = [5 x i8] c" ...\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [5 x i8] c" %2c\00"
@.str.6 = [6 x i8] c"\0ANEW:\00"
define void @print_diff(i32 %0, i32 %1, i8* nocapture %2, i8* nocapture %3) {
%5 = icmp sgt i32 %1, 16
%6 = select i1 %5, i32 16, i32 %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = icmp sgt i32 %1, 0
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %42
11: ; preds = %4
%12 = sext i32 %0 to i64
%13 = call i32 @llvm.smax.i32(i32 %6, i32 1)
%14 = zext i32 %13 to i64
br label %15
15: ; preds = %11, %15
%16 = phi i64 [ 0, %11 ], [ %22, %15 ]
%17 = add nsw i64 %16, %12
%18 = getelementptr inbounds i8, i8* %2, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = add nuw nsw i64 %16, 1
%23 = icmp eq i64 %22, %14
br i1 %23, label %24, label %15
24: ; preds = %15
%25 = select i1 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br i1 %8, label %27, label %42
27: ; preds = %24
%28 = sext i32 %0 to i64
%29 = call i32 @llvm.smax.i32(i32 %6, i32 1)
%30 = zext i32 %29 to i64
br label %31
31: ; preds = %27, %31
%32 = phi i64 [ 0, %27 ], [ %40, %31 ]
%33 = add nsw i64 %32, %28
%34 = getelementptr inbounds i8, i8* %2, i64 %33
%35 = load i8, i8* %34
%36 = icmp ugt i8 %35, 32
%37 = select i1 %36, i8 %35, i8 46
%38 = zext i8 %37 to i32
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %38)
%40 = add nuw nsw i64 %32, 1
%41 = icmp eq i64 %40, %30
br i1 %41, label %45, label %31
42: ; preds = %9, %24
%43 = phi i8* [ %25, %24 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), %9 ]
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %60
45: ; preds = %31
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br i1 %8, label %47, label %60
47: ; preds = %45
%48 = sext i32 %0 to i64
%49 = call i32 @llvm.smax.i32(i32 %6, i32 1)
%50 = zext i32 %49 to i64
br label %51
51: ; preds = %47, %51
%52 = phi i64 [ 0, %47 ], [ %58, %51 ]
%53 = add nsw i64 %52, %48
%54 = getelementptr inbounds i8, i8* %3, i64 %53
%55 = load i8, i8* %54
%56 = zext i8 %55 to i32
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = add nuw nsw i64 %52, 1
%59 = icmp eq i64 %58, %50
br i1 %59, label %63, label %51
60: ; preds = %42, %45
%61 = phi i8* [ %25, %45 ], [ %43, %42 ]
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %61)
br label %80
63: ; preds = %51
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br i1 %8, label %65, label %80
65: ; preds = %63
%66 = sext i32 %0 to i64
%67 = call i32 @llvm.smax.i32(i32 %6, i32 1)
%68 = zext i32 %67 to i64
br label %69
69: ; preds = %65, %69
%70 = phi i64 [ 0, %65 ], [ %78, %69 ]
%71 = add nsw i64 %70, %66
%72 = getelementptr inbounds i8, i8* %3, i64 %71
%73 = load i8, i8* %72
%74 = icmp ugt i8 %73, 32
%75 = select i1 %74, i8 %73, i8 46
%76 = zext i8 %75 to i32
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %76)
%78 = add nuw nsw i64 %70, 1
%79 = icmp eq i64 %78, %68
br i1 %79, label %80, label %69
80: ; preds = %69, %60, %63
%81 = tail call i32 @putchar(i32 10)
ret void
}