#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*/ sink(char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int /*<<< orphan*/ string_range(int);
void test_strcpy_range(void) {
  char buf[5];
  (strcpy((buf), (string_range(0))), sink((buf)));
  (strcpy((buf), (string_range(1))), sink((buf)));
  (strcpy((buf), (string_range(2))), sink((buf)));
  (strcpy((buf), (string_range(4))), sink((buf)));
  (strcpy((buf), (string_range(5))), sink((buf)));
  (strcpy((buf), (string_range(6))), sink((buf)));
  (strcpy((buf), (string_range(7))), sink((buf)));
  (strcpy((buf), (string_range(8))), sink((buf)));
  (strcpy((buf), (string_range(9))), sink((buf)));
  (strcpy((buf), (string_range(10))), sink((buf)));
  (strcpy((buf + 5), (string_range(0))), sink((buf + 5)));
  (strcpy((buf + 17), (string_range(0))), sink((buf + 17)));
}


x86 assembly (clang, -O0):
<test_strcpy_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x5(%rbp),%rax
mov    %rax,-0x68(%rbp)
xor    %edi,%edi
call   1050 <string_range@plt>
mov    -0x68(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
call   1040 <sink@plt>
lea    -0x5(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    $0x1,%edi
call   1050 <string_range@plt>
mov    -0x60(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
call   1040 <sink@plt>
lea    -0x5(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    $0x2,%edi
call   1050 <string_range@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
call   1040 <sink@plt>
lea    -0x5(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    $0x4,%edi
call   1050 <string_range@plt>
mov    -0x50(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
call   1040 <sink@plt>
lea    -0x5(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    $0x5,%edi
call   1050 <string_range@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
call   1040 <sink@plt>
lea    -0x5(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    $0x6,%edi
call   1050 <string_range@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
call   1040 <sink@plt>
lea    -0x5(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    $0x7,%edi
call   1050 <string_range@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
call   1040 <sink@plt>
lea    -0x5(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x8,%edi
call   1050 <string_range@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
call   1040 <sink@plt>
lea    -0x5(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x9,%edi
call   1050 <string_range@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
call   1040 <sink@plt>
lea    -0x5(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0xa,%edi
call   1050 <string_range@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
call   1040 <sink@plt>
lea    -0x5(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x18(%rbp)
xor    %edi,%edi
call   1050 <string_range@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
add    $0x5,%rdi
call   1040 <sink@plt>
lea    -0x5(%rbp),%rax
add    $0x11,%rax
mov    %rax,-0x10(%rbp)
xor    %edi,%edi
call   1050 <string_range@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x5(%rbp),%rdi
add    $0x11,%rdi
call   1040 <sink@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strcpy_range>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <string_range@plt>
lea    0xb(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
mov    $0x1,%edi
call   1050 <string_range@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
mov    $0x2,%edi
call   1050 <string_range@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
mov    $0x4,%edi
call   1050 <string_range@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
mov    $0x5,%edi
call   1050 <string_range@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
mov    $0x6,%edi
call   1050 <string_range@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
mov    $0x7,%edi
call   1050 <string_range@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
mov    $0x8,%edi
call   1050 <string_range@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
mov    $0x9,%edi
call   1050 <string_range@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
mov    $0xa,%edi
call   1050 <string_range@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
lea    0x10(%rsp),%rbx
xor    %edi,%edi
call   1050 <string_range@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
lea    0x1c(%rsp),%rbx
xor    %edi,%edi
call   1050 <string_range@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @test_strcpy_range() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = call i32 @string_range(i32 0)
%4 = call i32 @strcpy(i8* %2, i32 %3)
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%6 = call i32 @sink(i8* %5)
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%8 = call i32 @string_range(i32 1)
%9 = call i32 @strcpy(i8* %7, i32 %8)
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%11 = call i32 @sink(i8* %10)
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%13 = call i32 @string_range(i32 2)
%14 = call i32 @strcpy(i8* %12, i32 %13)
%15 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%16 = call i32 @sink(i8* %15)
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%18 = call i32 @string_range(i32 4)
%19 = call i32 @strcpy(i8* %17, i32 %18)
%20 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%21 = call i32 @sink(i8* %20)
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%23 = call i32 @string_range(i32 5)
%24 = call i32 @strcpy(i8* %22, i32 %23)
%25 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%26 = call i32 @sink(i8* %25)
%27 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%28 = call i32 @string_range(i32 6)
%29 = call i32 @strcpy(i8* %27, i32 %28)
%30 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%31 = call i32 @sink(i8* %30)
%32 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%33 = call i32 @string_range(i32 7)
%34 = call i32 @strcpy(i8* %32, i32 %33)
%35 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%36 = call i32 @sink(i8* %35)
%37 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%38 = call i32 @string_range(i32 8)
%39 = call i32 @strcpy(i8* %37, i32 %38)
%40 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%41 = call i32 @sink(i8* %40)
%42 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%43 = call i32 @string_range(i32 9)
%44 = call i32 @strcpy(i8* %42, i32 %43)
%45 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%46 = call i32 @sink(i8* %45)
%47 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%48 = call i32 @string_range(i32 10)
%49 = call i32 @strcpy(i8* %47, i32 %48)
%50 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%51 = call i32 @sink(i8* %50)
%52 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%53 = getelementptr inbounds i8, i8* %52, i64 5
%54 = call i32 @string_range(i32 0)
%55 = call i32 @strcpy(i8* %53, i32 %54)
%56 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%57 = getelementptr inbounds i8, i8* %56, i64 5
%58 = call i32 @sink(i8* %57)
%59 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%60 = getelementptr inbounds i8, i8* %59, i64 17
%61 = call i32 @string_range(i32 0)
%62 = call i32 @strcpy(i8* %60, i32 %61)
%63 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%64 = getelementptr inbounds i8, i8* %63, i64 17
%65 = call i32 @sink(i8* %64)
ret void
}

LLVM IR (-O2):
define void @test_strcpy_range() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @string_range(i32 0)
%4 = call i32 @strcpy(i8* %2, i32 %3)
%5 = call i32 @sink(i8* %2)
%6 = call i32 @string_range(i32 1)
%7 = call i32 @strcpy(i8* %2, i32 %6)
%8 = call i32 @sink(i8* %2)
%9 = call i32 @string_range(i32 2)
%10 = call i32 @strcpy(i8* %2, i32 %9)
%11 = call i32 @sink(i8* %2)
%12 = call i32 @string_range(i32 4)
%13 = call i32 @strcpy(i8* %2, i32 %12)
%14 = call i32 @sink(i8* %2)
%15 = call i32 @string_range(i32 5)
%16 = call i32 @strcpy(i8* %2, i32 %15)
%17 = call i32 @sink(i8* %2)
%18 = call i32 @string_range(i32 6)
%19 = call i32 @strcpy(i8* %2, i32 %18)
%20 = call i32 @sink(i8* %2)
%21 = call i32 @string_range(i32 7)
%22 = call i32 @strcpy(i8* %2, i32 %21)
%23 = call i32 @sink(i8* %2)
%24 = call i32 @string_range(i32 8)
%25 = call i32 @strcpy(i8* %2, i32 %24)
%26 = call i32 @sink(i8* %2)
%27 = call i32 @string_range(i32 9)
%28 = call i32 @strcpy(i8* %2, i32 %27)
%29 = call i32 @sink(i8* %2)
%30 = call i32 @string_range(i32 10)
%31 = call i32 @strcpy(i8* %2, i32 %30)
%32 = call i32 @sink(i8* %2)
%33 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 5
%34 = call i32 @string_range(i32 0)
%35 = call i32 @strcpy(i8* %33, i32 %34)
%36 = call i32 @sink(i8* %33)
%37 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 17
%38 = call i32 @string_range(i32 0)
%39 = call i32 @strcpy(i8* %37, i32 %38)
%40 = call i32 @sink(i8* %37)
ret void
}