#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 */
struct ic_type_param {
  int dummy;
};
struct ic_pvector {
  int dummy;
};

/* Variables and functions */
int ic_pvector_append(struct ic_pvector *, struct ic_type_param *);
struct ic_type_param *ic_pvector_get(struct ic_pvector *, unsigned int);
int /*<<< orphan*/ ic_pvector_init(struct ic_pvector *, unsigned int);
unsigned int ic_pvector_length(struct ic_pvector *);
struct ic_type_param *ic_type_param_deep_copy(struct ic_type_param *);
int /*<<< orphan*/ puts(char *);
unsigned int ic_type_param_pvector_deep_copy_embedded(struct ic_pvector *from,
                                                      struct ic_pvector *to) {
  unsigned int i = 0;
  unsigned int len = 0;
  struct ic_type_param *from_tparam = 0;
  struct ic_type_param *to_tparam = 0;
  if (!from) {
    puts("ic_type_param_pvector_deep_copy_embedded: from was null");
    return 0;
  }
  if (!to) {
    puts("ic_type_param_pvector_deep_copy_embedded: to was null");
    return 0;
  }
  len = ic_pvector_length(from);
  if (!ic_pvector_init(to, len)) {
    puts("ic_type_param_pvector_deep_copy_embedded: call to ic_pvector_init "
         "failed");
    return 0;
  }
  for (i = 0; i < len; ++i) {
    from_tparam = ic_pvector_get(from, i);
    if (!from_tparam) {
      puts("ic_type_param_pvector_deep_copy_embedded: call to ic_pvector_get "
           "failed");
      return 0;
    }
    to_tparam = ic_type_param_deep_copy(from_tparam);
    if (!to_tparam) {
      puts("ic_type_param_pvector_deep_copy_embedded: call to "
           "ic_type_param_deep_copy failed");
      return 0;
    }
    if ((int)i != ic_pvector_append(to, to_tparam)) {
      puts("ic_type_param_pvector_deep_copy_embedded: call to "
           "ic_pvector_append failed");
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<ic_type_param_pvector_deep_copy_embedded>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b1 <ic_type_param_pvector_deep_copy_embedded+0x51>
lea    0xe60(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d5 <ic_type_param_pvector_deep_copy_embedded+0x175>
cmpq   $0x0,-0x18(%rbp)
jne    11d4 <ic_type_param_pvector_deep_copy_embedded+0x74>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d5 <ic_type_param_pvector_deep_copy_embedded+0x175>
mov    -0x10(%rbp),%rdi
call   1070 <ic_pvector_length@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1040 <ic_pvector_init@plt>
cmp    $0x0,%eax
jne    120d <ic_type_param_pvector_deep_copy_embedded+0xad>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d5 <ic_type_param_pvector_deep_copy_embedded+0x175>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jae    12ce <ic_type_param_pvector_deep_copy_embedded+0x16e>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1060 <ic_pvector_get@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1253 <ic_type_param_pvector_deep_copy_embedded+0xf3>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d5 <ic_type_param_pvector_deep_copy_embedded+0x175>
mov    -0x28(%rbp),%rdi
call   1050 <ic_type_param_deep_copy@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1283 <ic_type_param_pvector_deep_copy_embedded+0x123>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d5 <ic_type_param_pvector_deep_copy_embedded+0x175>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1080 <ic_pvector_append@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
je     12bb <ic_type_param_pvector_deep_copy_embedded+0x15b>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d5 <ic_type_param_pvector_deep_copy_embedded+0x175>
jmp    12c0 <ic_type_param_pvector_deep_copy_embedded+0x160>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1214 <ic_type_param_pvector_deep_copy_embedded+0xb4>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_type_param_pvector_deep_copy_embedded>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     11e5 <ic_type_param_pvector_deep_copy_embedded+0x85>
mov    %rsi,%r14
test   %rsi,%rsi
je     11ee <ic_type_param_pvector_deep_copy_embedded+0x8e>
mov    %rdi,%rbx
call   1070 <ic_pvector_length@plt>
mov    %eax,%r13d
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <ic_pvector_init@plt>
test   %eax,%eax
je     11f7 <ic_type_param_pvector_deep_copy_embedded+0x97>
mov    $0x1,%r12d
test   %r13d,%r13d
je     121b <ic_type_param_pvector_deep_copy_embedded+0xbb>
xor    %ebp,%ebp
lea    0xf12(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <ic_pvector_get@plt>
test   %rax,%rax
je     1210 <ic_type_param_pvector_deep_copy_embedded+0xb0>
mov    %rax,%rdi
call   1050 <ic_type_param_deep_copy@plt>
test   %rax,%rax
je     1200 <ic_type_param_pvector_deep_copy_embedded+0xa0>
mov    %r14,%rdi
mov    %rax,%rsi
call   1080 <ic_pvector_append@plt>
cmp    %eax,%ebp
jne    1209 <ic_type_param_pvector_deep_copy_embedded+0xa9>
add    $0x1,%ebp
cmp    %ebp,%r13d
jne    11b0 <ic_type_param_pvector_deep_copy_embedded+0x50>
jmp    121b <ic_type_param_pvector_deep_copy_embedded+0xbb>
lea    0xe14(%rip),%r15
jmp    1210 <ic_type_param_pvector_deep_copy_embedded+0xb0>
lea    0xe43(%rip),%r15
jmp    1210 <ic_type_param_pvector_deep_copy_embedded+0xb0>
lea    0xe70(%rip),%r15
jmp    1210 <ic_type_param_pvector_deep_copy_embedded+0xb0>
lea    0xef8(%rip),%r15
jmp    1210 <ic_type_param_pvector_deep_copy_embedded+0xb0>
lea    0xf40(%rip),%r15
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %r12d,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ic_pvector = type { i32 }
%struct.ic_type_param = type { i32 }
@.str = [56 x i8] c"ic_type_param_pvector_deep_copy_embedded: from was null\00"
@.str.1 = [54 x i8] c"ic_type_param_pvector_deep_copy_embedded: to was null\00"
@.str.2 = [73 x i8] c"ic_type_param_pvector_deep_copy_embedded: call to ic_pvector_init failed\00"
@.str.3 = [72 x i8] c"ic_type_param_pvector_deep_copy_embedded: call to ic_pvector_get failed\00"
@.str.4 = [81 x i8] c"ic_type_param_pvector_deep_copy_embedded: call to ic_type_param_deep_copy failed\00"
@.str.5 = [75 x i8] c"ic_type_param_pvector_deep_copy_embedded: call to ic_pvector_append failed\00"
define i32 @ic_type_param_pvector_deep_copy_embedded(%struct.ic_pvector* %0, %struct.ic_pvector* %1) {
%3 = alloca i32
%4 = alloca %struct.ic_pvector*
%5 = alloca %struct.ic_pvector*
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.ic_type_param*
%9 = alloca %struct.ic_type_param*
store %struct.ic_pvector* %0, %struct.ic_pvector** %4
store %struct.ic_pvector* %1, %struct.ic_pvector** %5
store i32 0, i32* %6
store i32 0, i32* %7
store %struct.ic_type_param* null, %struct.ic_type_param** %8
store %struct.ic_type_param* null, %struct.ic_type_param** %9
%10 = load %struct.ic_pvector*, %struct.ic_pvector** %4
%11 = icmp ne %struct.ic_pvector* %10, null
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = call i32 @puts(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %61
14: ; preds = %2
%15 = load %struct.ic_pvector*, %struct.ic_pvector** %5
%16 = icmp ne %struct.ic_pvector* %15, null
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = call i32 @puts(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %61
19: ; preds = %14
%20 = load %struct.ic_pvector*, %struct.ic_pvector** %4
%21 = call i32 @ic_pvector_length(%struct.ic_pvector* %20)
store i32 %21, i32* %7
%22 = load %struct.ic_pvector*, %struct.ic_pvector** %5
%23 = load i32, i32* %7
%24 = call i32 @ic_pvector_init(%struct.ic_pvector* %22, i32 %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %19
%27 = call i32 @puts(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %61
28: ; preds = %19
store i32 0, i32* %6
br label %29
29: ; preds = %57, %28
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = icmp ult i32 %30, %31
br i1 %32, label %33, label %60
33: ; preds = %29
%34 = load %struct.ic_pvector*, %struct.ic_pvector** %4
%35 = load i32, i32* %6
%36 = call %struct.ic_type_param* @ic_pvector_get(%struct.ic_pvector* %34, i32 %35)
store %struct.ic_type_param* %36, %struct.ic_type_param** %8
%37 = load %struct.ic_type_param*, %struct.ic_type_param** %8
%38 = icmp ne %struct.ic_type_param* %37, null
br i1 %38, label %41, label %39
39: ; preds = %33
%40 = call i32 @puts(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %61
41: ; preds = %33
%42 = load %struct.ic_type_param*, %struct.ic_type_param** %8
%43 = call %struct.ic_type_param* @ic_type_param_deep_copy(%struct.ic_type_param* %42)
store %struct.ic_type_param* %43, %struct.ic_type_param** %9
%44 = load %struct.ic_type_param*, %struct.ic_type_param** %9
%45 = icmp ne %struct.ic_type_param* %44, null
br i1 %45, label %48, label %46
46: ; preds = %41
%47 = call i32 @puts(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %61
48: ; preds = %41
%49 = load i32, i32* %6
%50 = load %struct.ic_pvector*, %struct.ic_pvector** %5
%51 = load %struct.ic_type_param*, %struct.ic_type_param** %9
%52 = call i32 @ic_pvector_append(%struct.ic_pvector* %50, %struct.ic_type_param* %51)
%53 = icmp ne i32 %49, %52
br i1 %53, label %54, label %56
54: ; preds = %48
%55 = call i32 @puts(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %61
56: ; preds = %48
br label %57
57: ; preds = %56
%58 = load i32, i32* %6
%59 = add i32 %58, 1
store i32 %59, i32* %6
br label %29
60: ; preds = %29
store i32 1, i32* %3
br label %61
61: ; preds = %60, %54, %46, %39, %26, %17, %12
%62 = load i32, i32* %3
ret i32 %62
}

LLVM IR (-O2):
%struct.ic_pvector = type { i32 }
%struct.ic_type_param = type { i32 }
@.str = [56 x i8] c"ic_type_param_pvector_deep_copy_embedded: from was null\00"
@.str.1 = [54 x i8] c"ic_type_param_pvector_deep_copy_embedded: to was null\00"
@.str.2 = [73 x i8] c"ic_type_param_pvector_deep_copy_embedded: call to ic_pvector_init failed\00"
@.str.3 = [72 x i8] c"ic_type_param_pvector_deep_copy_embedded: call to ic_pvector_get failed\00"
@.str.4 = [81 x i8] c"ic_type_param_pvector_deep_copy_embedded: call to ic_type_param_deep_copy failed\00"
@.str.5 = [75 x i8] c"ic_type_param_pvector_deep_copy_embedded: call to ic_pvector_append failed\00"
define i32 @ic_type_param_pvector_deep_copy_embedded(%struct.ic_pvector* %0, %struct.ic_pvector* %1) {
%3 = icmp eq %struct.ic_pvector* %0, null
br i1 %3, label %25, label %4
4: ; preds = %2
%5 = icmp eq %struct.ic_pvector* %1, null
br i1 %5, label %25, label %6
6: ; preds = %4
%7 = tail call i32 @ic_pvector_length(%struct.ic_pvector* %0)
%8 = tail call i32 @ic_pvector_init(%struct.ic_pvector* %1, i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %25, label %10
10: ; preds = %6
%11 = icmp eq i32 %7, 0
br i1 %11, label %28, label %14
12: ; preds = %21
%13 = icmp eq i32 %24, %7
br i1 %13, label %28, label %14
14: ; preds = %10, %12
%15 = phi i32 [ %24, %12 ], [ 0, %10 ]
%16 = tail call %struct.ic_type_param* @ic_pvector_get(%struct.ic_pvector* %0, i32 %15)
%17 = icmp eq %struct.ic_type_param* %16, null
br i1 %17, label %25, label %18
18: ; preds = %14
%19 = tail call %struct.ic_type_param* @ic_type_param_deep_copy(%struct.ic_type_param* %16)
%20 = icmp eq %struct.ic_type_param* %19, null
br i1 %20, label %25, label %21
21: ; preds = %18
%22 = tail call i32 @ic_pvector_append(%struct.ic_pvector* %1, %struct.ic_type_param* %19)
%23 = icmp eq i32 %15, %22
%24 = add nuw i32 %15, 1
br i1 %23, label %12, label %25
25: ; preds = %21, %18, %14, %6, %4, %2
%26 = phi i8* [ getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0), %14 ], [ getelementptr inbounds ([81 x i8], [81 x i8]* @.str.4, i64 0, i64 0), %18 ], [ getelementptr inbounds ([75 x i8], [75 x i8]* @.str.5, i64 0, i64 0), %21 ]
%27 = tail call i32 @puts(i8* dereferenceable(1) %26)
br label %28
28: ; preds = %12, %25, %10
%29 = phi i32 [ 1, %10 ], [ 0, %25 ], [ 1, %12 ]
ret i32 %29
}