#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 */

/* Variables and functions */
char getopt(int, char **, char *);
scalar_t__ optind;
long strtol(char *, char **, int);
int /*<<< orphan*/ test_aes_encrypt(long, int);
int main(int argc, char **argv) {
  long blocks;
  char *nptr;
  char ch;
  int bench;
  bench = 0;
  blocks = 10;
  while ((ch = getopt(argc, argv, "b")) != -1) {
    switch (ch) {
    case 'b':
      bench = 1;
      break;
    }
  }
  argc -= optind;
  argv += optind;
  if (argc >= 1) {
    long b = strtol(argv[0], &nptr, 10);
    if (argv[1] != nptr) {
      blocks = b;
    }
  }
  if (blocks > 0) {
    test_aes_encrypt(blocks, bench);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
movq   $0xa,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe9d(%rip),%rdx
call   1050 <getopt@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     1193 <main+0x63>
mov    -0x21(%rbp),%al
sub    $0x62,%al
jne    118e <main+0x5e>
jmp    1187 <main+0x57>
movl   $0x1,-0x28(%rbp)
jmp    1155 <main+0x25>
mov    0x2e4e(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2e3a(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     11ff <main+0xcf>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
cmp    -0x20(%rbp),%rax
je     11fa <main+0xca>
mov    -0x30(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    11ff <main+0xcf>
cmpq   $0x0,-0x18(%rbp)
jle    1216 <main+0xe6>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1030 <test_aes_encrypt@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r14d,%r14d
lea    0xeb5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <getopt@plt>
cmp    $0x62,%al
je     1167 <main+0x37>
cmp    $0xff,%al
jne    1150 <main+0x20>
jmp    116f <main+0x3f>
mov    $0x1,%r14d
jmp    1150 <main+0x20>
mov    0x2e72(%rip),%rax
mov    (%rax),%r12
sub    %r12d,%ebp
mov    $0xa,%r15d
test   %ebp,%ebp
jle    11ad <main+0x7d>
mov    (%rbx,%r12,8),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    0x8(%rbx,%r12,8),%rcx
cmp    0x8(%rsp),%rcx
je     11ad <main+0x7d>
mov    %rax,%r15
test   %rax,%rax
jle    11b8 <main+0x88>
mov    %r15,%rdi
mov    %r14d,%esi
call   1030 <test_aes_encrypt@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"b\00"
@optind = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8
%9 = alloca i32
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i64 10, i64* %6
br label %11
11: ; preds = %21, %2
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call signext i8 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8 %14, i8* %8
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %22
17: ; preds = %11
%18 = load i8, i8* %8
%19 = sext i8 %18 to i32
switch i32 %19, label %21 [
i32 98, label %20
]
20: ; preds = %17
store i32 1, i32* %9
br label %21
21: ; preds = %17, %20
br label %11
22: ; preds = %11
%23 = load i64, i64* @optind
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = sub nsw i64 %25, %23
%27 = trunc i64 %26 to i32
store i32 %27, i32* %4
%28 = load i64, i64* @optind
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 %28
store i8** %30, i8*** %5
%31 = load i32, i32* %4
%32 = icmp sge i32 %31, 1
br i1 %32, label %33, label %46
33: ; preds = %22
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i64 @strtol(i8* %36, i8** %7, i32 10)
store i64 %37, i64* %10
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = load i8*, i8** %7
%42 = icmp ne i8* %40, %41
br i1 %42, label %43, label %45
43: ; preds = %33
%44 = load i64, i64* %10
store i64 %44, i64* %6
br label %45
45: ; preds = %43, %33
br label %46
46: ; preds = %45, %22
%47 = load i64, i64* %6
%48 = icmp sgt i64 %47, 0
br i1 %48, label %49, label %53
49: ; preds = %46
%50 = load i64, i64* %6
%51 = load i32, i32* %9
%52 = call i32 @test_aes_encrypt(i64 %50, i32 %51)
br label %53
53: ; preds = %49, %46
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"b\00"
@optind = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
br label %5
5: ; preds = %7, %2
%6 = phi i32 [ 0, %2 ], [ 1, %7 ]
br label %7
7: ; preds = %5, %7
%8 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i8 %8, label %7 [
i8 -1, label %9
i8 98, label %5
]
9: ; preds = %7
%10 = load i64, i64* @optind
%11 = trunc i64 %10 to i32
%12 = sub i32 %0, %11
%13 = getelementptr inbounds i8*, i8** %1, i64 %10
%14 = icmp sgt i32 %12, 0
br i1 %14, label %15, label %24
15: ; preds = %9
%16 = load i8*, i8** %13
%17 = call i64 @strtol(i8* %16, i8** %3, i32 10)
%18 = getelementptr inbounds i8*, i8** %13, i64 1
%19 = load i8*, i8** %18
%20 = load i8*, i8** %3
%21 = icmp eq i8* %19, %20
br i1 %21, label %24, label %22
22: ; preds = %15
%23 = icmp sgt i64 %17, 0
br i1 %23, label %24, label %27
24: ; preds = %15, %9, %22
%25 = phi i64 [ %17, %22 ], [ 10, %9 ], [ 10, %15 ]
%26 = tail call i32 @test_aes_encrypt(i64 %25, i32 %6)
br label %27
27: ; preds = %24, %22
ret i32 0
}