#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*/ scanf(char *, int *, int *);
int /*<<< orphan*/ set_bit(int *, int, int);
void fill_array(int str[], int copy[], size_t size) {
  int i, x, y;
  for (i = 0; i < size; i++) {
    scanf("%d %d%*c", &x, &y);
    set_bit(&str[x], y, 1);
    copy[x] = str[x];
  }
}


x86 assembly (clang, -O0):
<fill_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    119d <fill_array+0x7d>
lea    0xeb0(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rdi
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x24(%rbp),%esi
mov    $0x1,%edx
call   1030 <set_bit@plt>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113b <fill_array+0x1b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     1186 <fill_array+0x66>
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xec0(%rip),%r12
mov    %rsp,%r13
lea    0x4(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
call   1040 <scanf@plt>
movslq (%rsp),%rax
lea    (%r15,%rax,4),%rdi
mov    0x4(%rsp),%esi
mov    $0x1,%edx
call   1030 <set_bit@plt>
movslq (%rsp),%rax
mov    (%r15,%rax,4),%ecx
mov    %ecx,(%r14,%rax,4)
add    $0xffffffffffffffff,%rbx
jne    1150 <fill_array+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d%*c\00"
define void @fill_array(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
store i32 0, i32* %7
br label %10
10: ; preds = %32, %3
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = load i64, i64* %6
%14 = icmp ult i64 %12, %13
br i1 %14, label %15, label %35
15: ; preds = %10
%16 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %8, i32* %9)
%17 = load i32*, i32** %4
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %9
%22 = call i32 @set_bit(i32* %20, i32 %21, i32 1)
%23 = load i32*, i32** %4
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = load i32*, i32** %5
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 %27, i32* %31
br label %32
32: ; preds = %15
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %10
35: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d%*c\00"
define void @fill_array(i32* %0, i32* nocapture writeonly %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = icmp eq i64 %2, 0
br i1 %8, label %24, label %9
9: ; preds = %3, %9
%10 = phi i64 [ %22, %9 ], [ 0, %3 ]
%11 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5)
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %5
%16 = call i32 @set_bit(i32* %14, i32 %15, i32 1)
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = load i32, i32* %19
%21 = getelementptr inbounds i32, i32* %1, i64 %18
store i32 %20, i32* %21
%22 = add nuw i64 %10, 1
%23 = icmp eq i64 %22, %2
br i1 %23, label %24, label %9
24: ; preds = %9, %3
ret void
}