#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 double uint32_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ free(char **);
double get_time();
char **malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int rand();
int /*<<< orphan*/ simple_atoi(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int sse_atoi(char *);
scalar_t__ strcasecmp(char *, char *);
char *strdup(char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  char **array;
  char tmp[32];
  int n;
  int k;
  int i, j;
  enum { verify, measure_atoi, measure_sse };
  int function;
  if (argc < 3)
    usage();
  if ((strcasecmp("verify", argv[1]) == 0))
    function = verify;
  else if ((strcasecmp("atoi", argv[1]) == 0))
    function = measure_atoi;
  else if ((strcasecmp("sse", argv[1]) == 0))
    function = measure_sse;
  else
    usage();
  n = atoi(argv[2]);
  if (n == 0) {
    puts("number must be greater then 0");
    return EXIT_FAILURE;
  }
  if (argc > 3)
    k = atoi(argv[3]);
  else
    k = 1;
  if (n == 0) {
    puts("count must be greater then 0");
    return EXIT_FAILURE;
  }
  array = malloc(n * sizeof(char *));
  if (array == NULL) {
    perror("malloc");
    return EXIT_FAILURE;
  }
  for (i = 0; i < n; i++) {
    int x = rand();
    if (rand() % 2)
      x = -x;
    sprintf(tmp, "%d", x);
    array[i] = strdup(tmp);
  }
  if (function == verify) {
    puts("verify...");
    for (i = 0; i < n; i++) {
      int a = atoi(array[i]);
      int s = sse_atoi(array[i]);
      if (a != s) {
        printf("SSE failed at '%s' => %d, should be %d\n", array[i], a, s);
        return EXIT_FAILURE;
      }
    }
    puts("ok");
  } else if (function == measure_atoi) {
    printf("atoi, %d numbers, %d iterations\n", n, k);
    uint32_t t1, t2;
    t1 = get_time();
    for (j = 0; j < k; j++) {
      for (i = 0; i < n; i++) {
        simple_atoi(array[i]);
        simple_atoi(array[i]);
        simple_atoi(array[i]);
        simple_atoi(array[i]);
      }
    }
    t2 = get_time();
    printf("t = %0.3fs\n", (t2 - t1) / 1000000.0);
  } else if (function == measure_sse) {
    printf("SSE, %d numbers, %d iterations\n", n, k);
    uint32_t t1, t2;
    t1 = get_time();
    for (j = 0; j < k; j++) {
      for (i = 0; i < n; i++) {
        sse_atoi(array[i]);
        sse_atoi(array[i]);
        sse_atoi(array[i]);
        sse_atoi(array[i]);
      }
    }
    t2 = get_time();
    printf("t = %0.3fs\n", (t2 - t1) / 1000000.0);
  }
  free(array);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    120a <main+0x2a>
mov    $0x0,%al
call   10a0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdef(%rip),%rdi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1234 <main+0x54>
movl   $0x0,-0x54(%rbp)
jmp    1299 <main+0xb9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdcc(%rip),%rdi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    125e <main+0x7e>
movl   $0x1,-0x54(%rbp)
jmp    1294 <main+0xb4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xda7(%rip),%rdi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1288 <main+0xa8>
movl   $0x2,-0x54(%rbp)
jmp    128f <main+0xaf>
mov    $0x0,%al
call   10a0 <usage@plt>
jmp    1294 <main+0xb4>
jmp    1299 <main+0xb9>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    12d0 <main+0xf0>
lea    0xd5e(%rip),%rdi
call   1050 <puts@plt>
mov    0x2d1a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    166e <main+0x48e>
cmpl   $0x3,-0x8(%rbp)
jle    12ef <main+0x10f>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x48(%rbp)
jmp    12f6 <main+0x116>
movl   $0x1,-0x48(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    131d <main+0x13d>
lea    0xd2f(%rip),%rdi
call   1050 <puts@plt>
mov    0x2ccd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    166e <main+0x48e>
movslq -0x44(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1358 <main+0x178>
lea    0xd11(%rip),%rdi
call   10b0 <perror@plt>
mov    0x2c92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    166e <main+0x48e>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    13ce <main+0x1ee>
mov    $0x0,%al
call   1100 <rand@plt>
mov    %eax,-0x58(%rbp)
mov    $0x0,%al
call   1100 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1395 <main+0x1b5>
xor    %eax,%eax
sub    -0x58(%rbp),%eax
mov    %eax,-0x58(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x58(%rbp),%edx
lea    0xcb7(%rip),%rsi
call   10d0 <sprintf@plt>
lea    -0x40(%rbp),%rdi
call   10f0 <strdup@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    135f <main+0x17f>
cmpl   $0x0,-0x54(%rbp)
jne    1480 <main+0x2a0>
lea    0xc7e(%rip),%rdi
call   1050 <puts@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    146f <main+0x28f>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <sse_atoi@plt>
mov    %eax,-0x60(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x60(%rbp),%eax
je     145c <main+0x27c>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x5c(%rbp),%edx
mov    -0x60(%rbp),%ecx
lea    0xc23(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2b8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    166e <main+0x48e>
jmp    1461 <main+0x281>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    13eb <main+0x20b>
lea    0xc19(%rip),%rdi
call   1050 <puts@plt>
jmp    1659 <main+0x479>
cmpl   $0x1,-0x54(%rbp)
jne    156a <main+0x38a>
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
lea    0xbfb(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1080 <get_time@plt>
movsd  %xmm0,-0x68(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    1535 <main+0x355>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1522 <main+0x342>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10e0 <simple_atoi@plt>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10e0 <simple_atoi@plt>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10e0 <simple_atoi@plt>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10e0 <simple_atoi@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    14c4 <main+0x2e4>
jmp    1527 <main+0x347>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    14b1 <main+0x2d1>
mov    $0x0,%al
call   1080 <get_time@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  0xaad(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xb55(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
jmp    1654 <main+0x474>
cmpl   $0x2,-0x54(%rbp)
jne    164f <main+0x46f>
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
lea    0xb3e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1080 <get_time@plt>
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    161f <main+0x43f>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    160c <main+0x42c>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <sse_atoi@plt>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <sse_atoi@plt>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <sse_atoi@plt>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <sse_atoi@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    15ae <main+0x3ce>
jmp    1611 <main+0x431>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    159b <main+0x3bb>
mov    $0x0,%al
call   1080 <get_time@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  0x9c3(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xa6b(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
jmp    1654 <main+0x474>
jmp    1659 <main+0x479>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    0x296f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
mov    %edi,%r15d
cmp    $0x2,%edi
jg     1200 <main+0x20>
xor    %eax,%eax
call   10a0 <usage@plt>
mov    0x8(%rbx),%rbp
lea    0xdfd(%rip),%rdi
mov    %rbp,%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     124d <main+0x6d>
lea    0xdf0(%rip),%rdi
mov    %rbp,%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     125d <main+0x7d>
lea    0xde1(%rip),%rdi
mov    %rbp,%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     126c <main+0x8c>
xor    %eax,%eax
call   10a0 <usage@plt>
mov    %eax,0x8(%rsp)
jmp    1277 <main+0x97>
mov    $0x1,%bpl
xor    %r14d,%r14d
movl   $0x0,0x8(%rsp)
jmp    1277 <main+0x97>
mov    $0x1,%r14b
xor    %ebp,%ebp
movl   $0x0,0x8(%rsp)
jmp    1277 <main+0x97>
mov    $0x1,%al
mov    %eax,0x8(%rsp)
xor    %ebp,%ebp
xor    %r14d,%r14d
mov    0x10(%rbx),%rdi
call   10c0 <atoi@plt>
test   %eax,%eax
je     138b <main+0x1ab>
mov    %eax,%r13d
mov    %ebp,0x10(%rsp)
movl   $0x1,0x4(%rsp)
cmp    $0x4,%r15d
jl     12aa <main+0xca>
mov    0x18(%rbx),%rdi
call   10c0 <atoi@plt>
mov    %eax,0x4(%rsp)
lea    0x0(,%r13,8),%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     1551 <main+0x371>
mov    %rax,%r12
test   %r13d,%r13d
jle    13a3 <main+0x1c3>
mov    %r14d,0x14(%rsp)
mov    %r13,0x18(%rsp)
mov    %r13d,%r15d
lea    0xd5d(%rip),%rbx
lea    0x20(%rsp),%r13
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1100 <rand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1100 <rand@plt>
mov    %ebp,%edx
neg    %edx
test   $0x1,%al
cmove  %ebp,%edx
mov    %r13,%rdi
mov    %rbx,%rsi
call   10d0 <sprintf@plt>
mov    %r13,%rdi
call   10f0 <strdup@plt>
mov    %rax,(%r12,%r14,8)
add    $0x1,%r14
cmp    %r14,%r15
jne    12f0 <main+0x110>
testb  $0x1,0x10(%rsp)
mov    0x18(%rsp),%r13
mov    0x14(%rsp),%r14d
mov    0x8(%rsp),%eax
je     13cb <main+0x1eb>
lea    0xcf7(%rip),%rdi
call   1050 <puts@plt>
test   %r13d,%r13d
jle    13ba <main+0x1da>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,8),%rbp
mov    %rbp,%rdi
call   10c0 <atoi@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   1060 <sse_atoi@plt>
cmp    %eax,%r14d
jne    1532 <main+0x352>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1360 <main+0x180>
jmp    13ba <main+0x1da>
lea    0xc86(%rip),%rdi
call   1050 <puts@plt>
mov    0x2c42(%rip),%rax
jmp    1521 <main+0x341>
testb  $0x1,0x10(%rsp)
mov    0x8(%rsp),%eax
je     13cb <main+0x1eb>
lea    0xc8b(%rip),%rdi
call   1050 <puts@plt>
lea    0xcb1(%rip),%rdi
call   1050 <puts@plt>
jmp    1512 <main+0x332>
test   $0x1,%r14b
je     145f <main+0x27f>
lea    0xc99(%rip),%rdi
xor    %r15d,%r15d
mov    %r13d,%esi
mov    0x4(%rsp),%ebx
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1080 <get_time@plt>
movsd  %xmm0,0x8(%rsp)
test   %ebx,%ebx
jle    14ef <main+0x30f>
mov    %r13d,%r14d
jmp    141f <main+0x23f>
nopl   0x0(%rax)
add    $0x1,%r15d
cmp    0x4(%rsp),%r15d
je     14ef <main+0x30f>
test   %r13d,%r13d
jle    1410 <main+0x230>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r12,%rbx,8),%rbp
mov    %rbp,%rdi
call   10e0 <simple_atoi@plt>
mov    %rbp,%rdi
call   10e0 <simple_atoi@plt>
mov    %rbp,%rdi
call   10e0 <simple_atoi@plt>
mov    %rbp,%rdi
call   10e0 <simple_atoi@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1430 <main+0x250>
jmp    1410 <main+0x230>
test   $0x1,%al
je     1512 <main+0x332>
lea    0xc34(%rip),%rdi
xor    %r15d,%r15d
mov    %r13d,%esi
mov    0x4(%rsp),%ebx
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1080 <get_time@plt>
movsd  %xmm0,0x8(%rsp)
test   %ebx,%ebx
jle    14ef <main+0x30f>
mov    %r13d,%r14d
jmp    14ab <main+0x2cb>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15d
cmp    0x4(%rsp),%r15d
je     14ef <main+0x30f>
test   %r13d,%r13d
jle    14a0 <main+0x2c0>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12,%rbx,8),%rbp
mov    %rbp,%rdi
call   1060 <sse_atoi@plt>
mov    %rbp,%rdi
call   1060 <sse_atoi@plt>
mov    %rbp,%rdi
call   1060 <sse_atoi@plt>
mov    %rbp,%rdi
call   1060 <sse_atoi@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    14c0 <main+0x2e0>
jmp    14a0 <main+0x2c0>
xor    %eax,%eax
call   1080 <get_time@plt>
subsd  0x8(%rsp),%xmm0
divsd  0xafc(%rip),%xmm0
lea    0xb8b(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x2ab7(%rip),%rax
mov    (%rax),%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb11(%rip),%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2a91(%rip),%rax
jmp    1521 <main+0x341>
lea    0xade(%rip),%rdi
call   10b0 <perror@plt>
mov    0x2a7c(%rip),%rax
jmp    1521 <main+0x341>

LLVM IR (-O0):
@.str = [7 x i8] c"verify\00"
@.str.1 = [5 x i8] c"atoi\00"
@.str.2 = [4 x i8] c"sse\00"
@.str.3 = [30 x i8] c"number must be greater then 0\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [29 x i8] c"count must be greater then 0\00"
@.str.5 = [7 x i8] c"malloc\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [10 x i8] c"verify...\00"
@.str.8 = [40 x i8] c"SSE failed at '%s' => %d, should be %d\0A\00"
@.str.9 = [3 x i8] c"ok\00"
@.str.10 = [33 x i8] c"atoi, %d numbers, %d iterations\0A\00"
@.str.11 = [12 x i8] c"t = %0.3fs\0A\00"
@.str.12 = [32 x i8] c"SSE, %d numbers, %d iterations\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca [32 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = call i32 (...) @usage()
br label %24
24: ; preds = %22, %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strcasecmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %24
store i32 0, i32* %12
br label %49
31: ; preds = %24
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %34)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %31
store i32 1, i32* %12
br label %48
38: ; preds = %31
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i64 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %38
store i32 2, i32* %12
br label %47
45: ; preds = %38
%46 = call i32 (...) @usage()
br label %47
47: ; preds = %45, %44
br label %48
48: ; preds = %47, %37
br label %49
49: ; preds = %48, %30
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 2
%52 = load i8*, i8** %51
%53 = call i32 @atoi(i8* %52)
store i32 %53, i32* %8
%54 = load i32, i32* %8
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %49
%57 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%58 = load i32, i32* @EXIT_FAILURE
store i32 %58, i32* %3
br label %270
59: ; preds = %49
%60 = load i32, i32* %4
%61 = icmp sgt i32 %60, 3
br i1 %61, label %62, label %67
62: ; preds = %59
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 3
%65 = load i8*, i8** %64
%66 = call i32 @atoi(i8* %65)
store i32 %66, i32* %9
br label %68
67: ; preds = %59
store i32 1, i32* %9
br label %68
68: ; preds = %67, %62
%69 = load i32, i32* %8
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %68
%72 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%73 = load i32, i32* @EXIT_FAILURE
store i32 %73, i32* %3
br label %270
74: ; preds = %68
%75 = load i32, i32* %8
%76 = sext i32 %75 to i64
%77 = mul i64 %76, 8
%78 = trunc i64 %77 to i32
%79 = call i8** @malloc(i32 %78)
store i8** %79, i8*** %6
%80 = load i8**, i8*** %6
%81 = icmp eq i8** %80, null
br i1 %81, label %82, label %85
82: ; preds = %74
%83 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%84 = load i32, i32* @EXIT_FAILURE
store i32 %84, i32* %3
br label %270
85: ; preds = %74
store i32 0, i32* %10
br label %86
86: ; preds = %108, %85
%87 = load i32, i32* %10
%88 = load i32, i32* %8
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %111
90: ; preds = %86
%91 = call i32 (...) @rand()
store i32 %91, i32* %13
%92 = call i32 (...) @rand()
%93 = srem i32 %92, 2
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %90
%96 = load i32, i32* %13
%97 = sub nsw i32 0, %96
store i32 %97, i32* %13
br label %98
98: ; preds = %95, %90
%99 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%100 = load i32, i32* %13
%101 = call i32 @sprintf(i8* %99, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %100)
%102 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%103 = call i8* @strdup(i8* %102)
%104 = load i8**, i8*** %6
%105 = load i32, i32* %10
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8*, i8** %104, i64 %106
store i8* %103, i8** %107
br label %108
108: ; preds = %98
%109 = load i32, i32* %10
%110 = add nsw i32 %109, 1
store i32 %110, i32* %10
br label %86
111: ; preds = %86
%112 = load i32, i32* %12
%113 = icmp eq i32 %112, 0
br i1 %113, label %114, label %152
114: ; preds = %111
%115 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %10
br label %116
116: ; preds = %147, %114
%117 = load i32, i32* %10
%118 = load i32, i32* %8
%119 = icmp slt i32 %117, %118
br i1 %119, label %120, label %150
120: ; preds = %116
%121 = load i8**, i8*** %6
%122 = load i32, i32* %10
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i8*, i8** %121, i64 %123
%125 = load i8*, i8** %124
%126 = call i32 @atoi(i8* %125)
store i32 %126, i32* %14
%127 = load i8**, i8*** %6
%128 = load i32, i32* %10
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i8*, i8** %127, i64 %129
%131 = load i8*, i8** %130
%132 = call i32 @sse_atoi(i8* %131)
store i32 %132, i32* %15
%133 = load i32, i32* %14
%134 = load i32, i32* %15
%135 = icmp ne i32 %133, %134
br i1 %135, label %136, label %146
136: ; preds = %120
%137 = load i8**, i8*** %6
%138 = load i32, i32* %10
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds i8*, i8** %137, i64 %139
%141 = load i8*, i8** %140
%142 = load i32, i32* %14
%143 = load i32, i32* %15
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* %141, i32 %142, i32 %143)
%145 = load i32, i32* @EXIT_FAILURE
store i32 %145, i32* %3
br label %270
146: ; preds = %120
br label %147
147: ; preds = %146
%148 = load i32, i32* %10
%149 = add nsw i32 %148, 1
store i32 %149, i32* %10
br label %116
150: ; preds = %116
%151 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %266
152: ; preds = %111
%153 = load i32, i32* %12
%154 = icmp eq i32 %153, 1
br i1 %154, label %155, label %208
155: ; preds = %152
%156 = load i32, i32* %8
%157 = load i32, i32* %9
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), i32 %156, i32 %157)
%159 = call double (...) @get_time()
store double %159, double* %16
store i32 0, i32* %11
br label %160
160: ; preds = %198, %155
%161 = load i32, i32* %11
%162 = load i32, i32* %9
%163 = icmp slt i32 %161, %162
br i1 %163, label %164, label %201
164: ; preds = %160
store i32 0, i32* %10
br label %165
165: ; preds = %194, %164
%166 = load i32, i32* %10
%167 = load i32, i32* %8
%168 = icmp slt i32 %166, %167
br i1 %168, label %169, label %197
169: ; preds = %165
%170 = load i8**, i8*** %6
%171 = load i32, i32* %10
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds i8*, i8** %170, i64 %172
%174 = load i8*, i8** %173
%175 = call i32 @simple_atoi(i8* %174)
%176 = load i8**, i8*** %6
%177 = load i32, i32* %10
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds i8*, i8** %176, i64 %178
%180 = load i8*, i8** %179
%181 = call i32 @simple_atoi(i8* %180)
%182 = load i8**, i8*** %6
%183 = load i32, i32* %10
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds i8*, i8** %182, i64 %184
%186 = load i8*, i8** %185
%187 = call i32 @simple_atoi(i8* %186)
%188 = load i8**, i8*** %6
%189 = load i32, i32* %10
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i8*, i8** %188, i64 %190
%192 = load i8*, i8** %191
%193 = call i32 @simple_atoi(i8* %192)
br label %194
194: ; preds = %169
%195 = load i32, i32* %10
%196 = add nsw i32 %195, 1
store i32 %196, i32* %10
br label %165
197: ; preds = %165
br label %198
198: ; preds = %197
%199 = load i32, i32* %11
%200 = add nsw i32 %199, 1
store i32 %200, i32* %11
br label %160
201: ; preds = %160
%202 = call double (...) @get_time()
store double %202, double* %17
%203 = load double, double* %17
%204 = load double, double* %16
%205 = fsub double %203, %204
%206 = fdiv double %205, 1.000000e+06
%207 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), double %206)
br label %265
208: ; preds = %152
%209 = load i32, i32* %12
%210 = icmp eq i32 %209, 2
br i1 %210, label %211, label %264
211: ; preds = %208
%212 = load i32, i32* %8
%213 = load i32, i32* %9
%214 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i32 %212, i32 %213)
%215 = call double (...) @get_time()
store double %215, double* %18
store i32 0, i32* %11
br label %216
216: ; preds = %254, %211
%217 = load i32, i32* %11
%218 = load i32, i32* %9
%219 = icmp slt i32 %217, %218
br i1 %219, label %220, label %257
220: ; preds = %216
store i32 0, i32* %10
br label %221
221: ; preds = %250, %220
%222 = load i32, i32* %10
%223 = load i32, i32* %8
%224 = icmp slt i32 %222, %223
br i1 %224, label %225, label %253
225: ; preds = %221
%226 = load i8**, i8*** %6
%227 = load i32, i32* %10
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds i8*, i8** %226, i64 %228
%230 = load i8*, i8** %229
%231 = call i32 @sse_atoi(i8* %230)
%232 = load i8**, i8*** %6
%233 = load i32, i32* %10
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds i8*, i8** %232, i64 %234
%236 = load i8*, i8** %235
%237 = call i32 @sse_atoi(i8* %236)
%238 = load i8**, i8*** %6
%239 = load i32, i32* %10
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds i8*, i8** %238, i64 %240
%242 = load i8*, i8** %241
%243 = call i32 @sse_atoi(i8* %242)
%244 = load i8**, i8*** %6
%245 = load i32, i32* %10
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds i8*, i8** %244, i64 %246
%248 = load i8*, i8** %247
%249 = call i32 @sse_atoi(i8* %248)
br label %250
250: ; preds = %225
%251 = load i32, i32* %10
%252 = add nsw i32 %251, 1
store i32 %252, i32* %10
br label %221
253: ; preds = %221
br label %254
254: ; preds = %253
%255 = load i32, i32* %11
%256 = add nsw i32 %255, 1
store i32 %256, i32* %11
br label %216
257: ; preds = %216
%258 = call double (...) @get_time()
store double %258, double* %19
%259 = load double, double* %19
%260 = load double, double* %18
%261 = fsub double %259, %260
%262 = fdiv double %261, 1.000000e+06
%263 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), double %262)
br label %264
264: ; preds = %257, %208
br label %265
265: ; preds = %264, %201
br label %266
266: ; preds = %265, %150
%267 = load i8**, i8*** %6
%268 = call i32 @free(i8** %267)
%269 = load i32, i32* @EXIT_SUCCESS
store i32 %269, i32* %3
br label %270
270: ; preds = %266, %136, %82, %71, %56
%271 = load i32, i32* %3
ret i32 %271
}

LLVM IR (-O2):
@.str = [7 x i8] c"verify\00"
@.str.1 = [5 x i8] c"atoi\00"
@.str.2 = [4 x i8] c"sse\00"
@.str.3 = [30 x i8] c"number must be greater then 0\00"
@EXIT_FAILURE = global i32 0
@.str.5 = [7 x i8] c"malloc\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [10 x i8] c"verify...\00"
@.str.8 = [40 x i8] c"SSE failed at '%s' => %d, should be %d\0A\00"
@.str.9 = [3 x i8] c"ok\00"
@.str.10 = [33 x i8] c"atoi, %d numbers, %d iterations\0A\00"
@.str.11 = [12 x i8] c"t = %0.3fs\0A\00"
@.str.12 = [32 x i8] c"SSE, %d numbers, %d iterations\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (...) @usage()
br label %8
8: ; preds = %6, %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %8
%14 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%15 = icmp eq i64 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %13
%17 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 (...) @usage()
br label %21
21: ; preds = %16, %13, %8, %19
%22 = phi i1 [ undef, %19 ], [ true, %8 ], [ false, %13 ], [ false, %16 ]
%23 = phi i1 [ undef, %19 ], [ false, %8 ], [ true, %13 ], [ false, %16 ]
%24 = phi i1 [ undef, %19 ], [ false, %8 ], [ false, %13 ], [ true, %16 ]
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = tail call i32 @atoi(i8* %26)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %21
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %139
31: ; preds = %21
%32 = icmp sgt i32 %0, 3
br i1 %32, label %33, label %37
33: ; preds = %31
%34 = getelementptr inbounds i8*, i8** %1, i64 3
%35 = load i8*, i8** %34
%36 = tail call i32 @atoi(i8* %35)
br label %37
37: ; preds = %33, %31
%38 = phi i32 [ %36, %33 ], [ 1, %31 ]
%39 = shl i32 %27, 3
%40 = tail call i8** @malloc(i32 %39)
%41 = icmp eq i8** %40, null
br i1 %41, label %46, label %42
42: ; preds = %37
%43 = icmp sgt i32 %27, 0
br i1 %43, label %44, label %62
44: ; preds = %42
%45 = zext i32 %27 to i64
br label %48
46: ; preds = %37
%47 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %139
48: ; preds = %44, %48
%49 = phi i64 [ 0, %44 ], [ %59, %48 ]
%50 = tail call i32 (...) @rand()
%51 = tail call i32 (...) @rand()
%52 = and i32 %51, 1
%53 = icmp eq i32 %52, 0
%54 = sub nsw i32 0, %50
%55 = select i1 %53, i32 %50, i32 %54
%56 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %55)
%57 = call i8* @strdup(i8* %4)
%58 = getelementptr inbounds i8*, i8** %40, i64 %49
store i8* %57, i8** %58
%59 = add nuw nsw i64 %49, 1
%60 = icmp eq i64 %59, %45
br i1 %60, label %61, label %48
61: ; preds = %48
br i1 %22, label %65, label %83
62: ; preds = %42
br i1 %22, label %63, label %83
63: ; preds = %62
%64 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br label %81
65: ; preds = %61
%66 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br i1 %43, label %67, label %81
67: ; preds = %65
%68 = zext i32 %27 to i64
br label %71
69: ; preds = %71
%70 = icmp eq i64 %78, %68
br i1 %70, label %81, label %71
71: ; preds = %67, %69
%72 = phi i64 [ 0, %67 ], [ %78, %69 ]
%73 = getelementptr inbounds i8*, i8** %40, i64 %72
%74 = load i8*, i8** %73
%75 = tail call i32 @atoi(i8* %74)
%76 = tail call i32 @sse_atoi(i8* %74)
%77 = icmp eq i32 %75, %76
%78 = add nuw nsw i64 %72, 1
br i1 %77, label %69, label %79
79: ; preds = %71
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* %74, i32 %75, i32 %76)
br label %139
81: ; preds = %69, %63, %65
%82 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %137
83: ; preds = %62, %61
br i1 %23, label %84, label %110
84: ; preds = %83
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), i32 %27, i32 %38)
%86 = tail call double (...) @get_time()
%87 = icmp sgt i32 %38, 0
br i1 %87, label %88, label %105
88: ; preds = %84
%89 = zext i32 %27 to i64
br label %90
90: ; preds = %88, %102
%91 = phi i32 [ 0, %88 ], [ %103, %102 ]
br i1 %43, label %92, label %102
92: ; preds = %90, %92
%93 = phi i64 [ %100, %92 ], [ 0, %90 ]
%94 = getelementptr inbounds i8*, i8** %40, i64 %93
%95 = load i8*, i8** %94
%96 = tail call i32 @simple_atoi(i8* %95)
%97 = tail call i32 @simple_atoi(i8* %95)
%98 = tail call i32 @simple_atoi(i8* %95)
%99 = tail call i32 @simple_atoi(i8* %95)
%100 = add nuw nsw i64 %93, 1
%101 = icmp eq i64 %100, %89
br i1 %101, label %102, label %92
102: ; preds = %92, %90
%103 = add nuw nsw i32 %91, 1
%104 = icmp eq i32 %103, %38
br i1 %104, label %105, label %90
105: ; preds = %102, %84
%106 = tail call double (...) @get_time()
%107 = fsub double %106, %86
%108 = fdiv double %107, 1.000000e+06
%109 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), double %108)
br label %137
110: ; preds = %83
br i1 %24, label %111, label %137
111: ; preds = %110
%112 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i32 %27, i32 %38)
%113 = tail call double (...) @get_time()
%114 = icmp sgt i32 %38, 0
br i1 %114, label %115, label %132
115: ; preds = %111
%116 = zext i32 %27 to i64
br label %117
117: ; preds = %115, %129
%118 = phi i32 [ 0, %115 ], [ %130, %129 ]
br i1 %43, label %119, label %129
119: ; preds = %117, %119
%120 = phi i64 [ %127, %119 ], [ 0, %117 ]
%121 = getelementptr inbounds i8*, i8** %40, i64 %120
%122 = load i8*, i8** %121
%123 = tail call i32 @sse_atoi(i8* %122)
%124 = tail call i32 @sse_atoi(i8* %122)
%125 = tail call i32 @sse_atoi(i8* %122)
%126 = tail call i32 @sse_atoi(i8* %122)
%127 = add nuw nsw i64 %120, 1
%128 = icmp eq i64 %127, %116
br i1 %128, label %129, label %119
129: ; preds = %119, %117
%130 = add nuw nsw i32 %118, 1
%131 = icmp eq i32 %130, %38
br i1 %131, label %132, label %117
132: ; preds = %129, %111
%133 = tail call double (...) @get_time()
%134 = fsub double %133, %113
%135 = fdiv double %134, 1.000000e+06
%136 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), double %135)
br label %137
137: ; preds = %105, %132, %110, %81
%138 = tail call i32 @free(i8** %40)
br label %139
139: ; preds = %79, %137, %46, %29
%140 = phi i32* [ @EXIT_FAILURE, %29 ], [ @EXIT_FAILURE, %46 ], [ @EXIT_FAILURE, %79 ], [ @EXIT_SUCCESS, %137 ]
%141 = load i32, i32* %140
ret i32 %141
}