#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 */
char *sre_malloc(char *, int, int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *sre_strdup(char *s, int n) {
  char *new;
  if (s == NULL)
    return NULL;
  if (n < 0)
    n = strlen(s);
  new = sre_malloc(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/vinuesa/get_phylomarkers/refs/heads/master/"
      "bin/clustal-omega-1.2.4/src/squid/sre_string.c",
      438, (sizeof(char) * (n + 1)));
  strcpy(new, s);
  return new;
}


x86 assembly (clang, -O0):
<sre_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1157 <sre_strdup+0x27>
movq   $0x0,-0x8(%rbp)
jmp    11a5 <sre_strdup+0x75>
cmpl   $0x0,-0x14(%rbp)
jge    116d <sre_strdup+0x3d>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edx
lea    0xe7e(%rip),%rdi
mov    $0x1b6,%esi
call   1050 <sre_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sre_strdup>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1170 <sre_strdup+0x40>
mov    %esi,%edx
mov    %rdi,%r14
test   %esi,%esi
jns    114c <sre_strdup+0x1c>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
add    $0x1,%edx
lea    0xeaa(%rip),%rdi
mov    $0x1b6,%esi
call   1050 <sre_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    1172 <sre_strdup+0x42>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [180 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/vinuesa/get_phylomarkers/refs/heads/master/bin/clustal-omega-1.2.4/src/squid/sre_string.c\00"
define i8* @sre_strdup(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
store i8* null, i8** %3
br label %27
10: ; preds = %2
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %4
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %5
br label %16
16: ; preds = %13, %10
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = mul i64 1, %19
%21 = trunc i64 %20 to i32
%22 = call i8* @sre_malloc(i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0), i32 438, i32 %21)
store i8* %22, i8** %6
%23 = load i8*, i8** %6
%24 = load i8*, i8** %4
%25 = call i32 @strcpy(i8* %23, i8* %24)
%26 = load i8*, i8** %6
store i8* %26, i8** %3
br label %27
27: ; preds = %16, %9
%28 = load i8*, i8** %3
ret i8* %28
}

LLVM IR (-O2):
@.str = [180 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/vinuesa/get_phylomarkers/refs/heads/master/bin/clustal-omega-1.2.4/src/squid/sre_string.c\00"
define i8* @sre_strdup(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = icmp slt i32 %1, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @strlen(i8* %0)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %7, %6 ], [ %1, %4 ]
%10 = add nsw i32 %9, 1
%11 = tail call i8* @sre_malloc(i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0), i32 438, i32 %10)
%12 = tail call i32 @strcpy(i8* %11, i8* %0)
br label %13
13: ; preds = %2, %8
%14 = phi i8* [ %11, %8 ], [ null, %2 ]
ret i8* %14
}