#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 */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ memset(char *, char, size_t const);
int strncasecmp(char *, char *, size_t const);
int main(int argc, char **argv) {
  assert(argc >= 2);
  const size_t size = 100;
  char fill = 'o';
  char s1[size];
  char s2[size];
  memset(s1, fill, size);
  memset(s2, fill, size);
  switch (argv[1][0]) {
  case 'a':
    s1[size - 1] = 'z';
    s2[size - 1] = 'x';
    for (int i = 0; i <= size; ++i)
      assert((strncasecmp(s1, s2, i) == 0) == (i < size));
    s1[size - 1] = '\0';
    s2[size - 1] = '\0';
    assert(strncasecmp(s1, s2, 2 * size) == 0);
    break;
  case 'b':
    return strncasecmp(s1 - 1, s2, 1);
  case 'c':
    return strncasecmp(s1, s2 - 1, 1);
  case 'd':
    return strncasecmp(s1 + size, s2, 1);
  case 'e':
    return strncasecmp(s1, s2 + size, 1);
  case 'f':
    return strncasecmp(s1 + 1, s2, size);
  case 'g':
    return strncasecmp(s1, s2 + 1, size);
  case 'h':
    s1[size - 1] = '\0';
    assert(strncasecmp(s1, s2, 2 * size) != 0);
    break;
  case 'i':
    s2[size - 1] = '\0';
    assert(strncasecmp(s1, s2, 2 * size) != 0);
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
setge  %al
movzbl %al,%edi
call   1040 <assert@plt>
movq   $0x64,-0x18(%rbp)
movb   $0x6f,-0x19(%rbp)
mov    %rsp,%rax
mov    %rax,-0x28(%rbp)
movsbl -0x19(%rbp),%esi
lea    -0xa0(%rbp),%rdi
mov    $0x64,%edx
mov    %rdx,-0x120(%rbp)
call   1030 <memset@plt>
mov    -0x120(%rbp),%rdx
movsbl -0x19(%rbp),%esi
lea    -0x110(%rbp),%rdi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x118(%rbp)
sub    $0x8,%eax
ja     13e1 <main+0x2b1>
mov    -0x118(%rbp),%rax
lea    0xe32(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x7a,-0x3d(%rbp)
movb   $0x78,-0xad(%rbp)
movl   $0x0,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
cmp    $0x64,%rax
ja     1247 <main+0x117>
movslq -0x2c(%rbp),%rdx
lea    -0xa0(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1050 <strncasecmp@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movslq -0x2c(%rbp),%rcx
cmp    $0x64,%rcx
setb   %cl
and    $0x1,%cl
movzbl %cl,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11e9 <main+0xb9>
movb   $0x0,-0x3d(%rbp)
movb   $0x0,-0xad(%rbp)
lea    -0xa0(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0xc8,%edx
call   1050 <strncasecmp@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
jmp    13e1 <main+0x2b1>
lea    -0xa0(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
lea    -0x110(%rbp),%rsi
mov    $0x1,%edx
call   1050 <strncasecmp@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x30(%rbp)
jmp    13ef <main+0x2bf>
lea    -0x110(%rbp),%rsi
add    $0xffffffffffffffff,%rsi
lea    -0xa0(%rbp),%rdi
mov    $0x1,%edx
call   1050 <strncasecmp@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x30(%rbp)
jmp    13ef <main+0x2bf>
lea    -0xa0(%rbp),%rdi
add    $0x64,%rdi
lea    -0x110(%rbp),%rsi
mov    $0x1,%edx
call   1050 <strncasecmp@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x30(%rbp)
jmp    13ef <main+0x2bf>
lea    -0x110(%rbp),%rsi
add    $0x64,%rsi
lea    -0xa0(%rbp),%rdi
mov    $0x1,%edx
call   1050 <strncasecmp@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x30(%rbp)
jmp    13ef <main+0x2bf>
lea    -0xa0(%rbp),%rdi
add    $0x1,%rdi
lea    -0x110(%rbp),%rsi
mov    $0x64,%edx
call   1050 <strncasecmp@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x30(%rbp)
jmp    13ef <main+0x2bf>
lea    -0x110(%rbp),%rsi
add    $0x1,%rsi
lea    -0xa0(%rbp),%rdi
mov    $0x64,%edx
call   1050 <strncasecmp@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x30(%rbp)
jmp    13ef <main+0x2bf>
movb   $0x0,-0x3d(%rbp)
lea    -0xa0(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0xc8,%edx
call   1050 <strncasecmp@plt>
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
jmp    13e1 <main+0x2b1>
movb   $0x0,-0xad(%rbp)
lea    -0xa0(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0xc8,%edx
call   1050 <strncasecmp@plt>
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xe0,%rsp
mov    %rsi,%rbx
xor    %eax,%eax
cmp    $0x2,%edi
setge  %al
mov    %eax,%edi
call   1040 <assert@plt>
lea    0x70(%rsp),%rdi
mov    $0x64,%edx
mov    $0x6f,%esi
call   1030 <memset@plt>
mov    %rsp,%rdi
mov    $0x64,%edx
mov    $0x6f,%esi
call   1030 <memset@plt>
mov    0x8(%rbx),%rax
movsbl (%rax),%eax
xor    %ebx,%ebx
add    $0xffffff9f,%eax
cmp    $0x8,%eax
ja     128a <main+0x15a>
lea    0xe70(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x7a,0xd3(%rsp)
7a
movb   $0x78,0x63(%rsp)
xor    %ebx,%ebx
lea    0x70(%rsp),%r14
mov    %rsp,%r15
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <strncasecmp@plt>
test   %eax,%eax
setne  %al
cmp    $0x64,%rbx
setne  %cl
xor    %al,%cl
movzbl %cl,%edi
call   1040 <assert@plt>
add    $0x1,%rbx
cmp    $0x65,%rbx
jne    11b0 <main+0x80>
movb   $0x0,0xd3(%rsp)
movb   $0x0,0x63(%rsp)
lea    0x70(%rsp),%rdi
mov    %rsp,%rsi
mov    $0xc8,%edx
call   1050 <strncasecmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
xor    %ebx,%ebx
jmp    128a <main+0x15a>
lea    0x6f(%rsp),%rdi
jmp    1224 <main+0xf4>
lea    -0x1(%rsp),%rsi
jmp    122e <main+0xfe>
lea    0xd4(%rsp),%rdi
mov    %rsp,%rsi
jmp    1233 <main+0x103>
lea    0x64(%rsp),%rsi
lea    0x70(%rsp),%rdi
mov    $0x1,%edx
jmp    1253 <main+0x123>
lea    0x71(%rsp),%rdi
mov    %rsp,%rsi
jmp    124e <main+0x11e>
lea    0x1(%rsp),%rsi
lea    0x70(%rsp),%rdi
mov    $0x64,%edx
call   1050 <strncasecmp@plt>
mov    %eax,%ebx
jmp    128a <main+0x15a>
movb   $0x0,0xd3(%rsp)
jmp    126b <main+0x13b>
movb   $0x0,0x63(%rsp)
lea    0x70(%rsp),%rdi
mov    %rsp,%rsi
mov    $0xc8,%edx
call   1050 <strncasecmp@plt>
xor    %edi,%edi
test   %eax,%eax
setne  %dil
call   1040 <assert@plt>
mov    %ebx,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp sge i32 %11, 2
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
store i64 100, i64* %6
store i8 111, i8* %7
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %8
%16 = alloca i8, i64 100
%17 = alloca i8, i64 100
%18 = load i8, i8* %7
%19 = call i32 @memset(i8* %16, i8 signext %18, i64 100)
%20 = load i8, i8* %7
%21 = call i32 @memset(i8* %17, i8 signext %20, i64 100)
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8, i8* %24, i64 0
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
switch i32 %27, label %88 [
i32 97, label %28
i32 98, label %58
i32 99, label %61
i32 100, label %64
i32 101, label %67
i32 102, label %70
i32 103, label %73
i32 104, label %76
i32 105, label %82
]
28: ; preds = %2
%29 = getelementptr inbounds i8, i8* %16, i64 99
store i8 122, i8* %29
%30 = getelementptr inbounds i8, i8* %17, i64 99
store i8 120, i8* %30
store i32 0, i32* %9
br label %31
31: ; preds = %48, %28
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = icmp ule i64 %33, 100
br i1 %34, label %35, label %51
35: ; preds = %31
%36 = load i32, i32* %9
%37 = sext i32 %36 to i64
%38 = call i32 @strncasecmp(i8* %16, i8* %17, i64 %37)
%39 = icmp eq i32 %38, 0
%40 = zext i1 %39 to i32
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = icmp ult i64 %42, 100
%44 = zext i1 %43 to i32
%45 = icmp eq i32 %40, %44
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
br label %48
48: ; preds = %35
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
store i32 %50, i32* %9
br label %31
51: ; preds = %31
%52 = getelementptr inbounds i8, i8* %16, i64 99
store i8 0, i8* %52
%53 = getelementptr inbounds i8, i8* %17, i64 99
store i8 0, i8* %53
%54 = call i32 @strncasecmp(i8* %16, i8* %17, i64 200)
%55 = icmp eq i32 %54, 0
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
br label %88
58: ; preds = %2
%59 = getelementptr inbounds i8, i8* %16, i64 -1
%60 = call i32 @strncasecmp(i8* %59, i8* %17, i64 1)
store i32 %60, i32* %3
store i32 1, i32* %10
br label %89
61: ; preds = %2
%62 = getelementptr inbounds i8, i8* %17, i64 -1
%63 = call i32 @strncasecmp(i8* %16, i8* %62, i64 1)
store i32 %63, i32* %3
store i32 1, i32* %10
br label %89
64: ; preds = %2
%65 = getelementptr inbounds i8, i8* %16, i64 100
%66 = call i32 @strncasecmp(i8* %65, i8* %17, i64 1)
store i32 %66, i32* %3
store i32 1, i32* %10
br label %89
67: ; preds = %2
%68 = getelementptr inbounds i8, i8* %17, i64 100
%69 = call i32 @strncasecmp(i8* %16, i8* %68, i64 1)
store i32 %69, i32* %3
store i32 1, i32* %10
br label %89
70: ; preds = %2
%71 = getelementptr inbounds i8, i8* %16, i64 1
%72 = call i32 @strncasecmp(i8* %71, i8* %17, i64 100)
store i32 %72, i32* %3
store i32 1, i32* %10
br label %89
73: ; preds = %2
%74 = getelementptr inbounds i8, i8* %17, i64 1
%75 = call i32 @strncasecmp(i8* %16, i8* %74, i64 100)
store i32 %75, i32* %3
store i32 1, i32* %10
br label %89
76: ; preds = %2
%77 = getelementptr inbounds i8, i8* %16, i64 99
store i8 0, i8* %77
%78 = call i32 @strncasecmp(i8* %16, i8* %17, i64 200)
%79 = icmp ne i32 %78, 0
%80 = zext i1 %79 to i32
%81 = call i32 @assert(i32 %80)
br label %88
82: ; preds = %2
%83 = getelementptr inbounds i8, i8* %17, i64 99
store i8 0, i8* %83
%84 = call i32 @strncasecmp(i8* %16, i8* %17, i64 200)
%85 = icmp ne i32 %84, 0
%86 = zext i1 %85 to i32
%87 = call i32 @assert(i32 %86)
br label %88
88: ; preds = %2, %82, %76, %51
store i32 0, i32* %3
store i32 1, i32* %10
br label %89
89: ; preds = %88, %73, %70, %67, %64, %61, %58
%90 = load i8*, i8** %8
%91 = load i32, i32* %3
ret i32 %91
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i8 signext 111, i64 100)
%11 = call i32 @memset(i8* %8, i8 signext 111, i64 100)
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
switch i32 %15, label %64 [
i32 97, label %16
i32 98, label %34
i32 99, label %37
i32 100, label %40
i32 101, label %43
i32 102, label %46
i32 103, label %49
i32 104, label %52
i32 105, label %58
]
16: ; preds = %2
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 99
store i8 122, i8* %17
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 99
store i8 120, i8* %18
br label %24
19: ; preds = %24
store i8 0, i8* %17
store i8 0, i8* %18
%20 = call i32 @strncasecmp(i8* %9, i8* %8, i64 200)
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
br label %64
24: ; preds = %16, %24
%25 = phi i64 [ 0, %16 ], [ %32, %24 ]
%26 = call i32 @strncasecmp(i8* %9, i8* %8, i64 %25)
%27 = icmp ne i32 %26, 0
%28 = icmp ne i64 %25, 100
%29 = xor i1 %28, %27
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = add nuw nsw i64 %25, 1
%33 = icmp eq i64 %32, 101
br i1 %33, label %19, label %24
34: ; preds = %2
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 -1
%36 = call i32 @strncasecmp(i8* %35, i8* %8, i64 1)
br label %64
37: ; preds = %2
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 -1
%39 = call i32 @strncasecmp(i8* %9, i8* %38, i64 1)
br label %64
40: ; preds = %2
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 100
%42 = call i32 @strncasecmp(i8* %41, i8* %8, i64 1)
br label %64
43: ; preds = %2
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 100
%45 = call i32 @strncasecmp(i8* %9, i8* %44, i64 1)
br label %64
46: ; preds = %2
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 1
%48 = call i32 @strncasecmp(i8* %47, i8* %8, i64 100)
br label %64
49: ; preds = %2
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 1
%51 = call i32 @strncasecmp(i8* %9, i8* %50, i64 100)
br label %64
52: ; preds = %2
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 99
store i8 0, i8* %53
%54 = call i32 @strncasecmp(i8* %9, i8* %8, i64 200)
%55 = icmp ne i32 %54, 0
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
br label %64
58: ; preds = %2
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 99
store i8 0, i8* %59
%60 = call i32 @strncasecmp(i8* %9, i8* %8, i64 200)
%61 = icmp ne i32 %60, 0
%62 = zext i1 %61 to i32
%63 = call i32 @assert(i32 %62)
br label %64
64: ; preds = %19, %52, %58, %2, %49, %46, %43, %40, %37, %34
%65 = phi i32 [ %51, %49 ], [ %48, %46 ], [ %45, %43 ], [ %42, %40 ], [ %39, %37 ], [ %36, %34 ], [ 0, %2 ], [ 0, %58 ], [ 0, %52 ], [ 0, %19 ]
ret i32 %65
}