#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 */
scalar_t__ atof(char *);
int atoi(char *);
double csecond();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ s2Rotate(int, double *, double *, double, double, double,
                            int);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  FILE *fp;
  int i, bw, isReal;
  double *sigIn, *sigOut;
  double alpha, beta, gamma;
  double tstart, tstop;
  if (argc < 8) {
    fprintf(stdout, "Usage: test_s2_rotate_wrap bw ");
    fprintf(stdout, "alpha beta gamma ");
    fprintf(stdout, "input_filename output_filename isReal\n");
    exit(0);
  }
  bw = atoi(argv[1]);
  alpha = (double)atof(argv[2]);
  beta = (double)atof(argv[3]);
  gamma = (double)atof(argv[4]);
  isReal = atoi(argv[7]);
  if (isReal) {
    sigIn = (double *)malloc(sizeof(double) * (4 * bw * bw));
    sigOut = (double *)malloc(sizeof(double) * (4 * bw * bw));
  } else {
    sigIn = (double *)malloc(sizeof(double) * (2 * 4 * bw * bw));
    sigOut = (double *)malloc(sizeof(double) * (2 * 4 * bw * bw));
  }
  if ((sigIn == NULL) || (sigOut == NULL)) {
    perror("Error in allocating memory");
    exit(1);
  }
  fp = fopen(argv[5], "r");
  if (isReal) {
    for (i = 0; i < (4 * bw * bw); i++) {
      fscanf(fp, "%lf", sigIn + i);
    }
  } else {
    for (i = 0; i < (2 * 4 * bw * bw); i++) {
      fscanf(fp, "%lf", sigIn + i);
    }
  }
  fclose(fp);
  fprintf(stdout, "about to rotate ...\n");
  tstart = csecond();
  s2Rotate(bw, sigIn, sigOut, alpha, beta, gamma, isReal);
  tstop = csecond();
  fprintf(stdout, "finished rotating ...\n");
  fprintf(stdout, "rotation time \t = %.4e\n", tstop - tstart);
  fp = fopen(argv[6], "w");
  if (isReal) {
    for (i = 0; i < (4 * bw * bw); i++) {
      fprintf(fp, "%.15f\n", sigOut[i]);
    }
  } else {
    for (i = 0; i < (4 * bw * bw); i++) {
      fprintf(fp, "%.15f\n%.15f\n", sigOut[2 * i], sigOut[2 * i + 1]);
    }
  }
  fclose(fp);
  fprintf(stdout, "finished writing ...\n");
  free(sigOut);
  free(sigIn);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    122c <main+0x6c>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe10(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
lea    0xe18(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
lea    0xe13(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atof@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atof@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1040 <atof@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     12d6 <main+0x116>
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x38(%rbp)
jmp    130c <main+0x14c>
mov    -0x20(%rbp),%eax
shl    $0x3,%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x3,%eax
imul   -0x20(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1322 <main+0x162>
cmpq   $0x0,-0x38(%rbp)
jne    1338 <main+0x178>
lea    0xd2f(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0xd2c(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     13a8 <main+0x1e8>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
shl    $0x2,%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    13a3 <main+0x1e3>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rdx
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xce5(%rip),%rsi
call   1070 <fscanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1361 <main+0x1a1>
jmp    13f6 <main+0x236>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
shl    $0x3,%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    13f1 <main+0x231>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rdx
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xc97(%rip),%rsi
call   1070 <fscanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13af <main+0x1ef>
jmp    13f6 <main+0x236>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2bda(%rip),%rax
mov    (%rax),%edi
lea    0xc6a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x0,%al
call   1060 <csecond@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
mov    -0x24(%rbp),%ecx
call   1080 <s2Rotate@plt>
mov    $0x0,%al
call   1060 <csecond@plt>
movsd  %xmm0,-0x60(%rbp)
mov    0x2b89(%rip),%rax
mov    (%rax),%edi
lea    0xc2e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2b72(%rip),%rax
mov    (%rax),%edi
movsd  -0x60(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
lea    0xc24(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
lea    0xc26(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     14fa <main+0x33a>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
shl    $0x2,%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    14f5 <main+0x335>
mov    -0x18(%rbp),%rax
mov    %eax,%edi
mov    -0x38(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xbe5(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    14b1 <main+0x2f1>
jmp    1564 <main+0x3a4>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
shl    $0x2,%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    155f <main+0x39f>
mov    -0x18(%rbp),%rax
mov    %eax,%edi
mov    -0x38(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xb75(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1501 <main+0x341>
jmp    1564 <main+0x3a4>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2a6c(%rip),%rax
mov    (%rax),%edi
lea    0xb4f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
cmp    $0x7,%edi
jle    1485 <main+0x2c5>
mov    %rsi,%r13
mov    0x8(%rsi),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%r13),%rdi
call   1040 <atof@plt>
mov    %rax,0x18(%rsp)
mov    0x18(%r13),%rdi
call   1040 <atof@plt>
mov    %rax,%r14
mov    0x20(%r13),%rdi
call   1040 <atof@plt>
mov    %rax,%r15
mov    0x38(%r13),%rdi
call   10d0 <atoi@plt>
mov    %eax,0x4(%rsp)
cmp    $0x1,%eax
mov    $0x5,%cl
adc    $0x0,%cl
mov    %ebx,%ebp
shl    %cl,%ebp
mov    %ebx,(%rsp)
imul   %ebx,%ebp
mov    %ebp,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   10a0 <malloc@plt>
mov    %rbx,0x8(%rsp)
test   %rbx,%rbx
je     14c3 <main+0x303>
mov    %rax,%r12
test   %rax,%rax
je     14c3 <main+0x303>
cvtsi2sdq 0x18(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r14,%xmm0
movsd  %xmm0,0x30(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r15,%xmm0
movsd  %xmm0,0x28(%rsp)
mov    %r13,0x18(%rsp)
mov    0x28(%r13),%rdi
lea    0xde5(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%r13
cmpl   $0x0,0x4(%rsp)
je     12da <main+0x11a>
mov    (%rsp),%eax
imul   %eax,%eax
shl    $0x2,%eax
test   %eax,%eax
jle    1318 <main+0x158>
mov    %eax,%r15d
lea    0xdc1(%rip),%r14
mov    0x8(%rsp),%rbx
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1070 <fscanf@plt>
add    $0x8,%rbx
add    $0xffffffffffffffff,%r15
jne    12c0 <main+0x100>
jmp    1318 <main+0x158>
mov    (%rsp),%eax
imul   %eax,%eax
shl    $0x3,%eax
test   %eax,%eax
jle    1318 <main+0x158>
mov    %eax,%ebp
lea    0xd85(%rip),%r14
mov    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1070 <fscanf@plt>
add    $0x8,%rbx
add    $0xffffffffffffffff,%rbp
jne    1300 <main+0x140>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    0x2cb9(%rip),%r14
mov    (%r14),%edi
lea    0xd48(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
xor    %eax,%eax
call   1060 <csecond@plt>
movsd  %xmm0,0x20(%rsp)
mov    (%rsp),%ebx
mov    %ebx,%edi
mov    0x8(%rsp),%rsi
mov    %r12,%rdx
movsd  0x10(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
mov    0x4(%rsp),%ebp
mov    %ebp,%ecx
call   1080 <s2Rotate@plt>
xor    %eax,%eax
call   1060 <csecond@plt>
movsd  %xmm0,0x10(%rsp)
mov    (%r14),%edi
lea    0xd08(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%r14),%edi
movsd  0x10(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
lea    0xd02(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    0x18(%rsp),%rax
mov    0x30(%rax),%rdi
lea    0xd03(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%r13
imul   %ebx,%ebx
shl    $0x2,%ebx
test   %ebp,%ebp
je     13fe <main+0x23e>
test   %ebx,%ebx
jle    1443 <main+0x283>
mov    %ebx,%ebx
xor    %ebp,%ebp
lea    0xcea(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsd  (%r12,%rbp,8),%xmm0
mov    %r13d,%edi
mov    %r14,%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    13e0 <main+0x220>
jmp    1443 <main+0x283>
test   %ebx,%ebx
jle    1443 <main+0x283>
mov    %ebx,%r15d
shl    $0x4,%r15
xor    %ebx,%ebx
lea    0xcad(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r12,%rbx,1),%xmm0
movsd  0x8(%r12,%rbx,1),%xmm1
mov    %r13d,%edi
mov    %r14,%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
add    $0x10,%rbx
cmp    %rbx,%r15
jne    1420 <main+0x260>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    0x2b8e(%rip),%rax
mov    (%rax),%edi
lea    0xc71(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b54(%rip),%rbx
mov    (%rbx),%edi
lea    0xb6b(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%rbx),%edi
lea    0xb7a(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%rbx),%edi
lea    0xb7c(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
lea    0xb8e(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [31 x i8] c"Usage: test_s2_rotate_wrap bw \00"
@.str.1 = [18 x i8] c"alpha beta gamma \00"
@.str.2 = [39 x i8] c"input_filename output_filename isReal\0A\00"
@.str.3 = [27 x i8] c"Error in allocating memory\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [4 x i8] c"%lf\00"
@.str.6 = [21 x i8] c"about to rotate ...\0A\00"
@.str.7 = [23 x i8] c"finished rotating ...\0A\00"
@.str.8 = [24 x i8] c"rotation time \09 = %.4e\0A\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [7 x i8] c"%.15f\0A\00"
@.str.11 = [13 x i8] c"%.15f\0A%.15f\0A\00"
@.str.12 = [22 x i8] c"finished writing ...\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 8
br i1 %18, label %19, label %27
19: ; preds = %2
%20 = load i32, i32* @stdout
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* @stdout
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32, i32* @stdout
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 @exit(i32 0)
unreachable
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %8
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = call i64 @atof(i8* %34)
%36 = sitofp i64 %35 to double
store double %36, double* %12
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 3
%39 = load i8*, i8** %38
%40 = call i64 @atof(i8* %39)
%41 = sitofp i64 %40 to double
store double %41, double* %13
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 4
%44 = load i8*, i8** %43
%45 = call i64 @atof(i8* %44)
%46 = sitofp i64 %45 to double
store double %46, double* %14
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 7
%49 = load i8*, i8** %48
%50 = call i32 @atoi(i8* %49)
store i32 %50, i32* %9
%51 = load i32, i32* %9
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %72
53: ; preds = %27
%54 = load i32, i32* %8
%55 = mul nsw i32 4, %54
%56 = load i32, i32* %8
%57 = mul nsw i32 %55, %56
%58 = sext i32 %57 to i64
%59 = mul i64 8, %58
%60 = trunc i64 %59 to i32
%61 = call i64 @malloc(i32 %60)
%62 = inttoptr i64 %61 to double*
store double* %62, double** %10
%63 = load i32, i32* %8
%64 = mul nsw i32 4, %63
%65 = load i32, i32* %8
%66 = mul nsw i32 %64, %65
%67 = sext i32 %66 to i64
%68 = mul i64 8, %67
%69 = trunc i64 %68 to i32
%70 = call i64 @malloc(i32 %69)
%71 = inttoptr i64 %70 to double*
store double* %71, double** %11
br label %91
72: ; preds = %27
%73 = load i32, i32* %8
%74 = mul nsw i32 8, %73
%75 = load i32, i32* %8
%76 = mul nsw i32 %74, %75
%77 = sext i32 %76 to i64
%78 = mul i64 8, %77
%79 = trunc i64 %78 to i32
%80 = call i64 @malloc(i32 %79)
%81 = inttoptr i64 %80 to double*
store double* %81, double** %10
%82 = load i32, i32* %8
%83 = mul nsw i32 8, %82
%84 = load i32, i32* %8
%85 = mul nsw i32 %83, %84
%86 = sext i32 %85 to i64
%87 = mul i64 8, %86
%88 = trunc i64 %87 to i32
%89 = call i64 @malloc(i32 %88)
%90 = inttoptr i64 %89 to double*
store double* %90, double** %11
br label %91
91: ; preds = %72, %53
%92 = load double*, double** %10
%93 = icmp eq double* %92, null
br i1 %93, label %97, label %94
94: ; preds = %91
%95 = load double*, double** %11
%96 = icmp eq double* %95, null
br i1 %96, label %97, label %100
97: ; preds = %94, %91
%98 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%99 = call i32 @exit(i32 1)
unreachable
100: ; preds = %94
%101 = load i8**, i8*** %5
%102 = getelementptr inbounds i8*, i8** %101, i64 5
%103 = load i8*, i8** %102
%104 = call i32* @fopen(i8* %103, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %104, i32** %6
%105 = load i32, i32* %9
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %126
107: ; preds = %100
store i32 0, i32* %7
br label %108
108: ; preds = %122, %107
%109 = load i32, i32* %7
%110 = load i32, i32* %8
%111 = mul nsw i32 4, %110
%112 = load i32, i32* %8
%113 = mul nsw i32 %111, %112
%114 = icmp slt i32 %109, %113
br i1 %114, label %115, label %125
115: ; preds = %108
%116 = load i32*, i32** %6
%117 = load double*, double** %10
%118 = load i32, i32* %7
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %117, i64 %119
%121 = call i32 @fscanf(i32* %116, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double* %120)
br label %122
122: ; preds = %115
%123 = load i32, i32* %7
%124 = add nsw i32 %123, 1
store i32 %124, i32* %7
br label %108
125: ; preds = %108
br label %145
126: ; preds = %100
store i32 0, i32* %7
br label %127
127: ; preds = %141, %126
%128 = load i32, i32* %7
%129 = load i32, i32* %8
%130 = mul nsw i32 8, %129
%131 = load i32, i32* %8
%132 = mul nsw i32 %130, %131
%133 = icmp slt i32 %128, %132
br i1 %133, label %134, label %144
134: ; preds = %127
%135 = load i32*, i32** %6
%136 = load double*, double** %10
%137 = load i32, i32* %7
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %136, i64 %138
%140 = call i32 @fscanf(i32* %135, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double* %139)
br label %141
141: ; preds = %134
%142 = load i32, i32* %7
%143 = add nsw i32 %142, 1
store i32 %143, i32* %7
br label %127
144: ; preds = %127
br label %145
145: ; preds = %144, %125
%146 = load i32*, i32** %6
%147 = call i32 @fclose(i32* %146)
%148 = load i32, i32* @stdout
%149 = call i32 (i32, i8*, ...) @fprintf(i32 %148, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%150 = call double (...) @csecond()
store double %150, double* %15
%151 = load i32, i32* %8
%152 = load double*, double** %10
%153 = load double*, double** %11
%154 = load double, double* %12
%155 = load double, double* %13
%156 = load double, double* %14
%157 = load i32, i32* %9
%158 = call i32 @s2Rotate(i32 %151, double* %152, double* %153, double %154, double %155, double %156, i32 %157)
%159 = call double (...) @csecond()
store double %159, double* %16
%160 = load i32, i32* @stdout
%161 = call i32 (i32, i8*, ...) @fprintf(i32 %160, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%162 = load i32, i32* @stdout
%163 = load double, double* %16
%164 = load double, double* %15
%165 = fsub double %163, %164
%166 = call i32 (i32, i8*, ...) @fprintf(i32 %162, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), double %165)
%167 = load i8**, i8*** %5
%168 = getelementptr inbounds i8*, i8** %167, i64 6
%169 = load i8*, i8** %168
%170 = call i32* @fopen(i8* %169, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %170, i32** %6
%171 = load i32, i32* %9
%172 = icmp ne i32 %171, 0
br i1 %172, label %173, label %194
173: ; preds = %145
store i32 0, i32* %7
br label %174
174: ; preds = %190, %173
%175 = load i32, i32* %7
%176 = load i32, i32* %8
%177 = mul nsw i32 4, %176
%178 = load i32, i32* %8
%179 = mul nsw i32 %177, %178
%180 = icmp slt i32 %175, %179
br i1 %180, label %181, label %193
181: ; preds = %174
%182 = load i32*, i32** %6
%183 = ptrtoint i32* %182 to i32
%184 = load double*, double** %11
%185 = load i32, i32* %7
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds double, double* %184, i64 %186
%188 = load double, double* %187
%189 = call i32 (i32, i8*, ...) @fprintf(i32 %183, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), double %188)
br label %190
190: ; preds = %181
%191 = load i32, i32* %7
%192 = add nsw i32 %191, 1
store i32 %192, i32* %7
br label %174
193: ; preds = %174
br label %223
194: ; preds = %145
store i32 0, i32* %7
br label %195
195: ; preds = %219, %194
%196 = load i32, i32* %7
%197 = load i32, i32* %8
%198 = mul nsw i32 4, %197
%199 = load i32, i32* %8
%200 = mul nsw i32 %198, %199
%201 = icmp slt i32 %196, %200
br i1 %201, label %202, label %222
202: ; preds = %195
%203 = load i32*, i32** %6
%204 = ptrtoint i32* %203 to i32
%205 = load double*, double** %11
%206 = load i32, i32* %7
%207 = mul nsw i32 2, %206
%208 = sext i32 %207 to i64
%209 = getelementptr inbounds double, double* %205, i64 %208
%210 = load double, double* %209
%211 = load double*, double** %11
%212 = load i32, i32* %7
%213 = mul nsw i32 2, %212
%214 = add nsw i32 %213, 1
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds double, double* %211, i64 %215
%217 = load double, double* %216
%218 = call i32 (i32, i8*, ...) @fprintf(i32 %204, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), double %210, double %217)
br label %219
219: ; preds = %202
%220 = load i32, i32* %7
%221 = add nsw i32 %220, 1
store i32 %221, i32* %7
br label %195
222: ; preds = %195
br label %223
223: ; preds = %222, %193
%224 = load i32*, i32** %6
%225 = call i32 @fclose(i32* %224)
%226 = load i32, i32* @stdout
%227 = call i32 (i32, i8*, ...) @fprintf(i32 %226, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
%228 = load double*, double** %11
%229 = call i32 @free(double* %228)
%230 = load double*, double** %10
%231 = call i32 @free(double* %230)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [31 x i8] c"Usage: test_s2_rotate_wrap bw \00"
@.str.1 = [18 x i8] c"alpha beta gamma \00"
@.str.2 = [39 x i8] c"input_filename output_filename isReal\0A\00"
@.str.3 = [27 x i8] c"Error in allocating memory\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [4 x i8] c"%lf\00"
@.str.6 = [21 x i8] c"about to rotate ...\0A\00"
@.str.7 = [23 x i8] c"finished rotating ...\0A\00"
@.str.8 = [24 x i8] c"rotation time \09 = %.4e\0A\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [7 x i8] c"%.15f\0A\00"
@.str.11 = [13 x i8] c"%.15f\0A%.15f\0A\00"
@.str.12 = [22 x i8] c"finished writing ...\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 8
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = load i32, i32* @stdout
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stdout
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @stdout
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @exit(i32 0)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i64 @atof(i8* %17)
%19 = sitofp i64 %18 to double
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = tail call i64 @atof(i8* %21)
%23 = sitofp i64 %22 to double
%24 = getelementptr inbounds i8*, i8** %1, i64 4
%25 = load i8*, i8** %24
%26 = tail call i64 @atof(i8* %25)
%27 = sitofp i64 %26 to double
%28 = getelementptr inbounds i8*, i8** %1, i64 7
%29 = load i8*, i8** %28
%30 = tail call i32 @atoi(i8* %29)
%31 = icmp eq i32 %30, 0
%32 = select i1 %31, i32 6, i32 5
%33 = shl i32 %15, %32
%34 = mul i32 %33, %15
%35 = tail call i64 @malloc(i32 %34)
%36 = tail call i64 @malloc(i32 %34)
%37 = inttoptr i64 %35 to double*
%38 = inttoptr i64 %36 to double*
%39 = icmp eq i64 %35, 0
%40 = icmp eq i64 %36, 0
%41 = select i1 %39, i1 true, i1 %40
br i1 %41, label %42, label %45
42: ; preds = %12
%43 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%44 = tail call i32 @exit(i32 1)
unreachable
45: ; preds = %12
%46 = getelementptr inbounds i8*, i8** %1, i64 5
%47 = load i8*, i8** %46
%48 = tail call i32* @fopen(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br i1 %31, label %55, label %49
49: ; preds = %45
%50 = shl nsw i32 %15, 2
%51 = mul i32 %50, %15
%52 = icmp sgt i32 %51, 0
br i1 %52, label %53, label %73
53: ; preds = %49
%54 = zext i32 %51 to i64
br label %61
55: ; preds = %45
%56 = shl nsw i32 %15, 3
%57 = mul i32 %56, %15
%58 = icmp sgt i32 %57, 0
br i1 %58, label %59, label %73
59: ; preds = %55
%60 = zext i32 %57 to i64
br label %67
61: ; preds = %53, %61
%62 = phi i64 [ 0, %53 ], [ %65, %61 ]
%63 = getelementptr inbounds double, double* %37, i64 %62
%64 = tail call i32 @fscanf(i32* %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double* %63)
%65 = add nuw nsw i64 %62, 1
%66 = icmp eq i64 %65, %54
br i1 %66, label %73, label %61
67: ; preds = %59, %67
%68 = phi i64 [ 0, %59 ], [ %71, %67 ]
%69 = getelementptr inbounds double, double* %37, i64 %68
%70 = tail call i32 @fscanf(i32* %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double* %69)
%71 = add nuw nsw i64 %68, 1
%72 = icmp eq i64 %71, %60
br i1 %72, label %73, label %67
73: ; preds = %61, %67, %49, %55
%74 = tail call i32 @fclose(i32* %48)
%75 = load i32, i32* @stdout
%76 = tail call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%77 = tail call double (...) @csecond()
%78 = tail call i32 @s2Rotate(i32 %15, double* %37, double* %38, double %19, double %23, double %27, i32 %30)
%79 = tail call double (...) @csecond()
%80 = load i32, i32* @stdout
%81 = tail call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%82 = load i32, i32* @stdout
%83 = fsub double %79, %77
%84 = tail call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), double %83)
%85 = getelementptr inbounds i8*, i8** %1, i64 6
%86 = load i8*, i8** %85
%87 = tail call i32* @fopen(i8* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%88 = shl nsw i32 %15, 2
%89 = mul i32 %88, %15
%90 = icmp sgt i32 %89, 0
br i1 %31, label %96, label %91
91: ; preds = %73
br i1 %90, label %92, label %119
92: ; preds = %91
%93 = ptrtoint i32* %87 to i64
%94 = trunc i64 %93 to i32
%95 = zext i32 %89 to i64
br label %101
96: ; preds = %73
br i1 %90, label %97, label %119
97: ; preds = %96
%98 = ptrtoint i32* %87 to i64
%99 = trunc i64 %98 to i32
%100 = zext i32 %89 to i64
br label %108
101: ; preds = %92, %101
%102 = phi i64 [ 0, %92 ], [ %106, %101 ]
%103 = getelementptr inbounds double, double* %38, i64 %102
%104 = load double, double* %103
%105 = tail call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), double %104)
%106 = add nuw nsw i64 %102, 1
%107 = icmp eq i64 %106, %95
br i1 %107, label %119, label %101
108: ; preds = %97, %108
%109 = phi i64 [ 0, %97 ], [ %117, %108 ]
%110 = shl nuw nsw i64 %109, 1
%111 = getelementptr inbounds double, double* %38, i64 %110
%112 = load double, double* %111
%113 = or i64 %110, 1
%114 = getelementptr inbounds double, double* %38, i64 %113
%115 = load double, double* %114
%116 = tail call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), double %112, double %115)
%117 = add nuw nsw i64 %109, 1
%118 = icmp eq i64 %117, %100
br i1 %118, label %119, label %108
119: ; preds = %101, %108, %91, %96
%120 = tail call i32 @fclose(i32* %87)
%121 = load i32, i32* @stdout
%122 = tail call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
%123 = tail call i32 @free(double* %38)
%124 = tail call i32 @free(double* %37)
ret i32 0
}