#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 */
struct timeval {
  long long tv_sec;
  long long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ abort();
int atoi(char *);
int /*<<< orphan*/ bitSorter(int *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
float floor(float);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int getopt(int, char **, char *);
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ isprint(int);
float log2(float);
scalar_t__ malloc(int);
scalar_t__ opterr;
int optind;
int optopt;
int /*<<< orphan*/ printf(char *, ...);
int randomSequence(int *, int, int, int);
int /*<<< orphan*/ sort_test(int *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int argument = 0;
  int i;
  int c;
  opterr = 0;
  if (argc < 4 || argc > 5) {
    printf("\nusage: %s N a b -options\n\n", argv[0]);
    printf("-N is the dimension of the array to be sorted \n -a and b are the "
           "lower and upper bounds in which the random values are generated\n");
    printf("-option:\n");
    printf("-e the output is only the execution time\n");
    printf("-v verbose\n");
    exit(0);
  }
  if ((c = getopt(argc, argv, "ev")) != -1) {
    switch (c) {
    case 'e':
      argument = 1;
      break;
    case 'v':
      argument = 2;
      break;
    case '?':
      if (isprint(optopt))
        fprintf(stderr, "Opzione non valida `-%c'.\n", optopt);
      else
        fprintf(stderr, "Carattere non valido  `\\x%x'.\n", optopt);
      return 1;
    default:
      abort();
    }
    for (i = optind; i < argc; i++)
      printf("l'opzione non esiste %s\n", argv[i]);
  }
  int N = atoi(argv[1]);
  int a = atoi(argv[2]);
  int b = atoi(argv[3]);
  float log = log2((float)N);
  if (log - floor(log) != 0.0f) {
    printf("\nerror: N must be a power of 2\n\n");
    exit(0);
  }
  int *array = (int *)malloc(sizeof(int) * N);
  int err;
  if ((err = randomSequence(array, N, a, b)) != 0) {
    printf("\nerror: a must be lower than b\n\n");
    exit(0);
  }
  if (argument == 2) {
    printf("\ninput \n\n");
    for (i = 0; i < N; i++)
      printf(" %d ", array[i]);
    printf("\n\n\n");
  }
  struct timeval start, end;
  if (err = gettimeofday(&start, NULL) != 0)
    printf("error");
  bitSorter(array, N);
  if (err = gettimeofday(&end, NULL) != 0)
    printf("error");
  long long elapsed =
      (end.tv_sec - start.tv_sec) * 1000000LL + end.tv_usec - start.tv_usec;
  sort_test(array, N);
  if (argument == 2) {
    printf("\n\nsorted array\n\n");
    for (i = 0; i < N; i++)
      printf(" %d ", array[i]);
    printf("\n");
  }
  if (argument == 2 || argument == 1) {
    printf("\n\nthe execution time is:  %f \n\n", (float)elapsed / 1000000);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0x2dc4(%rip),%rax
movq   $0x0,(%rax)
cmpl   $0x4,-0x8(%rbp)
jl     121f <main+0x3f>
cmpl   $0x5,-0x8(%rbp)
jle    1273 <main+0x93>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe61(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     1390 <main+0x1b0>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x6c(%rbp)
sub    $0x3f,%eax
je     12e0 <main+0x100>
jmp    12a6 <main+0xc6>
mov    -0x6c(%rbp),%eax
sub    $0x65,%eax
je     12c8 <main+0xe8>
jmp    12b7 <main+0xd7>
mov    -0x6c(%rbp),%eax
sub    $0x76,%eax
je     12d4 <main+0xf4>
jmp    1344 <main+0x164>
movl   $0x1,-0x14(%rbp)
jmp    134b <main+0x16b>
movl   $0x2,-0x14(%rbp)
jmp    134b <main+0x16b>
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
call   1090 <isprint@plt>
cmp    $0x0,%eax
je     131a <main+0x13a>
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
mov    0x2ce1(%rip),%rax
mov    (%rax),%edx
lea    0xdd5(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1338 <main+0x158>
mov    0x2caf(%rip),%rax
mov    (%rax),%edi
mov    0x2cbe(%rip),%rax
mov    (%rax),%edx
lea    0xdcd(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1607 <main+0x427>
mov    $0x0,%al
call   1030 <abort@plt>
mov    0x2c8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    138b <main+0x1ab>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1357 <main+0x177>
jmp    1390 <main+0x1b0>
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   10d0 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x28(%rbp)
cvtsi2ssl -0x20(%rbp),%xmm0
call   1040 <log2@plt>
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x2c(%rbp),%xmm0
call   10f0 <floor@plt>
movaps %xmm0,%xmm1
movss  -0x70(%rbp),%xmm0
subss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1406 <main+0x226>
jp     1406 <main+0x226>
jmp    141b <main+0x23b>
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
call   10b0 <randomSequence@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
je     1461 <main+0x281>
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
cmpl   $0x2,-0x14(%rbp)
jne    14c1 <main+0x2e1>
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    14b3 <main+0x2d3>
mov    -0x38(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xce6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1480 <main+0x2a0>
lea    0xccf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x50(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x3c(%rbp)
test   $0x1,%al
jne    14ed <main+0x30d>
jmp    14fb <main+0x31b>
lea    0xc99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1100 <bitSorter@plt>
lea    -0x60(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x3c(%rbp)
test   $0x1,%al
jne    1533 <main+0x353>
jmp    1541 <main+0x361>
lea    0xc53(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x60(%rbp),%rax
sub    -0x50(%rbp),%rax
imul   $0xf4240,%rax,%rax
add    -0x58(%rbp),%rax
sub    -0x48(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   10a0 <sort_test@plt>
cmpl   $0x2,-0x14(%rbp)
jne    15c8 <main+0x3e8>
lea    0xc1a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    15ba <main+0x3da>
mov    -0x38(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xbdf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1587 <main+0x3a7>
lea    0xbca(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x2,-0x14(%rbp)
je     15dc <main+0x3fc>
cmpl   $0x1,-0x14(%rbp)
jne    1600 <main+0x420>
cvtsi2ssq -0x68(%rbp),%xmm0
movss  0xa16(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xbab(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r15
mov    %edi,%r12d
mov    0x2dad(%rip),%rax
movq   $0x0,(%rax)
lea    -0x6(%r12),%eax
cmp    $0xfffffffd,%eax
jbe    14c5 <main+0x2c5>
lea    0xde9(%rip),%rdx
mov    %r12d,%edi
mov    %r15,%rsi
call   10f0 <getopt@plt>
cmp    $0x64,%eax
jg     1288 <main+0x88>
xor    %ebx,%ebx
cmp    $0xffffffff,%eax
je     12eb <main+0xeb>
cmp    $0x3f,%eax
jne    151f <main+0x31f>
mov    0x2d86(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10c0 <isprint@plt>
mov    0x2d5e(%rip),%rcx
mov    (%rcx),%edi
test   %eax,%eax
je     14a3 <main+0x2a3>
lea    0xda0(%rip),%rsi
jmp    14aa <main+0x2aa>
mov    $0x1,%ebx
cmp    $0x65,%eax
je     12a0 <main+0xa0>
cmp    $0x76,%eax
jne    151f <main+0x31f>
mov    $0x2,%ebx
mov    0x2d39(%rip),%rax
movslq (%rax),%rax
cmp    %r12d,%eax
jge    12eb <main+0xeb>
mov    %ebx,%r13d
lea    (%r15,%rax,8),%rbp
sub    %eax,%r12d
lea    0xd9d(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%rbp,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    12d0 <main+0xd0>
mov    %r13d,%ebx
mov    0x8(%r15),%rdi
call   1100 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%r15),%rdi
call   1100 <atoi@plt>
mov    %eax,%r12d
mov    0x18(%r15),%rdi
call   1100 <atoi@plt>
mov    %eax,%ebp
cvtsi2ss %r14d,%xmm0
call   1050 <log2@plt>
movss  %xmm0,0x4(%rsp)
call   1090 <floorf@plt>
movss  0x4(%rsp),%xmm1
subss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jne    1503 <main+0x303>
jp     1503 <main+0x303>
lea    0x0(,%r14,4),%edi
call   10b0 <malloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
call   10e0 <randomSequence@plt>
test   %eax,%eax
jne    150c <main+0x30c>
cmp    $0x2,%ebx
jne    13b7 <main+0x1b7>
mov    %ebx,%r12d
lea    0xd3b(%rip),%rdi
call   1060 <puts@plt>
test   %r14d,%r14d
jle    13a8 <main+0x1a8>
mov    %r14d,%ebp
lea    0xcec(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    0x0(%r13,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1390 <main+0x190>
lea    0xcef(%rip),%rdi
call   1060 <puts@plt>
mov    %r12d,%ebx
lea    0x18(%rsp),%rdi
xor    %esi,%esi
call   1080 <gettimeofday@plt>
test   %rax,%rax
je     13d6 <main+0x1d6>
lea    0xcac(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,%rdi
mov    %r14d,%esi
call   1120 <bitSorter@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1080 <gettimeofday@plt>
test   %rax,%rax
je     1400 <main+0x200>
lea    0xc82(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8(%rsp),%rax
sub    0x18(%rsp),%rax
imul   $0xf4240,%rax,%r15
add    0x10(%rsp),%r15
sub    0x20(%rsp),%r15
mov    %r13,%rdi
mov    %r14d,%esi
call   10d0 <sort_test@plt>
cmp    $0x2,%ebx
jne    1475 <main+0x275>
mov    %ebx,%r12d
lea    0xc6c(%rip),%rdi
call   1060 <puts@plt>
test   %r14d,%r14d
jle    1468 <main+0x268>
mov    %r14d,%ebp
lea    0xc2d(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1450 <main+0x250>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12d,%ebx
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     149f <main+0x29f>
xorps  %xmm0,%xmm0
cvtsi2ss %r15,%xmm0
divss  0xb73(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xbe9(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
xor    %eax,%eax
jmp    14b6 <main+0x2b6>
lea    0xb94(%rip),%rsi
mov    %ebx,%edx
call   10a0 <fprintf@plt>
mov    $0x1,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r15),%rsi
lea    0xb35(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xc1d(%rip),%rdi
call   1060 <puts@plt>
lea    0xc92(%rip),%rdi
call   1060 <puts@plt>
lea    0xc8f(%rip),%rdi
call   1060 <puts@plt>
lea    0xcac(%rip),%rdi
jmp    1513 <main+0x313>
lea    0xbd0(%rip),%rdi
jmp    1513 <main+0x313>
lea    0xba7(%rip),%rdi
call   1060 <puts@plt>
xor    %edi,%edi
call   1110 <exit@plt>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
@opterr = global i64 0
@.str = [28 x i8] c"\0Ausage: %s N a b -options\0A\0A\00"
@.str.1 = [130 x i8] c"-N is the dimension of the array to be sorted \0A -a and b are the lower and upper bounds in which the random values are generated\0A\00"
@.str.2 = [10 x i8] c"-option:\0A\00"
@.str.3 = [42 x i8] c"-e the output is only the execution time\0A\00"
@.str.4 = [12 x i8] c"-v verbose\0A\00"
@.str.5 = [3 x i8] c"ev\00"
@optopt = global i32 0
@stderr = global i32 0
@.str.6 = [27 x i8] c"Opzione non valida `-%c'.\0A\00"
@.str.7 = [31 x i8] c"Carattere non valido `\\x%x'.\0A\00"
@optind = global i32 0
@.str.8 = [25 x i8] c"l'opzione non esiste %s\0A\00"
@.str.9 = [33 x i8] c"\0Aerror: N must be a power of 2\0A\0A\00"
@.str.10 = [33 x i8] c"\0Aerror: a must be lower than b\0A\0A\00"
@.str.11 = [10 x i8] c"\0Ainput \0A\0A\00"
@.str.12 = [5 x i8] c" %d \00"
@.str.13 = [4 x i8] c"\0A\0A\0A\00"
@.str.14 = [6 x i8] c"error\00"
@.str.15 = [17 x i8] c"\0A\0Asorted array\0A\0A\00"
@.str.16 = [2 x i8] c"\0A\00"
@.str.17 = [32 x i8] c"\0A\0Athe execution time is: %f \0A\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 i32
%11 = alloca i32
%12 = alloca float
%13 = alloca i32*
%14 = alloca i32
%15 = alloca %struct.timeval
%16 = alloca %struct.timeval
%17 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i64 0, i64* @opterr
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 4
br i1 %19, label %23, label %20
20: ; preds = %2
%21 = load i32, i32* %4
%22 = icmp sgt i32 %21, 5
br i1 %22, label %23, label %33
23: ; preds = %20, %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%32 = call i32 @exit(i32 0)
unreachable
33: ; preds = %20
%34 = load i32, i32* %4
%35 = load i8**, i8*** %5
%36 = call i32 @getopt(i32 %34, i8** %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32 %36, i32* %8
%37 = icmp ne i32 %36, -1
br i1 %37, label %38, label %74
38: ; preds = %33
%39 = load i32, i32* %8
switch i32 %39, label %55 [
i32 101, label %40
i32 118, label %41
i32 63, label %42
]
40: ; preds = %38
store i32 1, i32* %6
br label %57
41: ; preds = %38
store i32 2, i32* %6
br label %57
42: ; preds = %38
%43 = load i32, i32* @optopt
%44 = call i32 @isprint(i32 %43)
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %42
%47 = load i32, i32* @stderr
%48 = load i32, i32* @optopt
%49 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %48)
br label %54
50: ; preds = %42
%51 = load i32, i32* @stderr
%52 = load i32, i32* @optopt
%53 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %50, %46
store i32 1, i32* %3
br label %199
55: ; preds = %38
%56 = call i32 (...) @abort()
unreachable
57: ; preds = %41, %40
%58 = load i32, i32* @optind
store i32 %58, i32* %7
br label %59
59: ; preds = %70, %57
%60 = load i32, i32* %7
%61 = load i32, i32* %4
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %73
63: ; preds = %59
%64 = load i8**, i8*** %5
%65 = load i32, i32* %7
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %64, i64 %66
%68 = load i8*, i8** %67
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %68)
br label %70
70: ; preds = %63
%71 = load i32, i32* %7
%72 = add nsw i32 %71, 1
store i32 %72, i32* %7
br label %59
73: ; preds = %59
br label %74
74: ; preds = %73, %33
%75 = load i8**, i8*** %5
%76 = getelementptr inbounds i8*, i8** %75, i64 1
%77 = load i8*, i8** %76
%78 = call i32 @atoi(i8* %77)
store i32 %78, i32* %9
%79 = load i8**, i8*** %5
%80 = getelementptr inbounds i8*, i8** %79, i64 2
%81 = load i8*, i8** %80
%82 = call i32 @atoi(i8* %81)
store i32 %82, i32* %10
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 3
%85 = load i8*, i8** %84
%86 = call i32 @atoi(i8* %85)
store i32 %86, i32* %11
%87 = load i32, i32* %9
%88 = sitofp i32 %87 to float
%89 = call float @log2(float %88)
store float %89, float* %12
%90 = load float, float* %12
%91 = load float, float* %12
%92 = call float @floor(float %91)
%93 = fsub float %90, %92
%94 = fcmp une float %93, 0.000000e+00
br i1 %94, label %95, label %98
95: ; preds = %74
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0))
%97 = call i32 @exit(i32 0)
unreachable
98: ; preds = %74
%99 = load i32, i32* %9
%100 = sext i32 %99 to i64
%101 = mul i64 4, %100
%102 = trunc i64 %101 to i32
%103 = call i64 @malloc(i32 %102)
%104 = inttoptr i64 %103 to i32*
store i32* %104, i32** %13
%105 = load i32*, i32** %13
%106 = load i32, i32* %9
%107 = load i32, i32* %10
%108 = load i32, i32* %11
%109 = call i32 @randomSequence(i32* %105, i32 %106, i32 %107, i32 %108)
store i32 %109, i32* %14
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %114
111: ; preds = %98
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0))
%113 = call i32 @exit(i32 0)
unreachable
114: ; preds = %98
%115 = load i32, i32* %6
%116 = icmp eq i32 %115, 2
br i1 %116, label %117, label %135
117: ; preds = %114
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %7
br label %119
119: ; preds = %130, %117
%120 = load i32, i32* %7
%121 = load i32, i32* %9
%122 = icmp slt i32 %120, %121
br i1 %122, label %123, label %133
123: ; preds = %119
%124 = load i32*, i32** %13
%125 = load i32, i32* %7
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i32, i32* %124, i64 %126
%128 = load i32, i32* %127
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 %128)
br label %130
130: ; preds = %123
%131 = load i32, i32* %7
%132 = add nsw i32 %131, 1
store i32 %132, i32* %7
br label %119
133: ; preds = %119
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
br label %135
135: ; preds = %133, %114
%136 = call i64 @gettimeofday(%struct.timeval* %15, i32* null)
%137 = icmp ne i64 %136, 0
%138 = zext i1 %137 to i32
store i32 %138, i32* %14
br i1 %137, label %139, label %141
139: ; preds = %135
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
br label %141
141: ; preds = %139, %135
%142 = load i32*, i32** %13
%143 = load i32, i32* %9
%144 = call i32 @bitSorter(i32* %142, i32 %143)
%145 = call i64 @gettimeofday(%struct.timeval* %16, i32* null)
%146 = icmp ne i64 %145, 0
%147 = zext i1 %146 to i32
store i32 %147, i32* %14
br i1 %146, label %148, label %150
148: ; preds = %141
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
br label %150
150: ; preds = %148, %141
%151 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 0
%152 = load i64, i64* %151
%153 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 0
%154 = load i64, i64* %153
%155 = sub nsw i64 %152, %154
%156 = mul nsw i64 %155, 1000000
%157 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 1
%158 = load i64, i64* %157
%159 = add nsw i64 %156, %158
%160 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 1
%161 = load i64, i64* %160
%162 = sub nsw i64 %159, %161
store i64 %162, i64* %17
%163 = load i32*, i32** %13
%164 = load i32, i32* %9
%165 = call i32 @sort_test(i32* %163, i32 %164)
%166 = load i32, i32* %6
%167 = icmp eq i32 %166, 2
br i1 %167, label %168, label %186
168: ; preds = %150
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0))
store i32 0, i32* %7
br label %170
170: ; preds = %181, %168
%171 = load i32, i32* %7
%172 = load i32, i32* %9
%173 = icmp slt i32 %171, %172
br i1 %173, label %174, label %184
174: ; preds = %170
%175 = load i32*, i32** %13
%176 = load i32, i32* %7
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds i32, i32* %175, i64 %177
%179 = load i32, i32* %178
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 %179)
br label %181
181: ; preds = %174
%182 = load i32, i32* %7
%183 = add nsw i32 %182, 1
store i32 %183, i32* %7
br label %170
184: ; preds = %170
%185 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
br label %186
186: ; preds = %184, %150
%187 = load i32, i32* %6
%188 = icmp eq i32 %187, 2
br i1 %188, label %192, label %189
189: ; preds = %186
%190 = load i32, i32* %6
%191 = icmp eq i32 %190, 1
br i1 %191, label %192, label %198
192: ; preds = %189, %186
%193 = load i64, i64* %17
%194 = sitofp i64 %193 to float
%195 = fdiv float %194, 1.000000e+06
%196 = fpext float %195 to double
%197 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.17, i64 0, i64 0), double %196)
br label %198
198: ; preds = %192, %189
store i32 0, i32* %3
br label %199
199: ; preds = %198, %54
%200 = load i32, i32* %3
ret i32 %200
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
@opterr = global i64 0
@.str = [28 x i8] c"\0Ausage: %s N a b -options\0A\0A\00"
@.str.5 = [3 x i8] c"ev\00"
@optopt = global i32 0
@stderr = global i32 0
@.str.6 = [27 x i8] c"Opzione non valida `-%c'.\0A\00"
@.str.7 = [31 x i8] c"Carattere non valido `\\x%x'.\0A\00"
@optind = global i32 0
@.str.8 = [25 x i8] c"l'opzione non esiste %s\0A\00"
@.str.12 = [5 x i8] c" %d \00"
@.str.14 = [6 x i8] c"error\00"
@.str.17 = [32 x i8] c"\0A\0Athe execution time is: %f \0A\0A\00"
@str = [16 x i8] c"\0A\0Asorted array\0A\00"
@str.18 = [9 x i8] c"\0Ainput \0A\00"
@str.19 = [3 x i8] c"\0A\0A\00"
@str.20 = [32 x i8] c"\0Aerror: a must be lower than b\0A\00"
@str.21 = [32 x i8] c"\0Aerror: N must be a power of 2\0A\00"
@str.22 = [129 x i8] c"-N is the dimension of the array to be sorted \0A -a and b are the lower and upper bounds in which the random values are generated\00"
@str.23 = [9 x i8] c"-option:\00"
@str.24 = [41 x i8] c"-e the output is only the execution time\00"
@str.25 = [11 x i8] c"-v verbose\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
store i64 0, i64* @opterr
%5 = add i32 %0, -6
%6 = icmp ult i32 %5, -2
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = load i8*, i8** %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([129 x i8], [129 x i8]* @str.22, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.23, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.24, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.25, i64 0, i64 0))
%14 = tail call i32 @exit(i32 0)
unreachable
15: ; preds = %2
%16 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
switch i32 %16, label %27 [
i32 -1, label %43
i32 101, label %29
i32 118, label %17
i32 63, label %18
]
17: ; preds = %15
br label %29
18: ; preds = %15
%19 = load i32, i32* @optopt
%20 = tail call i32 @isprint(i32 %19)
%21 = icmp eq i32 %20, 0
%22 = load i32, i32* @stderr
br i1 %21, label %25, label %23
23: ; preds = %18
%24 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %19)
br label %137
25: ; preds = %18
%26 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %19)
br label %137
27: ; preds = %15
%28 = tail call i32 (...) @abort()
unreachable
29: ; preds = %15, %17
%30 = phi i32 [ 2, %17 ], [ 1, %15 ]
%31 = load i32, i32* @optind
%32 = icmp slt i32 %31, %0
br i1 %32, label %33, label %43
33: ; preds = %29
%34 = sext i32 %31 to i64
br label %35
35: ; preds = %33, %35
%36 = phi i64 [ %34, %33 ], [ %40, %35 ]
%37 = getelementptr inbounds i8*, i8** %1, i64 %36
%38 = load i8*, i8** %37
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %38)
%40 = add nsw i64 %36, 1
%41 = trunc i64 %40 to i32
%42 = icmp eq i32 %41, %0
br i1 %42, label %43, label %35
43: ; preds = %35, %29, %15
%44 = phi i32 [ 0, %15 ], [ %30, %29 ], [ %30, %35 ]
%45 = getelementptr inbounds i8*, i8** %1, i64 1
%46 = load i8*, i8** %45
%47 = tail call i32 @atoi(i8* %46)
%48 = getelementptr inbounds i8*, i8** %1, i64 2
%49 = load i8*, i8** %48
%50 = tail call i32 @atoi(i8* %49)
%51 = getelementptr inbounds i8*, i8** %1, i64 3
%52 = load i8*, i8** %51
%53 = tail call i32 @atoi(i8* %52)
%54 = sitofp i32 %47 to float
%55 = tail call float @log2(float %54)
%56 = tail call float @llvm.floor.f32(float %55)
%57 = fsub float %55, %56
%58 = fcmp une float %57, 0.000000e+00
br i1 %58, label %59, label %62
59: ; preds = %43
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.21, i64 0, i64 0))
%61 = tail call i32 @exit(i32 0)
unreachable
62: ; preds = %43
%63 = shl i32 %47, 2
%64 = tail call i64 @malloc(i32 %63)
%65 = inttoptr i64 %64 to i32*
%66 = tail call i32 @randomSequence(i32* %65, i32 %47, i32 %50, i32 %53)
%67 = icmp eq i32 %66, 0
br i1 %67, label %71, label %68
68: ; preds = %62
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.20, i64 0, i64 0))
%70 = tail call i32 @exit(i32 0)
unreachable
71: ; preds = %62
%72 = icmp eq i32 %44, 2
br i1 %72, label %73, label %87
73: ; preds = %71
%74 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.18, i64 0, i64 0))
%75 = icmp sgt i32 %47, 0
br i1 %75, label %76, label %85
76: ; preds = %73
%77 = zext i32 %47 to i64
br label %78
78: ; preds = %76, %78
%79 = phi i64 [ 0, %76 ], [ %83, %78 ]
%80 = getelementptr inbounds i32, i32* %65, i64 %79
%81 = load i32, i32* %80
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 %81)
%83 = add nuw nsw i64 %79, 1
%84 = icmp eq i64 %83, %77
br i1 %84, label %85, label %78
85: ; preds = %78, %73
%86 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.19, i64 0, i64 0))
br label %87
87: ; preds = %85, %71
%88 = bitcast %struct.timeval* %3 to i8*
%89 = bitcast %struct.timeval* %4 to i8*
%90 = call i64 @gettimeofday(%struct.timeval* %3, i32* null)
%91 = icmp eq i64 %90, 0
br i1 %91, label %94, label %92
92: ; preds = %87
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
br label %94
94: ; preds = %92, %87
%95 = tail call i32 @bitSorter(i32* %65, i32 %47)
%96 = call i64 @gettimeofday(%struct.timeval* %4, i32* null)
%97 = icmp eq i64 %96, 0
br i1 %97, label %100, label %98
98: ; preds = %94
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
br label %100
100: ; preds = %98, %94
%101 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%102 = load i64, i64* %101
%103 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%104 = load i64, i64* %103
%105 = sub nsw i64 %102, %104
%106 = mul nsw i64 %105, 1000000
%107 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%108 = load i64, i64* %107
%109 = add nsw i64 %106, %108
%110 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%111 = load i64, i64* %110
%112 = sub i64 %109, %111
%113 = tail call i32 @sort_test(i32* %65, i32 %47)
br i1 %72, label %114, label %128
114: ; preds = %100
%115 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%116 = icmp sgt i32 %47, 0
br i1 %116, label %117, label %126
117: ; preds = %114
%118 = zext i32 %47 to i64
br label %119
119: ; preds = %117, %119
%120 = phi i64 [ 0, %117 ], [ %124, %119 ]
%121 = getelementptr inbounds i32, i32* %65, i64 %120
%122 = load i32, i32* %121
%123 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 %122)
%124 = add nuw nsw i64 %120, 1
%125 = icmp eq i64 %124, %118
br i1 %125, label %126, label %119
126: ; preds = %119, %114
%127 = tail call i32 @putchar(i32 10)
br label %128
128: ; preds = %126, %100
%129 = add nsw i32 %44, -1
%130 = icmp ult i32 %129, 2
br i1 %130, label %131, label %136
131: ; preds = %128
%132 = sitofp i64 %112 to float
%133 = fdiv float %132, 1.000000e+06
%134 = fpext float %133 to double
%135 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.17, i64 0, i64 0), double %134)
br label %136
136: ; preds = %128, %131
br label %137
137: ; preds = %23, %25, %136
%138 = phi i32 [ 0, %136 ], [ 1, %25 ], [ 1, %23 ]
ret i32 %138
}