#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 mntent {
  int /*<<< orphan*/ mnt_passno;
  int /*<<< orphan*/ mnt_freq;
  int /*<<< orphan*/ *mnt_opts;
  int /*<<< orphan*/ *mnt_type;
  int /*<<< orphan*/ *mnt_dir;
  int /*<<< orphan*/ *mnt_fsname;
};

/* Variables and functions */
int errno;
int /*<<< orphan*/ error_at_line(int, int, char *, int, char *);
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void *strdup(int /*<<< orphan*/ *);
void copy_ent(struct mntent *dst, struct mntent *src) {
  free(dst->mnt_opts);
  free(dst->mnt_type);
  free(dst->mnt_dir);
  free(dst->mnt_fsname);
  dst->mnt_dir = NULL;
  dst->mnt_type = NULL;
  dst->mnt_opts = NULL;
  dst->mnt_fsname = strdup(src->mnt_fsname);
  if (dst->mnt_fsname)
    dst->mnt_dir = strdup(src->mnt_dir);
  if (dst->mnt_dir)
    dst->mnt_type = strdup(src->mnt_type);
  if (dst->mnt_type)
    dst->mnt_opts = strdup(src->mnt_opts);
  if (dst->mnt_opts) {
    dst->mnt_freq = src->mnt_freq;
    dst->mnt_passno = src->mnt_passno;
  } else
    do {
      if (!errno)
        errno = -1;
      error_at_line(errno, errno,
                    "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/JanLuca/"
                    "aufs-tools-debian/refs/heads/master/proc_mnt.c",
                    53, "strdup");
    } while (0);
}


x86 assembly (clang, -O0):
<copy_ent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x20(%rax)
je     11d7 <copy_ent+0xa7>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x18(%rax)
je     11fe <copy_ent+0xce>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     1225 <copy_ent+0xf5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1253 <copy_ent+0x123>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
jmp    12a4 <copy_ent+0x174>
jmp    1258 <copy_ent+0x128>
mov    0x2d81(%rip),%rax
cmpl   $0x0,(%rax)
jne    1275 <copy_ent+0x145>
mov    0x2d71(%rip),%rax
movl   $0xffffffff,(%rax)
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
mov    0x2d5b(%rip),%rax
mov    (%rax),%esi
lea    0xd72(%rip),%rdx
mov    $0x35,%ecx
lea    0xdf7(%rip),%r8
call   1040 <error_at_line@plt>
jmp    12a4 <copy_ent+0x174>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_ent>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x8(%rdi),%rdi
call   1030 <free@plt>
mov    0x10(%rbx),%rdi
call   1030 <free@plt>
mov    0x18(%rbx),%rdi
call   1030 <free@plt>
mov    0x20(%rbx),%rdi
call   1030 <free@plt>
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rbx)
movq   $0x0,0x18(%rbx)
mov    0x20(%r14),%rdi
call   1050 <strdup@plt>
mov    %rax,0x20(%rbx)
test   %rax,%rax
je     11cb <copy_ent+0x9b>
mov    0x18(%r14),%rdi
call   1050 <strdup@plt>
mov    %rax,0x18(%rbx)
test   %rax,%rax
je     11cb <copy_ent+0x9b>
mov    0x10(%r14),%rdi
call   1050 <strdup@plt>
mov    %rax,0x10(%rbx)
test   %rax,%rax
je     11cb <copy_ent+0x9b>
lea    0x8(%rbx),%r15
mov    0x8(%r14),%rdi
call   1050 <strdup@plt>
mov    %rax,(%r15)
test   %rax,%rax
je     11cb <copy_ent+0x9b>
mov    0x4(%r14),%eax
mov    %eax,0x4(%rbx)
mov    (%r14),%eax
mov    %eax,(%rbx)
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
test   %edi,%edi
jne    11e3 <copy_ent+0xb3>
movl   $0xffffffff,(%rax)
mov    $0xffffffff,%edi
lea    0xe16(%rip),%rdx
lea    0xea0(%rip),%r8
mov    %edi,%esi
mov    $0x35,%ecx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <error_at_line@plt>

LLVM IR (-O0):
%struct.mntent = type { i32, i32, i32*, i32*, i32*, i32* }
@errno = global i32 0
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/JanLuca/aufs-tools-debian/refs/heads/master/proc_mnt.c\00"
@.str.1 = [7 x i8] c"strdup\00"
define void @copy_ent(%struct.mntent* %0, %struct.mntent* %1) {
%3 = alloca %struct.mntent*
%4 = alloca %struct.mntent*
store %struct.mntent* %0, %struct.mntent** %3
store %struct.mntent* %1, %struct.mntent** %4
%5 = load %struct.mntent*, %struct.mntent** %3
%6 = getelementptr inbounds %struct.mntent, %struct.mntent* %5, i32 0, i32 2
%7 = load i32*, i32** %6
%8 = call i32 @free(i32* %7)
%9 = load %struct.mntent*, %struct.mntent** %3
%10 = getelementptr inbounds %struct.mntent, %struct.mntent* %9, i32 0, i32 3
%11 = load i32*, i32** %10
%12 = call i32 @free(i32* %11)
%13 = load %struct.mntent*, %struct.mntent** %3
%14 = getelementptr inbounds %struct.mntent, %struct.mntent* %13, i32 0, i32 4
%15 = load i32*, i32** %14
%16 = call i32 @free(i32* %15)
%17 = load %struct.mntent*, %struct.mntent** %3
%18 = getelementptr inbounds %struct.mntent, %struct.mntent* %17, i32 0, i32 5
%19 = load i32*, i32** %18
%20 = call i32 @free(i32* %19)
%21 = load %struct.mntent*, %struct.mntent** %3
%22 = getelementptr inbounds %struct.mntent, %struct.mntent* %21, i32 0, i32 4
store i32* null, i32** %22
%23 = load %struct.mntent*, %struct.mntent** %3
%24 = getelementptr inbounds %struct.mntent, %struct.mntent* %23, i32 0, i32 3
store i32* null, i32** %24
%25 = load %struct.mntent*, %struct.mntent** %3
%26 = getelementptr inbounds %struct.mntent, %struct.mntent* %25, i32 0, i32 2
store i32* null, i32** %26
%27 = load %struct.mntent*, %struct.mntent** %4
%28 = getelementptr inbounds %struct.mntent, %struct.mntent* %27, i32 0, i32 5
%29 = load i32*, i32** %28
%30 = call i8* @strdup(i32* %29)
%31 = bitcast i8* %30 to i32*
%32 = load %struct.mntent*, %struct.mntent** %3
%33 = getelementptr inbounds %struct.mntent, %struct.mntent* %32, i32 0, i32 5
store i32* %31, i32** %33
%34 = load %struct.mntent*, %struct.mntent** %3
%35 = getelementptr inbounds %struct.mntent, %struct.mntent* %34, i32 0, i32 5
%36 = load i32*, i32** %35
%37 = icmp ne i32* %36, null
br i1 %37, label %38, label %46
38: ; preds = %2
%39 = load %struct.mntent*, %struct.mntent** %4
%40 = getelementptr inbounds %struct.mntent, %struct.mntent* %39, i32 0, i32 4
%41 = load i32*, i32** %40
%42 = call i8* @strdup(i32* %41)
%43 = bitcast i8* %42 to i32*
%44 = load %struct.mntent*, %struct.mntent** %3
%45 = getelementptr inbounds %struct.mntent, %struct.mntent* %44, i32 0, i32 4
store i32* %43, i32** %45
br label %46
46: ; preds = %38, %2
%47 = load %struct.mntent*, %struct.mntent** %3
%48 = getelementptr inbounds %struct.mntent, %struct.mntent* %47, i32 0, i32 4
%49 = load i32*, i32** %48
%50 = icmp ne i32* %49, null
br i1 %50, label %51, label %59
51: ; preds = %46
%52 = load %struct.mntent*, %struct.mntent** %4
%53 = getelementptr inbounds %struct.mntent, %struct.mntent* %52, i32 0, i32 3
%54 = load i32*, i32** %53
%55 = call i8* @strdup(i32* %54)
%56 = bitcast i8* %55 to i32*
%57 = load %struct.mntent*, %struct.mntent** %3
%58 = getelementptr inbounds %struct.mntent, %struct.mntent* %57, i32 0, i32 3
store i32* %56, i32** %58
br label %59
59: ; preds = %51, %46
%60 = load %struct.mntent*, %struct.mntent** %3
%61 = getelementptr inbounds %struct.mntent, %struct.mntent* %60, i32 0, i32 3
%62 = load i32*, i32** %61
%63 = icmp ne i32* %62, null
br i1 %63, label %64, label %72
64: ; preds = %59
%65 = load %struct.mntent*, %struct.mntent** %4
%66 = getelementptr inbounds %struct.mntent, %struct.mntent* %65, i32 0, i32 2
%67 = load i32*, i32** %66
%68 = call i8* @strdup(i32* %67)
%69 = bitcast i8* %68 to i32*
%70 = load %struct.mntent*, %struct.mntent** %3
%71 = getelementptr inbounds %struct.mntent, %struct.mntent* %70, i32 0, i32 2
store i32* %69, i32** %71
br label %72
72: ; preds = %64, %59
%73 = load %struct.mntent*, %struct.mntent** %3
%74 = getelementptr inbounds %struct.mntent, %struct.mntent* %73, i32 0, i32 2
%75 = load i32*, i32** %74
%76 = icmp ne i32* %75, null
br i1 %76, label %77, label %88
77: ; preds = %72
%78 = load %struct.mntent*, %struct.mntent** %4
%79 = getelementptr inbounds %struct.mntent, %struct.mntent* %78, i32 0, i32 1
%80 = load i32, i32* %79
%81 = load %struct.mntent*, %struct.mntent** %3
%82 = getelementptr inbounds %struct.mntent, %struct.mntent* %81, i32 0, i32 1
store i32 %80, i32* %82
%83 = load %struct.mntent*, %struct.mntent** %4
%84 = getelementptr inbounds %struct.mntent, %struct.mntent* %83, i32 0, i32 0
%85 = load i32, i32* %84
%86 = load %struct.mntent*, %struct.mntent** %3
%87 = getelementptr inbounds %struct.mntent, %struct.mntent* %86, i32 0, i32 0
store i32 %85, i32* %87
br label %98
88: ; preds = %72
br label %89
89: ; preds = %88
%90 = load i32, i32* @errno
%91 = icmp ne i32 %90, 0
br i1 %91, label %93, label %92
92: ; preds = %89
store i32 -1, i32* @errno
br label %93
93: ; preds = %92, %89
%94 = load i32, i32* @errno
%95 = load i32, i32* @errno
%96 = call i32 @error_at_line(i32 %94, i32 %95, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 53, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %97
97: ; preds = %93
br label %98
98: ; preds = %97, %77
ret void
}

LLVM IR (-O2):
%struct.mntent = type { i32, i32, i32*, i32*, i32*, i32* }
@errno = global i32 0
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/JanLuca/aufs-tools-debian/refs/heads/master/proc_mnt.c\00"
@.str.1 = [7 x i8] c"strdup\00"
define void @copy_ent(%struct.mntent* nocapture %0, %struct.mntent* nocapture %1) {
%3 = getelementptr inbounds %struct.mntent, %struct.mntent* %0, i64 0, i32 2
%4 = load i32*, i32** %3
%5 = tail call i32 @free(i32* %4)
%6 = getelementptr inbounds %struct.mntent, %struct.mntent* %0, i64 0, i32 3
%7 = load i32*, i32** %6
%8 = tail call i32 @free(i32* %7)
%9 = getelementptr inbounds %struct.mntent, %struct.mntent* %0, i64 0, i32 4
%10 = load i32*, i32** %9
%11 = tail call i32 @free(i32* %10)
%12 = getelementptr inbounds %struct.mntent, %struct.mntent* %0, i64 0, i32 5
%13 = load i32*, i32** %12
%14 = tail call i32 @free(i32* %13)
%15 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 5
%16 = bitcast i32** %3 to i8*
%17 = load i32*, i32** %15
%18 = tail call i8* @strdup(i32* %17)
%19 = bitcast i32** %12 to i8**
store i8* %18, i8** %19
%20 = icmp eq i8* %18, null
br i1 %20, label %46, label %21
21: ; preds = %2
%22 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 4
%23 = load i32*, i32** %22
%24 = tail call i8* @strdup(i32* %23)
%25 = bitcast i32** %9 to i8**
store i8* %24, i8** %25
%26 = icmp eq i8* %24, null
br i1 %26, label %46, label %27
27: ; preds = %21
%28 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 3
%29 = load i32*, i32** %28
%30 = tail call i8* @strdup(i32* %29)
%31 = bitcast i32** %6 to i8**
store i8* %30, i8** %31
%32 = icmp eq i8* %30, null
br i1 %32, label %46, label %33
33: ; preds = %27
%34 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 2
%35 = load i32*, i32** %34
%36 = tail call i8* @strdup(i32* %35)
%37 = bitcast i32** %3 to i8**
store i8* %36, i8** %37
%38 = icmp eq i8* %36, null
br i1 %38, label %46, label %39
39: ; preds = %33
%40 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 1
%41 = load i32, i32* %40
%42 = getelementptr inbounds %struct.mntent, %struct.mntent* %0, i64 0, i32 1
store i32 %41, i32* %42
%43 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 0
%44 = load i32, i32* %43
%45 = getelementptr inbounds %struct.mntent, %struct.mntent* %0, i64 0, i32 0
store i32 %44, i32* %45
br label %53
46: ; preds = %2, %21, %27, %33
%47 = load i32, i32* @errno
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %46
store i32 -1, i32* @errno
br label %50
50: ; preds = %49, %46
%51 = phi i32 [ -1, %49 ], [ %47, %46 ]
%52 = tail call i32 @error_at_line(i32 %51, i32 %51, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 53, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %53
53: ; preds = %50, %39
ret void
}