#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*/ IF_inFile_1d(int /*<<< orphan*/ *, char, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(void *);
scalar_t__ getParLong(long *);
char *getString();
int /*<<< orphan*/ isNString(int);
int /*<<< orphan*/ isNTabSameDim(int);
void *malloc(scalar_t__);
int /*<<< orphan*/ messErr(int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stopErr(char *, char *);
scalar_t__ strlen(char *);
void IF_toCsv(void) {
  int i, lib = 0;
  long t;
  char *f, *s, *e;
  void *M;
  FILE *fd;
  if (getParLong(&t)) {
    if (!isNTabSameDim((int)t)) {
      messErr(3);
      return;
    }
    if (!isNString(1)) {
      messErr(6);
      return;
    }
    f = getString();
    s = f;
    e = f + strlen(f);
    while (s < e) {
      if (*s == ';') {
        *s = '\0';
        s++;
        break;
      }
      s++;
    }
    if (strlen(s) > 0)
      lib = 1;
    if ((M = malloc(strlen(f) + 5)) == NULL)
      stopErr("IF_toCsv", "malloc");
    sprintf((char *)M, "%s.csv", f);
    fd = fopen((char *)M, "w+");
    free(M);
    for (i = 0; i < (int)t; i++) {
      if (lib) {
        if (strlen(s) > 0) {
          f = s;
          while (s < e) {
            if (*s == ';') {
              *s = '\0';
              s++;
              break;
            }
            s++;
          }
          fprintf(fd, "%s;", f);
        } else
          fprintf(fd, "lig%d;", i + 1);
      }
      IF_inFile_1d(fd, ';', 1);
    }
    fclose(fd);
    free((void *)f);
  }
}


x86 assembly (clang, -O0):
<IF_toCsv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
call   10a0 <getParLong@plt>
cmp    $0x0,%rax
je     142e <IF_toCsv+0x24e>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1100 <isNTabSameDim@plt>
cmp    $0x0,%eax
jne    1225 <IF_toCsv+0x45>
mov    $0x3,%edi
call   1060 <messErr@plt>
jmp    142e <IF_toCsv+0x24e>
mov    $0x1,%edi
call   1040 <isNString@plt>
cmp    $0x0,%eax
jne    1247 <IF_toCsv+0x67>
mov    $0x6,%edi
call   1060 <messErr@plt>
jmp    142e <IF_toCsv+0x24e>
mov    $0x0,%al
call   1030 <getString@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1090 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    12c0 <IF_toCsv+0xe0>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
jne    12af <IF_toCsv+0xcf>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    12c0 <IF_toCsv+0xe0>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1279 <IF_toCsv+0x99>
mov    -0x20(%rbp),%rdi
call   1090 <strlen@plt>
cmp    $0x0,%rax
jle    12da <IF_toCsv+0xfa>
movl   $0x1,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
call   1090 <strlen@plt>
mov    %rax,%rdi
add    $0x5,%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    1310 <IF_toCsv+0x130>
lea    0xcfc(%rip),%rdi
lea    0xcfe(%rip),%rsi
call   1070 <stopErr@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xcf1(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xce8(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    %ecx,%eax
jge    141c <IF_toCsv+0x23c>
cmpl   $0x0,-0x8(%rbp)
je     13fb <IF_toCsv+0x21b>
mov    -0x20(%rbp),%rdi
call   1090 <strlen@plt>
cmp    $0x0,%rax
jle    13de <IF_toCsv+0x1fe>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    13c3 <IF_toCsv+0x1e3>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
jne    13b2 <IF_toCsv+0x1d2>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    13c3 <IF_toCsv+0x1e3>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    137c <IF_toCsv+0x19c>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xc48(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    13f6 <IF_toCsv+0x216>
mov    -0x38(%rbp),%rdi
mov    -0x4(%rbp),%edx
add    $0x1,%edx
lea    0xc2f(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    13fb <IF_toCsv+0x21b>
mov    -0x38(%rbp),%rdi
mov    $0x3b,%esi
mov    $0x1,%edx
call   10d0 <IF_inFile_1d@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1348 <IF_toCsv+0x168>
mov    -0x38(%rbp),%rdi
call   1080 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1050 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IF_toCsv>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
call   10a0 <getParLong@plt>
test   %rax,%rax
je     138d <IF_toCsv+0x1ad>
mov    0x8(%rsp),%edi
call   1100 <isNTabSameDim@plt>
test   %eax,%eax
je     1251 <IF_toCsv+0x71>
mov    $0x1,%edi
call   1040 <isNString@plt>
test   %eax,%eax
je     1260 <IF_toCsv+0x80>
xor    %eax,%eax
call   1030 <getString@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   1090 <strlen@plt>
mov    %r13,%r15
add    %rax,%r15
mov    %r13,%r14
test   %rax,%rax
jle    1277 <IF_toCsv+0x97>
mov    %r13,%r14
nop
cmpb   $0x3b,(%r14)
je     126f <IF_toCsv+0x8f>
add    $0x1,%r14
cmp    %r15,%r14
jb     1240 <IF_toCsv+0x60>
jmp    1277 <IF_toCsv+0x97>
mov    $0x3,%edi
call   1060 <messErr@plt>
jmp    138d <IF_toCsv+0x1ad>
mov    $0x6,%edi
call   1060 <messErr@plt>
jmp    138d <IF_toCsv+0x1ad>
movb   $0x0,(%r14)
add    $0x1,%r14
mov    %r14,%rdi
call   1090 <strlen@plt>
mov    %rax,0x10(%rsp)
mov    %r13,%rdi
call   1090 <strlen@plt>
lea    0x5(%rax),%rdi
call   10c0 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    12b0 <IF_toCsv+0xd0>
lea    0xd5c(%rip),%rdi
lea    0xd5e(%rip),%rsi
call   1070 <stopErr@plt>
lea    0xd59(%rip),%rsi
mov    %rbp,%rdi
mov    %r13,%rdx
call   10f0 <sprintf@plt>
lea    0xd4e(%rip),%rsi
mov    %rbp,%rdi
call   10e0 <fopen@plt>
mov    %rax,%r12
mov    %rbp,%rdi
call   1050 <free@plt>
cmpl   $0x0,0x8(%rsp)
jle    137d <IF_toCsv+0x19d>
xor    %ebp,%ebp
jmp    132b <IF_toCsv+0x14b>
nopl   0x0(%rax,%rax,1)
lea    0x1(%rbp),%edx
mov    %r12,%rdi
lea    0xd21(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %r14,%rbx
mov    %r13,%r14
mov    %r14,%r13
mov    %r12,%rdi
mov    $0x3b,%esi
mov    $0x1,%edx
call   10d0 <IF_inFile_1d@plt>
add    $0x1,%ebp
mov    %rbx,%r14
cmp    0x8(%rsp),%ebp
jge    137d <IF_toCsv+0x19d>
cmpq   $0x0,0x10(%rsp)
jle    1304 <IF_toCsv+0x124>
mov    %r14,%rdi
call   1090 <strlen@plt>
test   %rax,%rax
jle    12f0 <IF_toCsv+0x110>
mov    %r14,%rbx
cmp    %r15,%r14
jae    1367 <IF_toCsv+0x187>
mov    %r14,%rbx
nopl   0x0(%rax,%rax,1)
cmpb   $0x3b,(%rbx)
je     1360 <IF_toCsv+0x180>
add    $0x1,%rbx
cmp    %r15,%rbx
jb     1350 <IF_toCsv+0x170>
jmp    1367 <IF_toCsv+0x187>
movb   $0x0,(%rbx)
add    $0x1,%rbx
mov    %r12,%rdi
lea    0xca9(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    130a <IF_toCsv+0x12a>
mov    %r12,%rdi
call   1080 <fclose@plt>
mov    %r13,%rdi
call   1050 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"IF_toCsv\00"
@.str.1 = [7 x i8] c"malloc\00"
@.str.2 = [7 x i8] c"%s.csv\00"
@.str.3 = [3 x i8] c"w+\00"
@.str.4 = [4 x i8] c"%s;\00"
@.str.5 = [7 x i8] c"lig%d;\00"
define void @IF_toCsv() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
store i32 0, i32* %2
%9 = call i64 @getParLong(i64* %3)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %118
11: ; preds = %0
%12 = load i64, i64* %3
%13 = trunc i64 %12 to i32
%14 = call i32 @isNTabSameDim(i32 %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %11
%17 = call i32 @messErr(i32 3)
br label %118
18: ; preds = %11
%19 = call i32 @isNString(i32 1)
%20 = icmp ne i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = call i32 @messErr(i32 6)
br label %118
23: ; preds = %18
%24 = call i8* (...) @getString()
store i8* %24, i8** %4
%25 = load i8*, i8** %4
store i8* %25, i8** %5
%26 = load i8*, i8** %4
%27 = load i8*, i8** %4
%28 = call i64 @strlen(i8* %27)
%29 = getelementptr inbounds i8, i8* %26, i64 %28
store i8* %29, i8** %6
br label %30
30: ; preds = %43, %23
%31 = load i8*, i8** %5
%32 = load i8*, i8** %6
%33 = icmp ult i8* %31, %32
br i1 %33, label %34, label %46
34: ; preds = %30
%35 = load i8*, i8** %5
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 59
br i1 %38, label %39, label %43
39: ; preds = %34
%40 = load i8*, i8** %5
store i8 0, i8* %40
%41 = load i8*, i8** %5
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %5
br label %46
43: ; preds = %34
%44 = load i8*, i8** %5
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %5
br label %30
46: ; preds = %39, %30
%47 = load i8*, i8** %5
%48 = call i64 @strlen(i8* %47)
%49 = icmp sgt i64 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %46
store i32 1, i32* %2
br label %51
51: ; preds = %50, %46
%52 = load i8*, i8** %4
%53 = call i64 @strlen(i8* %52)
%54 = add nsw i64 %53, 5
%55 = call i8* @malloc(i64 %54)
store i8* %55, i8** %7
%56 = icmp eq i8* %55, null
br i1 %56, label %57, label %59
57: ; preds = %51
%58 = call i32 @stopErr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %59
59: ; preds = %57, %51
%60 = load i8*, i8** %7
%61 = load i8*, i8** %4
%62 = call i32 @sprintf(i8* %60, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %61)
%63 = load i8*, i8** %7
%64 = call i32* @fopen(i8* %63, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %64, i32** %8
%65 = load i8*, i8** %7
%66 = call i32 @free(i8* %65)
store i32 0, i32* %1
br label %67
67: ; preds = %110, %59
%68 = load i32, i32* %1
%69 = load i64, i64* %3
%70 = trunc i64 %69 to i32
%71 = icmp slt i32 %68, %70
br i1 %71, label %72, label %113
72: ; preds = %67
%73 = load i32, i32* %2
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %107
75: ; preds = %72
%76 = load i8*, i8** %5
%77 = call i64 @strlen(i8* %76)
%78 = icmp sgt i64 %77, 0
br i1 %78, label %79, label %101
79: ; preds = %75
%80 = load i8*, i8** %5
store i8* %80, i8** %4
br label %81
81: ; preds = %94, %79
%82 = load i8*, i8** %5
%83 = load i8*, i8** %6
%84 = icmp ult i8* %82, %83
br i1 %84, label %85, label %97
85: ; preds = %81
%86 = load i8*, i8** %5
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 59
br i1 %89, label %90, label %94
90: ; preds = %85
%91 = load i8*, i8** %5
store i8 0, i8* %91
%92 = load i8*, i8** %5
%93 = getelementptr inbounds i8, i8* %92, i32 1
store i8* %93, i8** %5
br label %97
94: ; preds = %85
%95 = load i8*, i8** %5
%96 = getelementptr inbounds i8, i8* %95, i32 1
store i8* %96, i8** %5
br label %81
97: ; preds = %90, %81
%98 = load i32*, i32** %8
%99 = load i8*, i8** %4
%100 = call i32 (i32*, i8*, ...) @fprintf(i32* %98, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %99)
br label %106
101: ; preds = %75
%102 = load i32*, i32** %8
%103 = load i32, i32* %1
%104 = add nsw i32 %103, 1
%105 = call i32 (i32*, i8*, ...) @fprintf(i32* %102, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %104)
br label %106
106: ; preds = %101, %97
br label %107
107: ; preds = %106, %72
%108 = load i32*, i32** %8
%109 = call i32 @IF_inFile_1d(i32* %108, i8 signext 59, i32 1)
br label %110
110: ; preds = %107
%111 = load i32, i32* %1
%112 = add nsw i32 %111, 1
store i32 %112, i32* %1
br label %67
113: ; preds = %67
%114 = load i32*, i32** %8
%115 = call i32 @fclose(i32* %114)
%116 = load i8*, i8** %4
%117 = call i32 @free(i8* %116)
br label %118
118: ; preds = %16, %21, %113, %0
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"IF_toCsv\00"
@.str.1 = [7 x i8] c"malloc\00"
@.str.2 = [7 x i8] c"%s.csv\00"
@.str.3 = [3 x i8] c"w+\00"
@.str.4 = [4 x i8] c"%s;\00"
@.str.5 = [7 x i8] c"lig%d;\00"
define void @IF_toCsv() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i64 @getParLong(i64* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %84, label %5
5: ; preds = %0
%6 = load i64, i64* %1
%7 = trunc i64 %6 to i32
%8 = call i32 @isNTabSameDim(i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = call i32 @messErr(i32 3)
br label %84
12: ; preds = %5
%13 = call i32 @isNString(i32 1)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @messErr(i32 6)
br label %84
17: ; preds = %12
%18 = call i8* (...) @getString()
%19 = call i64 @strlen(i8* dereferenceable(1) %18)
%20 = getelementptr inbounds i8, i8* %18, i64 %19
%21 = icmp sgt i64 %19, 0
br i1 %21, label %22, label %31
22: ; preds = %17, %28
%23 = phi i8* [ %29, %28 ], [ %18, %17 ]
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 59
br i1 %25, label %26, label %28
26: ; preds = %22
store i8 0, i8* %23
%27 = getelementptr inbounds i8, i8* %23, i64 1
br label %31
28: ; preds = %22
%29 = getelementptr inbounds i8, i8* %23, i64 1
%30 = icmp ult i8* %29, %20
br i1 %30, label %22, label %31
31: ; preds = %28, %17, %26
%32 = phi i8* [ %27, %26 ], [ %18, %17 ], [ %29, %28 ]
%33 = call i64 @strlen(i8* dereferenceable(1) %32)
%34 = icmp sgt i64 %33, 0
%35 = call i64 @strlen(i8* dereferenceable(1) %18)
%36 = add nsw i64 %35, 5
%37 = call i8* @malloc(i64 %36)
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %41
39: ; preds = %31
%40 = call i32 @stopErr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %41
41: ; preds = %39, %31
%42 = call i32 @sprintf(i8* dereferenceable(1) %37, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%43 = call i32* @fopen(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%44 = call i32 @free(i8* %37)
%45 = load i64, i64* %1
%46 = trunc i64 %45 to i32
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %80
48: ; preds = %41, %72
%49 = phi i32 [ %76, %72 ], [ 0, %41 ]
%50 = phi i8* [ %74, %72 ], [ %18, %41 ]
%51 = phi i8* [ %73, %72 ], [ %32, %41 ]
br i1 %34, label %52, label %72
52: ; preds = %48
%53 = call i64 @strlen(i8* dereferenceable(1) %51)
%54 = icmp sgt i64 %53, 0
br i1 %54, label %55, label %69
55: ; preds = %52
%56 = icmp ult i8* %51, %20
br i1 %56, label %57, label %66
57: ; preds = %55, %63
%58 = phi i8* [ %64, %63 ], [ %51, %55 ]
%59 = load i8, i8* %58
%60 = icmp eq i8 %59, 59
br i1 %60, label %61, label %63
61: ; preds = %57
store i8 0, i8* %58
%62 = getelementptr inbounds i8, i8* %58, i64 1
br label %66
63: ; preds = %57
%64 = getelementptr inbounds i8, i8* %58, i64 1
%65 = icmp ult i8* %64, %20
br i1 %65, label %57, label %66
66: ; preds = %63, %55, %61
%67 = phi i8* [ %62, %61 ], [ %51, %55 ], [ %64, %63 ]
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %51)
br label %72
69: ; preds = %52
%70 = add nuw nsw i32 %49, 1
%71 = call i32 (i32*, i8*, ...) @fprintf(i32* %43, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %70)
br label %72
72: ; preds = %66, %69, %48
%73 = phi i8* [ %67, %66 ], [ %51, %69 ], [ %51, %48 ]
%74 = phi i8* [ %51, %66 ], [ %50, %69 ], [ %50, %48 ]
%75 = call i32 @IF_inFile_1d(i32* %43, i8 signext 59, i32 1)
%76 = add nuw nsw i32 %49, 1
%77 = load i64, i64* %1
%78 = trunc i64 %77 to i32
%79 = icmp slt i32 %76, %78
br i1 %79, label %48, label %80
80: ; preds = %72, %41
%81 = phi i8* [ %18, %41 ], [ %74, %72 ]
%82 = call i32 @fclose(i32* %43)
%83 = call i32 @free(i8* %81)
br label %84
84: ; preds = %0, %80, %15, %10
ret void
}