#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 */
size_t FChoose(float *, int);
scalar_t__ sre_malloc(char *, int, int);
char *RandomSequence(char *alphabet, float *p, int n, int len) {
  char *s;
  int x;
  s = (char *)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",
      195, (sizeof(char) * (len + 1)));
  for (x = 0; x < len; x++)
    s[x] = alphabet[FChoose(p, n)];
  s[x] = '\0';
  return s;
}


x86 assembly (clang, -O0):
<RandomSequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edx
lea    0xeb5(%rip),%rdi
mov    $0xc3,%esi
call   1040 <sre_malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11a3 <RandomSequence+0x83>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <FChoose@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    (%rax,%rcx,1),%dl
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1160 <RandomSequence+0x40>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomSequence>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%r13
lea    0x1(%rbx),%edx
lea    0xec0(%rip),%rdi
mov    $0xc3,%esi
call   1040 <sre_malloc@plt>
mov    %rax,%r12
test   %ebx,%ebx
jle    1180 <RandomSequence+0x60>
mov    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %r14d,%esi
call   1030 <FChoose@plt>
movzbl 0x0(%r13,%rax,1),%eax
mov    %al,(%r12,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1160 <RandomSequence+0x40>
jmp    1182 <RandomSequence+0x62>
xor    %ebx,%ebx
movb   $0x0,(%r12,%rbx,1)
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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* @RandomSequence(i8* %0, float* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %5
store float* %1, float** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %8
%12 = add nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = mul i64 1, %13
%15 = trunc i64 %14 to i32
%16 = call i64 @sre_malloc(i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0), i32 195, i32 %15)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %9
store i32 0, i32* %10
br label %18
18: ; preds = %33, %4
%19 = load i32, i32* %10
%20 = load i32, i32* %8
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %36
22: ; preds = %18
%23 = load i8*, i8** %5
%24 = load float*, float** %6
%25 = load i32, i32* %7
%26 = call i64 @FChoose(float* %24, i32 %25)
%27 = getelementptr inbounds i8, i8* %23, i64 %26
%28 = load i8, i8* %27
%29 = load i8*, i8** %9
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 %28, i8* %32
br label %33
33: ; preds = %22
%34 = load i32, i32* %10
%35 = add nsw i32 %34, 1
store i32 %35, i32* %10
br label %18
36: ; preds = %18
%37 = load i8*, i8** %9
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
store i8 0, i8* %40
%41 = load i8*, i8** %9
ret i8* %41
}

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* @RandomSequence(i8* nocapture %0, float* %1, i32 %2, i32 %3) {
%5 = add nsw i32 %3, 1
%6 = tail call i64 @sre_malloc(i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0), i32 195, i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = icmp sgt i32 %3, 0
br i1 %8, label %9, label %21
9: ; preds = %4
%10 = zext i32 %3 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %17, %11 ]
%13 = tail call i64 @FChoose(float* %1, i32 %2)
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %7, i64 %12
store i8 %15, i8* %16
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %10
br i1 %18, label %19, label %11
19: ; preds = %11
%20 = zext i32 %3 to i64
br label %21
21: ; preds = %4, %19
%22 = phi i64 [ %20, %19 ], [ 0, %4 ]
%23 = getelementptr inbounds i8, i8* %7, i64 %22
store i8 0, i8* %23
ret i8* %7
}