#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*/ cp(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int test_cp(void) {
  int _fail_count = 0;
  if (!(!cp("/no/such/file", "unused"))) {
    printf("test %s failed\n", "invalid cp source");
    _fail_count++;
  };
  if (!(!cp("resources/config.ini", "/no/such/file"))) {
    printf("test %s failed\n", "invalid cp dest");
    _fail_count++;
  };
  return _fail_count;
}


x86 assembly (clang, -O0):
<test_cp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1030 <cp@plt>
cmp    $0x0,%eax
je     1167 <test_cp+0x47>
lea    0xec3(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    0xec9(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <cp@plt>
cmp    $0x0,%eax
je     119f <test_cp+0x7f>
lea    0xe8b(%rip),%rdi
lea    0xebb(%rip),%rsi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_cp>:
push   %rbx
lea    0xed8(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1030 <cp@plt>
test   %eax,%eax
je     1152 <test_cp+0x32>
lea    0xed6(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1040 <printf@plt>
mov    $0x1,%ebx
jmp    1154 <test_cp+0x34>
xor    %ebx,%ebx
lea    0xedc(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1030 <cp@plt>
test   %eax,%eax
je     1181 <test_cp+0x61>
lea    0xea3(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1040 <printf@plt>
add    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/no/such/file\00"
@.str.1 = [7 x i8] c"unused\00"
@.str.2 = [16 x i8] c"test %s failed\0A\00"
@.str.3 = [18 x i8] c"invalid cp source\00"
@.str.4 = [21 x i8] c"resources/config.ini\00"
@.str.5 = [16 x i8] c"invalid cp dest\00"
define i32 @test_cp() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @cp(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp ne i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 1
store i32 %7, i32* %1
br label %8
8: ; preds = %4, %0
%9 = call i32 @cp(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %15
15: ; preds = %11, %8
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str = [14 x i8] c"/no/such/file\00"
@.str.1 = [7 x i8] c"unused\00"
@.str.2 = [16 x i8] c"test %s failed\0A\00"
@.str.3 = [18 x i8] c"invalid cp source\00"
@.str.4 = [21 x i8] c"resources/config.ini\00"
@.str.5 = [16 x i8] c"invalid cp dest\00"
define i32 @test_cp() {
%1 = tail call i32 @cp(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = phi i32 [ 1, %3 ], [ 0, %0 ]
%7 = tail call i32 @cp(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%11 = add nuw nsw i32 %6, 1
br label %12
12: ; preds = %9, %5
%13 = phi i32 [ %11, %9 ], [ %6, %5 ]
ret i32 %13
}