#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ PlotRna(char *, char *, short *, char *, float);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  char outPSFile[100], ilmOutFile[100], bpseqFile[100], seqFile[100],
      mwmFile[100];
  char prefix[100];
  if (argc < 3) {
    printf("Usage: Plot seqFile bpseqFile\n");
    exit(1);
  }
  strcpy(seqFile, argv[1]);
  strcpy(bpseqFile, argv[2]);
  strcpy(prefix, argv[2]);
  int len;
  len = strlen(prefix);
  prefix[len - 6] = '\0';
  strcpy(outPSFile, prefix);
  strcat(outPSFile, ".ps");
  int MAX = 1000;
  int MaxLen = 5000;
  short structure[MaxLen];
  int j;
  FILE *bpfile = fopen(bpseqFile, "r+");
  int i = 0;
  while (!feof(bpfile)) {
    fscanf(bpfile, "%d %d", &i, &j);
    structure[i - 1] = j;
  }
  fclose(bpfile);
  FILE *seqfile = fopen(seqFile, "r+");
  char *seq = (char *)malloc(MaxLen * sizeof(char));
  if (seqfile == NULL) {
    printf("Can't open file %s \n", seqFile);
    exit(1);
  }
  fscanf(seqfile, "%s", seq);
  fclose(seqfile);
  float energy = 0;
  PlotRna(prefix, seq, structure, outPSFile, energy * 1000);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x320,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11eb <main+0x3b>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    -0x1d0(%rbp),%rdi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x160(%rbp),%rdi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x2b0(%rbp),%rdi
mov    %rdi,-0x318(%rbp)
call   1030 <strcpy@plt>
mov    -0x318(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x318(%rbp),%rsi
mov    %eax,-0x2b4(%rbp)
mov    -0x2b4(%rbp),%eax
add    $0xfffffffa,%eax
cltq
movb   $0x0,-0x2b0(%rbp,%rax,1)
lea    -0x80(%rbp),%rdi
mov    %rdi,-0x310(%rbp)
call   1030 <strcpy@plt>
mov    -0x310(%rbp),%rdi
lea    0xdab(%rip),%rsi
call   10c0 <strcat@plt>
movl   $0x3e8,-0x2b8(%rbp)
movl   $0x1388,-0x2bc(%rbp)
mov    -0x2bc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x2c8(%rbp)
lea    0xf(%rax,%rax,1),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x308(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x2d0(%rbp)
lea    -0x160(%rbp),%rdi
lea    0xd58(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x2e0(%rbp)
movl   $0x0,-0x2e4(%rbp)
mov    -0x2e0(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1306 <main+0x156>
jmp    134e <main+0x19e>
mov    -0x2e0(%rbp),%rdi
lea    0xd16(%rip),%rsi
lea    -0x2e4(%rbp),%rdx
lea    -0x2d4(%rbp),%rcx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x308(%rbp),%rax
mov    -0x2d4(%rbp),%ecx
mov    %cx,%dx
mov    -0x2e4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dx,(%rax,%rcx,2)
jmp    12e5 <main+0x135>
mov    -0x2e0(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x1d0(%rbp),%rdi
lea    0xcbf(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x2f0(%rbp)
movslq -0x2bc(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x2f8(%rbp)
cmpq   $0x0,-0x2f0(%rbp)
jne    13ba <main+0x20a>
lea    -0x1d0(%rbp),%rsi
lea    0xc87(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x2f0(%rbp),%rdi
mov    -0x2f8(%rbp),%rdx
lea    0xc76(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x2f0(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x308(%rbp),%rdx
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2fc(%rbp)
ff
lea    -0x2b0(%rbp),%rdi
mov    -0x2f8(%rbp),%rsi
lea    -0x80(%rbp),%rcx
movss  0xbf2(%rip),%xmm0
mulss  -0x2fc(%rbp),%xmm0
ff
call   1090 <PlotRna@plt>
mov    -0x2c8(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1c8,%rsp
cmp    $0x2,%edi
jle    133a <main+0x17a>
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    -0xa0(%rbp),%rdi
call   1030 <strcpy@plt>
mov    0x10(%rbx),%rsi
lea    -0x1f0(%rbp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    0x10(%rbx),%rsi
lea    -0x110(%rbp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x6(%rax,%rbx,1)
lea    -0x180(%rbp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xdc2(%rip),%rsi
mov    %r15,%rdi
call   10d0 <strcat@plt>
mov    %rsp,-0x38(%rbp)
mov    %rsp,%r15
add    $0xffffffffffffd8f0,%r15
mov    %r15,%rsp
lea    0xda6(%rip),%rsi
mov    %r14,%rdi
call   10c0 <fopen@plt>
mov    %rax,%rbx
movl   $0x0,-0x2c(%rbp)
mov    %rax,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    12bd <main+0xfd>
lea    0xd84(%rip),%r14
lea    -0x2c(%rbp),%r12
lea    -0x30(%rbp),%r13
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1080 <fscanf@plt>
movzwl -0x30(%rbp),%eax
movslq -0x2c(%rbp),%rcx
mov    %ax,-0x2(%r15,%rcx,2)
mov    %rbx,%rdi
call   1090 <feof@plt>
test   %eax,%eax
je     1290 <main+0xd0>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xd38(%rip),%rsi
lea    -0xa0(%rbp),%rdi
call   10c0 <fopen@plt>
mov    %rax,%rbx
mov    $0x1388,%edi
call   10b0 <malloc@plt>
test   %rbx,%rbx
je     1350 <main+0x190>
mov    %rax,%r14
lea    0xd2e(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1080 <fscanf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    -0x110(%rbp),%rdi
lea    -0x180(%rbp),%rcx
xorps  %xmm0,%xmm0
mov    %r14,%rsi
mov    %r15,%rdx
call   10a0 <PlotRna@plt>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xce4(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    0xcb6(%rip),%rdi
lea    -0xa0(%rbp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Usage: Plot seqFile bpseqFile\0A\00"
@.str.1 = [4 x i8] c".ps\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [21 x i8] c"Can't open file %s \0A\00"
@.str.5 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca [100 x i8]
%10 = alloca [100 x i8]
%11 = alloca [100 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i32
%18 = alloca i32*
%19 = alloca i32
%20 = alloca i32*
%21 = alloca i8*
%22 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 3
br i1 %24, label %25, label %28
25: ; preds = %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %2
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @strcpy(i8* %29, i8* %32)
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i32 @strcpy(i8* %34, i8* %37)
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = call i32 @strcpy(i8* %39, i8* %42)
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%45 = call i32 @strlen(i8* %44)
store i32 %45, i32* %12
%46 = load i32, i32* %12
%47 = sub nsw i32 %46, 6
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 %48
store i8 0, i8* %49
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%51 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%52 = call i32 @strcpy(i8* %50, i8* %51)
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%54 = call i32 @strcat(i8* %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 1000, i32* %13
store i32 5000, i32* %14
%55 = load i32, i32* %14
%56 = zext i32 %55 to i64
%57 = call i8* @llvm.stacksave()
store i8* %57, i8** %15
%58 = alloca i16, i64 %56
store i64 %56, i64* %16
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%60 = call i32* @fopen(i8* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %60, i32** %18
store i32 0, i32* %19
br label %61
61: ; preds = %66, %28
%62 = load i32*, i32** %18
%63 = call i32 @feof(i32* %62)
%64 = icmp ne i32 %63, 0
%65 = xor i1 %64, true
br i1 %65, label %66, label %75
66: ; preds = %61
%67 = load i32*, i32** %18
%68 = call i32 (i32*, i8*, ...) @fscanf(i32* %67, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %19, i32* %17)
%69 = load i32, i32* %17
%70 = trunc i32 %69 to i16
%71 = load i32, i32* %19
%72 = sub nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i16, i16* %58, i64 %73
store i16 %70, i16* %74
br label %61
75: ; preds = %61
%76 = load i32*, i32** %18
%77 = call i32 @fclose(i32* %76)
%78 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%79 = call i32* @fopen(i8* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %79, i32** %20
%80 = load i32, i32* %14
%81 = sext i32 %80 to i64
%82 = mul i64 %81, 1
%83 = trunc i64 %82 to i32
%84 = call i64 @malloc(i32 %83)
%85 = inttoptr i64 %84 to i8*
store i8* %85, i8** %21
%86 = load i32*, i32** %20
%87 = icmp eq i32* %86, null
br i1 %87, label %88, label %92
88: ; preds = %75
%89 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %89)
%91 = call i32 @exit(i32 1)
unreachable
92: ; preds = %75
%93 = load i32*, i32** %20
%94 = load i8*, i8** %21
%95 = call i32 (i32*, i8*, ...) @fscanf(i32* %93, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %94)
%96 = load i32*, i32** %20
%97 = call i32 @fclose(i32* %96)
store float 0.000000e+00, float* %22
%98 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%99 = load i8*, i8** %21
%100 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%101 = load float, float* %22
%102 = fmul float %101, 1.000000e+03
%103 = call i32 @PlotRna(i8* %98, i8* %99, i16* %58, i8* %100, float %102)
%104 = load i8*, i8** %15
%105 = load i32, i32* %3
ret i32 %105
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c".ps\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [21 x i8] c"Can't open file %s \0A\00"
@.str.5 = [3 x i8] c"%s\00"
@str = [30 x i8] c"Usage: Plot seqFile bpseqFile\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%13 = icmp slt i32 %0, 3
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strcpy(i8* %11, i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @strcpy(i8* %10, i8* %22)
%24 = load i8*, i8** %21
%25 = call i32 @strcpy(i8* %12, i8* %24)
%26 = call i32 @strlen(i8* %12)
%27 = add nsw i32 %26, -6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 %28
store i8 0, i8* %29
%30 = call i32 @strcpy(i8* %9, i8* %12)
%31 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%32 = call i8* @llvm.stacksave()
%33 = alloca [5000 x i16]
%34 = bitcast i32* %7 to i8*
%35 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%36 = bitcast i32* %8 to i8*
store i32 0, i32* %8
%37 = call i32 @feof(i32* %35)
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %49
39: ; preds = %17, %39
%40 = call i32 (i32*, i8*, ...) @fscanf(i32* %35, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %8, i32* %7)
%41 = load i32, i32* %7
%42 = trunc i32 %41 to i16
%43 = load i32, i32* %8
%44 = add nsw i32 %43, -1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [5000 x i16], [5000 x i16]* %33, i64 0, i64 %45
store i16 %42, i16* %46
%47 = call i32 @feof(i32* %35)
%48 = icmp eq i32 %47, 0
br i1 %48, label %39, label %49
49: ; preds = %39, %17
%50 = call i32 @fclose(i32* %35)
%51 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%52 = call i64 @malloc(i32 5000)
%53 = inttoptr i64 %52 to i8*
%54 = icmp eq i32* %51, null
br i1 %54, label %55, label %58
55: ; preds = %49
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %11)
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %49
%59 = getelementptr inbounds [5000 x i16], [5000 x i16]* %33, i64 0, i64 0
%60 = call i32 (i32*, i8*, ...) @fscanf(i32* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %53)
%61 = call i32 @fclose(i32* %51)
%62 = call i32 @PlotRna(i8* %12, i8* %53, i16* %59, i8* %9, float 0.000000e+00)
ret i32 0
}