#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 rand();
int same_birthday(int people) {
  int year[365] = {0};
  for (int i = 0; i < people; i++) {
    year[rand() % 365]++;
  }
  for (int i = 0; i < 365; i++) {
    if (year[i] > 1)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<same_birthday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5d0,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x5c0(%rbp),%rdi
xor    %esi,%esi
mov    $0x5b4,%edx
call   1030 <memset@plt>
movl   $0x0,-0x5c4(%rbp)
mov    -0x5c4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1191 <same_birthday+0x71>
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x16d,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    -0x5c0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x5c0(%rbp,%rax,4)
mov    -0x5c4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c4(%rbp)
jmp    114b <same_birthday+0x2b>
movl   $0x0,-0x5c8(%rbp)
cmpl   $0x16d,-0x5c8(%rbp)
jge    11e5 <same_birthday+0xc5>
movslq -0x5c8(%rbp),%rax
cmpl   $0x1,-0x5c0(%rbp,%rax,4)
01
jle    11cc <same_birthday+0xac>
movl   $0x1,-0x4(%rbp)
jmp    11ec <same_birthday+0xcc>
jmp    11d1 <same_birthday+0xb1>
mov    -0x5c8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c8(%rbp)
jmp    119b <same_birthday+0x7b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<same_birthday>:
push   %rbx
sub    $0x5c0,%rsp
mov    %edi,%ebx
mov    %rsp,%rdi
mov    $0x5b4,%edx
xor    %esi,%esi
call   1030 <memset@plt>
test   %ebx,%ebx
jle    1173 <same_birthday+0x53>
nopl   (%rax)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0xffffffffb38cf9b1,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x8,%ecx
add    %edx,%ecx
imul   $0x16d,%ecx,%ecx
sub    %ecx,%eax
cltq
addl   $0x1,(%rsp,%rax,4)
add    $0xffffffff,%ebx
jne    1140 <same_birthday+0x20>
mov    $0x1,%al
cmpl   $0x1,(%rsp)
jg     11c1 <same_birthday+0xa1>
xor    %ecx,%ecx
nopl   (%rax)
cmpl   $0x1,0x4(%rsp,%rcx,4)
jg     11c1 <same_birthday+0xa1>
cmpl   $0x1,0x8(%rsp,%rcx,4)
jg     11c1 <same_birthday+0xa1>
cmpl   $0x1,0xc(%rsp,%rcx,4)
jg     11c1 <same_birthday+0xa1>
cmpl   $0x1,0x10(%rsp,%rcx,4)
jg     11c1 <same_birthday+0xa1>
cmp    $0x168,%rcx
je     11be <same_birthday+0x9e>
lea    0x5(%rcx),%rdx
cmpl   $0x2,0x14(%rsp,%rcx,4)
mov    %rdx,%rcx
jl     1180 <same_birthday+0x60>
add    $0xfffffffffffffffb,%rdx
cmp    $0x168,%rdx
setb   %al
movzbl %al,%eax
add    $0x5c0,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @same_birthday(i32 %0) {
%2 = alloca [365 x i32]
%3 = bitcast [365 x i32]* %2 to i8*
%4 = icmp sgt i32 %0, 0
br i1 %4, label %9, label %5
5: ; preds = %9, %1
%6 = getelementptr inbounds [365 x i32], [365 x i32]* %2, i64 0, i64 0
%7 = load i32, i32* %6
%8 = icmp sgt i32 %7, 1
br i1 %8, label %51, label %19
9: ; preds = %1, %9
%10 = phi i32 [ %17, %9 ], [ 0, %1 ]
%11 = tail call i32 (...) @rand()
%12 = srem i32 %11, 365
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [365 x i32], [365 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %14
%17 = add nuw nsw i32 %10, 1
%18 = icmp eq i32 %17, %0
br i1 %18, label %5, label %9
19: ; preds = %5, %43
%20 = phi i64 [ %41, %43 ], [ 0, %5 ]
%21 = add nuw nsw i64 %20, 1
%22 = getelementptr inbounds [365 x i32], [365 x i32]* %2, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp sgt i32 %23, 1
br i1 %24, label %51, label %25
25: ; preds = %19
%26 = add nuw nsw i64 %20, 2
%27 = getelementptr inbounds [365 x i32], [365 x i32]* %2, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = icmp sgt i32 %28, 1
br i1 %29, label %51, label %30
30: ; preds = %25
%31 = add nuw nsw i64 %20, 3
%32 = getelementptr inbounds [365 x i32], [365 x i32]* %2, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = icmp sgt i32 %33, 1
br i1 %34, label %51, label %35
35: ; preds = %30
%36 = add nuw nsw i64 %20, 4
%37 = getelementptr inbounds [365 x i32], [365 x i32]* %2, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = icmp sgt i32 %38, 1
br i1 %39, label %51, label %40
40: ; preds = %35
%41 = add nuw nsw i64 %20, 5
%42 = icmp eq i64 %41, 365
br i1 %42, label %49, label %43
43: ; preds = %40
%44 = getelementptr inbounds [365 x i32], [365 x i32]* %2, i64 0, i64 %41
%45 = load i32, i32* %44
%46 = icmp sgt i32 %45, 1
br i1 %46, label %47, label %19
47: ; preds = %43
%48 = icmp ult i64 %20, 360
br label %51
49: ; preds = %40
%50 = icmp ult i64 %20, 360
br label %51
51: ; preds = %47, %49, %35, %30, %25, %19, %5
%52 = phi i1 [ true, %5 ], [ %48, %47 ], [ %50, %49 ], [ true, %35 ], [ true, %30 ], [ true, %25 ], [ true, %19 ]
%53 = zext i1 %52 to i32
ret i32 %53
}