#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 /*<<< orphan*/ s2;
typedef int /*<<< orphan*/ s1;

/* Variables and functions */
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ ext_memcmp(char *, char *, int);
int main(int argc, char *argv[]) {
  char s1[32] = {0};
  char s2[32] = {0};
  bzero(s1, sizeof(s1));
  bzero(s2, sizeof(s2));
  int i = 0;
  for (i = 0; i < 10; i++) {
    s1[i] = i;
    s2[i] = i;
  }
  for (; i < 20; i++) {
    s1[i] = i + 20;
    s2[i] = i + 50;
  }
  ext_memcmp(s1, s2, 10);
  ext_memcmp(s1, s2, 12);
  ext_memcmp(s1, s2, 16);
  ext_memcmp(s1, s2, 20);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
lea    -0x30(%rbp),%rdi
mov    $0x20,%esi
call   1050 <bzero@plt>
lea    -0x50(%rbp),%rdi
mov    $0x20,%esi
call   1050 <bzero@plt>
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    11c2 <main+0x92>
mov    -0x54(%rbp),%eax
mov    %al,%cl
movslq -0x54(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x54(%rbp),%eax
mov    %al,%cl
movslq -0x54(%rbp),%rax
mov    %cl,-0x50(%rbp,%rax,1)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1190 <main+0x60>
jmp    11c7 <main+0x97>
cmpl   $0x14,-0x54(%rbp)
jge    11ff <main+0xcf>
mov    -0x54(%rbp),%eax
add    $0x14,%eax
mov    %al,%cl
movslq -0x54(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x54(%rbp),%eax
add    $0x32,%eax
mov    %al,%cl
movslq -0x54(%rbp),%rax
mov    %cl,-0x50(%rbp,%rax,1)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11c7 <main+0x97>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0xa,%edx
call   1030 <ext_memcmp@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0xc,%edx
call   1030 <ext_memcmp@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
call   1030 <ext_memcmp@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x14,%edx
call   1030 <ext_memcmp@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x20,%esi
call   1040 <bzero@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1040 <bzero@plt>
movaps 0xea3(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x27262524,0x30(%rsp)
27
movl   $0x45444342,0x10(%rsp)
45
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1030 <ext_memcmp@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0xc,%edx
call   1030 <ext_memcmp@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1030 <ext_memcmp@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x14,%edx
call   1030 <ext_memcmp@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [32 x i8]
%7 = alloca [32 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [32 x i8]* %6 to i8*
%10 = bitcast [32 x i8]* %7 to i8*
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%12 = call i32 @bzero(i8* %11, i32 32)
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%14 = call i32 @bzero(i8* %13, i32 32)
store i32 0, i32* %8
store i32 0, i32* %8
br label %15
15: ; preds = %29, %2
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 10
br i1 %17, label %18, label %32
18: ; preds = %15
%19 = load i32, i32* %8
%20 = trunc i32 %19 to i8
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 %22
store i8 %20, i8* %23
%24 = load i32, i32* %8
%25 = trunc i32 %24 to i8
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 %27
store i8 %25, i8* %28
br label %29
29: ; preds = %18
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
br label %15
32: ; preds = %15
br label %33
33: ; preds = %49, %32
%34 = load i32, i32* %8
%35 = icmp slt i32 %34, 20
br i1 %35, label %36, label %52
36: ; preds = %33
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 20
%39 = trunc i32 %38 to i8
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 %41
store i8 %39, i8* %42
%43 = load i32, i32* %8
%44 = add nsw i32 %43, 50
%45 = trunc i32 %44 to i8
%46 = load i32, i32* %8
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 %47
store i8 %45, i8* %48
br label %49
49: ; preds = %36
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %33
52: ; preds = %33
%53 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%54 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%55 = call i32 @ext_memcmp(i8* %53, i8* %54, i32 10)
%56 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%57 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%58 = call i32 @ext_memcmp(i8* %56, i8* %57, i32 12)
%59 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%60 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%61 = call i32 @ext_memcmp(i8* %59, i8* %60, i32 16)
%62 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%63 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%64 = call i32 @ext_memcmp(i8* %62, i8* %63, i32 20)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 16
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 16
%9 = call i32 @bzero(i8* %5, i32 32)
%10 = call i32 @bzero(i8* %7, i32 32)
%11 = bitcast [32 x i8]* %3 to <16 x i8>*
store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 30, i8 31, i8 32, i8 33, i8 34, i8 35>, <16 x i8>* %11
%12 = bitcast [32 x i8]* %4 to <16 x i8>*
store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 60, i8 61, i8 62, i8 63, i8 64, i8 65>, <16 x i8>* %12
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 16
store i8 36, i8* %13
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 16
store i8 66, i8* %14
%15 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 17
store i8 37, i8* %15
%16 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 17
store i8 67, i8* %16
%17 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 18
store i8 38, i8* %17
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 18
store i8 68, i8* %18
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 19
store i8 39, i8* %19
%20 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 19
store i8 69, i8* %20
%21 = call i32 @ext_memcmp(i8* %5, i8* %7, i32 10)
%22 = call i32 @ext_memcmp(i8* %5, i8* %7, i32 12)
%23 = call i32 @ext_memcmp(i8* %5, i8* %7, i32 16)
%24 = call i32 @ext_memcmp(i8* %5, i8* %7, i32 20)
ret i32 0
}