#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*/ abort();
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memset(char *, int, int);
int main() {
  char A[30], B[30], C[30];
  int i;
  memset(A, 1, 30);
  memset(B, 1, 30);
  for (i = 20; i-- > 10;) {
    A[i] = 0;
    B[i] = 0;
  }
  memset(C, 1, 30);
  memset(C + 10, 0, 10);
  if (memcmp(A, C, 30) || memcmp(B, C, 30))
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x1,%esi
mov    $0x1e,%edx
call   1040 <memset@plt>
lea    -0x50(%rbp),%rdi
mov    $0x1,%esi
mov    $0x1e,%edx
call   1040 <memset@plt>
movl   $0x14,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x74(%rbp)
cmp    $0xa,%eax
jle    119a <main+0x6a>
movslq -0x74(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
movslq -0x74(%rbp),%rax
movb   $0x0,-0x50(%rbp,%rax,1)
jmp    116f <main+0x3f>
lea    -0x70(%rbp),%rdi
mov    $0x1,%esi
mov    $0x1e,%edx
call   1040 <memset@plt>
lea    -0x70(%rbp),%rdi
add    $0xa,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <memset@plt>
lea    -0x30(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x1e,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
jne    11f9 <main+0xc9>
lea    -0x50(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x1e,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     1200 <main+0xd0>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0x40(%rsp),%r14
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1e,%edx
call   1040 <memset@plt>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x1e,%edx
call   1040 <memset@plt>
movq   $0x0,0x4a(%rsp)
movw   $0x0,0x52(%rsp)
movq   $0x0,0xa(%rsp)
movw   $0x0,0x12(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1e,%edx
call   1040 <memset@plt>
lea    0x2a(%rsp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1e,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
jne    11de <main+0xae>
mov    %rsp,%rdi
lea    0x20(%rsp),%rsi
mov    $0x1e,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
jne    11de <main+0xae>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%7 = call i32 @memset(i8* %6, i32 1, i32 30)
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 1, i32 30)
store i32 20, i32* %5
br label %10
10: ; preds = %14, %0
%11 = load i32, i32* %5
%12 = add nsw i32 %11, -1
store i32 %12, i32* %5
%13 = icmp sgt i32 %11, 10
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %16
store i8 0, i8* %17
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 %19
store i8 0, i8* %20
br label %10
21: ; preds = %10
%22 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%23 = call i32 @memset(i8* %22, i32 1, i32 30)
%24 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%25 = getelementptr inbounds i8, i8* %24, i64 10
%26 = call i32 @memset(i8* %25, i32 0, i32 10)
%27 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%28 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%29 = call i64 @memcmp(i8* %27, i8* %28, i32 30)
%30 = icmp ne i64 %29, 0
br i1 %30, label %36, label %31
31: ; preds = %21
%32 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%33 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%34 = call i64 @memcmp(i8* %32, i8* %33, i32 30)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31, %21
%37 = call i32 (...) @abort()
unreachable
38: ; preds = %31
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [30 x i8]
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%7 = call i32 @memset(i8* %4, i32 1, i32 30)
%8 = call i32 @memset(i8* %5, i32 1, i32 30)
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 10
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 10
%11 = call i32 @memset(i8* %6, i32 1, i32 30)
%12 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 10
%13 = call i32 @memset(i8* %12, i32 0, i32 10)
%14 = call i64 @memcmp(i8* %4, i8* %6, i32 30)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = call i64 @memcmp(i8* %5, i8* %6, i32 30)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16, %0
%20 = call i32 (...) @abort()
unreachable
21: ; preds = %16
ret i32 0
}