#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 scalar_t__ time_t;
struct timeval {
  scalar_t__ tv_sec;
  scalar_t__ tv_usec;
};
struct sched_param {
  int /*<<< orphan*/ sched_priority;
};

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int MCL_CURRENT;
int MCL_FUTURE;
int /*<<< orphan*/ SCHED_FIFO;
int /*<<< orphan*/ ShowHelp();
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
scalar_t__ getuid();
scalar_t__ *malloc(int);
int mlockall(int);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sched_get_priority_min(int /*<<< orphan*/);
int sched_setscheduler(int /*<<< orphan*/, int /*<<< orphan*/,
                       struct sched_param *);
int sscanf(int /*<<< orphan*/, char *, int *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  struct sched_param sched;
  int i, c;
  int nsamples = 1000000;
  int usegettimeofday = 1;
  time_t *sec;
  time_t *usec;
  struct timeval todsample;
  while ((c = getopt(argc, argv, "ghn:v")) != -1) {
    switch (c) {
    case 'g':
      usegettimeofday = 1;
      break;
    case 'h':
      ShowHelp();
      return EXIT_SUCCESS;
      break;
    case 'n':
      if (optarg) {
        if (1 == sscanf(optarg, "%i", &nsamples)) {
          if (nsamples < 0) {
            fprintf(stderr, "Error in argument to option -n\n");
            return 0;
          }
        } else {
          fprintf(stderr, "Error in argument to option -o\n");
          return EXIT_FAILURE;
        }
      }
      break;
    case 'v':
      printf("%s version %s\n", "bmsystime", "0.1");
      printf("This ain't no stinkin' Perl script!\n");
      return EXIT_SUCCESS;
      break;
    }
  }
  if (getuid()) {
    fprintf(stderr, "Error! Must be run as root\n");
    exit(EXIT_FAILURE);
  }
  sec = malloc(nsamples * sizeof(time_t));
  if (1 == usegettimeofday) {
    usec = malloc(nsamples * sizeof(time_t));
    fprintf(stderr, "Using gettimeofday()\n");
  } else {
  }
  sched.sched_priority = sched_get_priority_min(SCHED_FIFO);
  if (sched_setscheduler(0, SCHED_FIFO, &sched) == -1) {
    fprintf(stderr, "Exiting: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if (mlockall(MCL_FUTURE | MCL_CURRENT) == -1) {
    fprintf(stderr, "Exiting: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  for (i = 0; i < nsamples; ++i) {
    if (1 == usegettimeofday) {
      gettimeofday(&todsample, NULL);
      usec[i] = todsample.tv_usec;
      sec[i] = todsample.tv_sec;
    } else {
    }
  }
  for (i = 0; i < nsamples; ++i) {
    if (usegettimeofday == 1) {
      printf("%d %d\n", (int)sec[i], (int)usec[i]);
    } else {
    }
  }
  return EXIT_SUCCESS;
}


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)
movl   $0xf4240,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe3e(%rip),%rdx
call   10d0 <getopt@plt>
mov    %eax,-0x20(%rbp)
cmp    $0xffffffff,%eax
je     133c <main+0x16c>
mov    -0x20(%rbp),%eax
add    $0xffffff99,%eax
mov    %eax,%ecx
mov    %rcx,-0x50(%rbp)
sub    $0xf,%eax
ja     1337 <main+0x167>
mov    -0x50(%rbp),%rax
lea    0xdcd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x28(%rbp)
jmp    1337 <main+0x167>
mov    $0x0,%al
call   1030 <ShowHelp@plt>
mov    0x2d52(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1568 <main+0x398>
mov    0x2d91(%rip),%rax
cmpl   $0x0,(%rax)
je     12f7 <main+0x127>
mov    0x2d81(%rip),%rax
mov    (%rax),%edi
lea    0xdc6(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   10b0 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    12ca <main+0xfa>
cmpl   $0x0,-0x24(%rbp)
jge    12c5 <main+0xf5>
mov    0x2d1f(%rip),%rax
mov    (%rax),%edi
lea    0xd97(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1568 <main+0x398>
jmp    12f2 <main+0x122>
mov    0x2cf7(%rip),%rax
mov    (%rax),%edi
lea    0xd8f(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2cc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1568 <main+0x398>
jmp    12f7 <main+0x127>
jmp    1337 <main+0x167>
lea    0xd86(%rip),%rdi
lea    0xd8e(%rip),%rsi
lea    0xd91(%rip),%rdx
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1568 <main+0x398>
jmp    11f4 <main+0x24>
mov    $0x0,%al
call   1040 <getuid@plt>
cmp    $0x0,%rax
je     1372 <main+0x1a2>
mov    0x2c74(%rip),%rax
mov    (%rax),%edi
lea    0xd6e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2c45(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x1,%eax
cmp    -0x28(%rbp),%eax
jne    13c2 <main+0x1f2>
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    0x2c1b(%rip),%rax
mov    (%rax),%edi
lea    0xd31(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    13c7 <main+0x1f7>
jmp    13c7 <main+0x1f7>
mov    0x2c0a(%rip),%rax
mov    (%rax),%edi
call   10a0 <sched_get_priority_min@plt>
mov    %eax,-0x18(%rbp)
mov    0x2bf9(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x18(%rbp),%rdx
call   1070 <sched_setscheduler@plt>
cmp    $0xffffffff,%eax
jne    1431 <main+0x261>
mov    0x2bcc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    0x2bb8(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x54(%rbp),%edi
mov    %rax,%rdx
lea    0xce1(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2b86(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    0x2bb0(%rip),%rax
mov    (%rax),%edi
mov    0x2b77(%rip),%rax
or     (%rax),%edi
call   10c0 <mlockall@plt>
cmp    $0xffffffff,%eax
jne    148d <main+0x2bd>
mov    0x2b70(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x2b5c(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x58(%rbp),%edi
mov    %rax,%rdx
lea    0xc85(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2b2a(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    14f8 <main+0x328>
mov    $0x1,%eax
cmp    -0x28(%rbp),%eax
jne    14e0 <main+0x310>
lea    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x48(%rbp),%rdx
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    14e5 <main+0x315>
jmp    14e5 <main+0x315>
jmp    14ea <main+0x31a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1494 <main+0x2c4>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    155c <main+0x38c>
cmpl   $0x1,-0x28(%rbp)
jne    1544 <main+0x374>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%esi
mov    -0x38(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%edx
lea    0xbd2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1549 <main+0x379>
jmp    1549 <main+0x379>
jmp    154e <main+0x37e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    14ff <main+0x32f>
mov    0x2a45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%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    $0x28,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0xf4240,0xc(%rsp)
lea    0xdfe(%rip),%r14
mov    0x2def(%rip),%r13
lea    0xdf6(%rip),%r15
lea    0xc(%rsp),%r12
jmp    1225 <main+0x45>
nopw   0x0(%rax,%rax,1)
cmp    $0x76,%eax
je     1286 <main+0xa6>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10e0 <getopt@plt>
cmp    $0x6d,%eax
jle    1270 <main+0x90>
cmp    $0x6e,%eax
jne    1220 <main+0x40>
mov    0x0(%r13),%edi
test   %edi,%edi
je     1225 <main+0x45>
mov    %r15,%rsi
mov    %r12,%rdx
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    13c9 <main+0x1e9>
cmpl   $0x0,0xc(%rsp)
jns    1225 <main+0x45>
jmp    13e9 <main+0x209>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0xffffffff,%eax
je     12b3 <main+0xd3>
cmp    $0x68,%eax
jne    1225 <main+0x45>
xor    %eax,%eax
call   1040 <ShowHelp@plt>
jmp    13af <main+0x1cf>
lea    0xdbc(%rip),%rdi
lea    0xdc4(%rip),%rsi
lea    0xdc7(%rip),%rdx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe03(%rip),%rdi
call   1030 <puts@plt>
jmp    13af <main+0x1cf>
xor    %eax,%eax
call   1050 <getuid@plt>
test   %rax,%rax
jne    142a <main+0x24a>
mov    0xc(%rsp),%ebx
shl    $0x3,%ebx
mov    %ebx,%edi
call   10a0 <malloc@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    0x2ce3(%rip),%r15
mov    (%r15),%edi
lea    0xd93(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2cdb(%rip),%rbp
mov    0x0(%rbp),%edi
call   10b0 <sched_get_priority_min@plt>
mov    %eax,0x10(%rsp)
mov    0x0(%rbp),%esi
lea    0x10(%rsp),%rdx
xor    %edi,%edi
call   1080 <sched_setscheduler@plt>
cmp    $0xffffffff,%eax
je     1404 <main+0x224>
mov    0x2cc0(%rip),%rax
mov    0x2c89(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   10d0 <mlockall@plt>
cmp    $0xffffffff,%eax
je     1404 <main+0x224>
cmpl   $0x0,0xc(%rsp)
jle    13af <main+0x1cf>
xor    %ebp,%ebp
lea    0x18(%rsp),%r15
nop
mov    %r15,%rdi
xor    %esi,%esi
call   1070 <gettimeofday@plt>
mov    0x20(%rsp),%rax
mov    %rax,(%rbx,%rbp,8)
mov    0x18(%rsp),%rax
mov    %rax,(%r14,%rbp,8)
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jl     1350 <main+0x170>
test   %eax,%eax
jle    13af <main+0x1cf>
lea    0xd20(%rip),%r15
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbp,8),%esi
mov    (%rbx,%rbp,8),%edx
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jl     1390 <main+0x1b0>
mov    0x2bf2(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bf8(%rip),%rax
mov    (%rax),%edi
lea    0xc50(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2bc9(%rip),%rax
jmp    13b6 <main+0x1d6>
mov    0x2bd8(%rip),%rax
mov    (%rax),%edi
lea    0xc10(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    13b8 <main+0x1d8>
mov    (%r15),%ebx
mov    0x2bb2(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
lea    0xc7c(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1441 <main+0x261>
mov    0x2b97(%rip),%rax
mov    (%rax),%edi
lea    0xc2c(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2b68(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.sched_param = type { i32 }
%struct.timeval = type { i64, i64 }
@.str = [6 x i8] c"ghn:v\00"
@EXIT_SUCCESS = global i32 0
@optarg = global i32 0
@.str.1 = [3 x i8] c"%i\00"
@stderr = global i32 0
@.str.2 = [32 x i8] c"Error in argument to option -n\0A\00"
@.str.3 = [32 x i8] c"Error in argument to option -o\0A\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [15 x i8] c"%s version %s\0A\00"
@.str.5 = [10 x i8] c"bmsystime\00"
@.str.6 = [4 x i8] c"0.1\00"
@.str.7 = [37 x i8] c"This ain't no stinkin' Perl script!\0A\00"
@.str.8 = [28 x i8] c"Error! Must be run as root\0A\00"
@.str.9 = [22 x i8] c"Using gettimeofday()\0A\00"
@SCHED_FIFO = global i32 0
@.str.10 = [13 x i8] c"Exiting: %s\0A\00"
@errno = global i32 0
@MCL_FUTURE = global i32 0
@MCL_CURRENT = global i32 0
@.str.11 = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sched_param
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64*
%12 = alloca i64*
%13 = alloca %struct.timeval
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1000000, i32* %9
store i32 1, i32* %10
br label %14
14: ; preds = %49, %2
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i32 @getopt(i32 %15, i8** %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %17, i32* %8
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %50
19: ; preds = %14
%20 = load i32, i32* %8
switch i32 %20, label %49 [
i32 103, label %21
i32 104, label %22
i32 110, label %25
i32 118, label %45
]
21: ; preds = %19
store i32 1, i32* %10
br label %49
22: ; preds = %19
%23 = call i32 (...) @ShowHelp()
%24 = load i32, i32* @EXIT_SUCCESS
store i32 %24, i32* %3
br label %158
25: ; preds = %19
%26 = load i32, i32* @optarg
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %44
28: ; preds = %25
%29 = load i32, i32* @optarg
%30 = call i32 @sscanf(i32 %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%31 = icmp eq i32 1, %30
br i1 %31, label %32, label %39
32: ; preds = %28
%33 = load i32, i32* %9
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* @stderr
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %158
38: ; preds = %32
br label %43
39: ; preds = %28
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%42 = load i32, i32* @EXIT_FAILURE
store i32 %42, i32* %3
br label %158
43: ; preds = %38
br label %44
44: ; preds = %43, %25
br label %49
45: ; preds = %19
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0))
%48 = load i32, i32* @EXIT_SUCCESS
store i32 %48, i32* %3
br label %158
49: ; preds = %19, %44, %21
br label %14
50: ; preds = %14
%51 = call i64 (...) @getuid()
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %58
53: ; preds = %50
%54 = load i32, i32* @stderr
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%56 = load i32, i32* @EXIT_FAILURE
%57 = call i32 @exit(i32 %56)
unreachable
58: ; preds = %50
%59 = load i32, i32* %9
%60 = sext i32 %59 to i64
%61 = mul i64 %60, 8
%62 = trunc i64 %61 to i32
%63 = call i64* @malloc(i32 %62)
store i64* %63, i64** %11
%64 = load i32, i32* %10
%65 = icmp eq i32 1, %64
br i1 %65, label %66, label %74
66: ; preds = %58
%67 = load i32, i32* %9
%68 = sext i32 %67 to i64
%69 = mul i64 %68, 8
%70 = trunc i64 %69 to i32
%71 = call i64* @malloc(i32 %70)
store i64* %71, i64** %12
%72 = load i32, i32* @stderr
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
br label %75
74: ; preds = %58
br label %75
75: ; preds = %74, %66
%76 = load i32, i32* @SCHED_FIFO
%77 = call i32 @sched_get_priority_min(i32 %76)
%78 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %6, i32 0, i32 0
store i32 %77, i32* %78
%79 = load i32, i32* @SCHED_FIFO
%80 = call i32 @sched_setscheduler(i32 0, i32 %79, %struct.sched_param* %6)
%81 = icmp eq i32 %80, -1
br i1 %81, label %82, label %89
82: ; preds = %75
%83 = load i32, i32* @stderr
%84 = load i32, i32* @errno
%85 = call i8* @strerror(i32 %84)
%86 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8* %85)
%87 = load i32, i32* @EXIT_FAILURE
%88 = call i32 @exit(i32 %87)
unreachable
89: ; preds = %75
%90 = load i32, i32* @MCL_FUTURE
%91 = load i32, i32* @MCL_CURRENT
%92 = or i32 %90, %91
%93 = call i32 @mlockall(i32 %92)
%94 = icmp eq i32 %93, -1
br i1 %94, label %95, label %102
95: ; preds = %89
%96 = load i32, i32* @stderr
%97 = load i32, i32* @errno
%98 = call i8* @strerror(i32 %97)
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8* %98)
%100 = load i32, i32* @EXIT_FAILURE
%101 = call i32 @exit(i32 %100)
unreachable
102: ; preds = %89
store i32 0, i32* %7
br label %103
103: ; preds = %126, %102
%104 = load i32, i32* %7
%105 = load i32, i32* %9
%106 = icmp slt i32 %104, %105
br i1 %106, label %107, label %129
107: ; preds = %103
%108 = load i32, i32* %10
%109 = icmp eq i32 1, %108
br i1 %109, label %110, label %124
110: ; preds = %107
%111 = call i32 @gettimeofday(%struct.timeval* %13, i32* null)
%112 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%113 = load i64, i64* %112
%114 = load i64*, i64** %12
%115 = load i32, i32* %7
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i64, i64* %114, i64 %116
store i64 %113, i64* %117
%118 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
%119 = load i64, i64* %118
%120 = load i64*, i64** %11
%121 = load i32, i32* %7
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i64, i64* %120, i64 %122
store i64 %119, i64* %123
br label %125
124: ; preds = %107
br label %125
125: ; preds = %124, %110
br label %126
126: ; preds = %125
%127 = load i32, i32* %7
%128 = add nsw i32 %127, 1
store i32 %128, i32* %7
br label %103
129: ; preds = %103
store i32 0, i32* %7
br label %130
130: ; preds = %153, %129
%131 = load i32, i32* %7
%132 = load i32, i32* %9
%133 = icmp slt i32 %131, %132
br i1 %133, label %134, label %156
134: ; preds = %130
%135 = load i32, i32* %10
%136 = icmp eq i32 %135, 1
br i1 %136, label %137, label %151
137: ; preds = %134
%138 = load i64*, i64** %11
%139 = load i32, i32* %7
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i64, i64* %138, i64 %140
%142 = load i64, i64* %141
%143 = trunc i64 %142 to i32
%144 = load i64*, i64** %12
%145 = load i32, i32* %7
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i64, i64* %144, i64 %146
%148 = load i64, i64* %147
%149 = trunc i64 %148 to i32
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 %143, i32 %149)
br label %152
151: ; preds = %134
br label %152
152: ; preds = %151, %137
br label %153
153: ; preds = %152
%154 = load i32, i32* %7
%155 = add nsw i32 %154, 1
store i32 %155, i32* %7
br label %130
156: ; preds = %130
%157 = load i32, i32* @EXIT_SUCCESS
store i32 %157, i32* %3
br label %158
158: ; preds = %156, %45, %39, %35, %22
%159 = load i32, i32* %3
ret i32 %159
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
%struct.timeval = type { i64, i64 }
@.str = [6 x i8] c"ghn:v\00"
@EXIT_SUCCESS = global i32 0
@optarg = global i32 0
@.str.1 = [3 x i8] c"%i\00"
@stderr = global i32 0
@.str.2 = [32 x i8] c"Error in argument to option -n\0A\00"
@.str.3 = [32 x i8] c"Error in argument to option -o\0A\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [15 x i8] c"%s version %s\0A\00"
@.str.5 = [10 x i8] c"bmsystime\00"
@.str.6 = [4 x i8] c"0.1\00"
@.str.8 = [28 x i8] c"Error! Must be run as root\0A\00"
@.str.9 = [22 x i8] c"Using gettimeofday()\0A\00"
@SCHED_FIFO = global i32 0
@.str.10 = [13 x i8] c"Exiting: %s\0A\00"
@errno = global i32 0
@MCL_FUTURE = global i32 0
@MCL_CURRENT = global i32 0
@.str.11 = [7 x i8] c"%d %d\0A\00"
@str = [36 x i8] c"This ain't no stinkin' Perl script!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.sched_param
%4 = alloca i32
%5 = alloca %struct.timeval
%6 = bitcast %struct.sched_param* %3 to i8*
%7 = bitcast i32* %4 to i8*
store i32 1000000, i32* %4
%8 = bitcast %struct.timeval* %5 to i8*
br label %9
9: ; preds = %11, %2
%10 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %10, label %11 [
i32 -1, label %35
i32 118, label %31
i32 104, label %12
i32 110, label %15
]
11: ; preds = %9, %15, %21
br label %9
12: ; preds = %9
%13 = call i32 (...) @ShowHelp()
%14 = load i32, i32* @EXIT_SUCCESS
br label %110
15: ; preds = %9
%16 = load i32, i32* @optarg
%17 = icmp eq i32 %16, 0
br i1 %17, label %11, label %18
18: ; preds = %15
%19 = call i32 @sscanf(i32 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %11
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %110
27: ; preds = %18
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
br label %110
31: ; preds = %9
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%34 = load i32, i32* @EXIT_SUCCESS
br label %110
35: ; preds = %9
%36 = call i64 (...) @getuid()
%37 = icmp eq i64 %36, 0
br i1 %37, label %43, label %38
38: ; preds = %35
%39 = load i32, i32* @stderr
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%41 = load i32, i32* @EXIT_FAILURE
%42 = call i32 @exit(i32 %41)
unreachable
43: ; preds = %35
%44 = load i32, i32* %4
%45 = shl i32 %44, 3
%46 = call i64* @malloc(i32 %45)
%47 = call i64* @malloc(i32 %45)
%48 = load i32, i32* @stderr
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%50 = load i32, i32* @SCHED_FIFO
%51 = call i32 @sched_get_priority_min(i32 %50)
%52 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %3, i64 0, i32 0
store i32 %51, i32* %52
%53 = load i32, i32* @SCHED_FIFO
%54 = call i32 @sched_setscheduler(i32 0, i32 %53, %struct.sched_param* %3)
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %63
56: ; preds = %43
%57 = load i32, i32* @stderr
%58 = load i32, i32* @errno
%59 = call i8* @strerror(i32 %58)
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8* %59)
%61 = load i32, i32* @EXIT_FAILURE
%62 = call i32 @exit(i32 %61)
unreachable
63: ; preds = %43
%64 = load i32, i32* @MCL_FUTURE
%65 = load i32, i32* @MCL_CURRENT
%66 = or i32 %65, %64
%67 = call i32 @mlockall(i32 %66)
%68 = icmp eq i32 %67, -1
br i1 %68, label %75, label %69
69: ; preds = %63
%70 = load i32, i32* %4
%71 = icmp sgt i32 %70, 0
br i1 %71, label %72, label %108
72: ; preds = %69
%73 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%74 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
br label %84
75: ; preds = %63
%76 = load i32, i32* @stderr
%77 = load i32, i32* @errno
%78 = call i8* @strerror(i32 %77)
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8* %78)
%80 = load i32, i32* @EXIT_FAILURE
%81 = call i32 @exit(i32 %80)
unreachable
82: ; preds = %84
%83 = icmp sgt i32 %92, 0
br i1 %83, label %95, label %108
84: ; preds = %72, %84
%85 = phi i64 [ 0, %72 ], [ %91, %84 ]
%86 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%87 = load i64, i64* %73
%88 = getelementptr inbounds i64, i64* %47, i64 %85
store i64 %87, i64* %88
%89 = load i64, i64* %74
%90 = getelementptr inbounds i64, i64* %46, i64 %85
store i64 %89, i64* %90
%91 = add nuw nsw i64 %85, 1
%92 = load i32, i32* %4
%93 = sext i32 %92 to i64
%94 = icmp slt i64 %91, %93
br i1 %94, label %84, label %82
95: ; preds = %82, %95
%96 = phi i64 [ %104, %95 ], [ 0, %82 ]
%97 = getelementptr inbounds i64, i64* %46, i64 %96
%98 = load i64, i64* %97
%99 = trunc i64 %98 to i32
%100 = getelementptr inbounds i64, i64* %47, i64 %96
%101 = load i64, i64* %100
%102 = trunc i64 %101 to i32
%103 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 %99, i32 %102)
%104 = add nuw nsw i64 %96, 1
%105 = load i32, i32* %4
%106 = sext i32 %105 to i64
%107 = icmp slt i64 %104, %106
br i1 %107, label %95, label %108
108: ; preds = %95, %69, %82
%109 = load i32, i32* @EXIT_SUCCESS
br label %110
110: ; preds = %108, %31, %27, %24, %12
%111 = phi i32 [ %34, %31 ], [ 0, %24 ], [ %30, %27 ], [ %14, %12 ], [ %109, %108 ]
ret i32 %111
}