#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 */
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  int member_0;
  int member_1;
  int rm_so;
  char *rm_eo;
};
typedef TYPE_1__ regmatch_t;
typedef int /*<<< orphan*/ regex_t;
typedef int /*<<< orphan*/ mat;
typedef int /*<<< orphan*/ locales;

/* Variables and functions */
int /*<<< orphan*/ LC_ALL;
scalar_t__ REG_NOERROR;
scalar_t__ REG_NOMATCH;
int /*<<< orphan*/ memcmp(TYPE_1__ *, TYPE_1__ *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
scalar_t__ regcomp(int /*<<< orphan*/ *, char *, int);
scalar_t__ regexec(int /*<<< orphan*/ *, char const *, int, TYPE_1__ *,
                   int /*<<< orphan*/);
int /*<<< orphan*/ *setlocale(int /*<<< orphan*/, char const *);
int main(int argc, char *argv[]) {
  regex_t re;
  regmatch_t mat[10];
  int i, j, ret = 0;
  const char *locales[] = {"C", "de_DE.UTF-8"};
  const char *string = "http://www.regex.com/pattern/matching.html#intro";
  regmatch_t expect[10] = {{0, 48},  {0, 5},   {0, 4},   {5, 20},  {7, 20},
                           {20, 42}, {-1, -1}, {-1, -1}, {42, 48}, {43, 48}};
  for (i = 0; i < sizeof(locales) / sizeof(locales[0]); ++i) {
    if (setlocale(LC_ALL, locales[i]) == NULL) {
      puts("cannot set locale");
      ret = 1;
    } else if (regcomp(
                   &re,
                   "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?",
                   1) != REG_NOERROR) {
      puts("cannot compile the regular expression");
      ret = 1;
    } else if (regexec(&re, string, 10, mat, 0) == REG_NOMATCH) {
      puts("no match");
      ret = 1;
    } else {
      if (!memcmp(mat, expect, sizeof(mat)))
        printf("matching ok for %s locale\n", locales[i]);
      else {
        printf("matching failed for %s locale:\n", locales[i]);
        ret = 1;
        for (j = 0; j < 9; ++j)
          if (mat[j].rm_so != -1)
            printf("%d: %.*s\n", j, mat[j].rm_eo - mat[j].rm_so,
                   string + mat[j].rm_so);
      }
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x11c(%rbp)
mov    0x2c56(%rip),%rax
mov    %rax,-0x130(%rbp)
mov    0x2c50(%rip),%rax
mov    %rax,-0x128(%rbp)
lea    0xe58(%rip),%rax
mov    %rax,-0x138(%rbp)
lea    -0x230(%rbp),%rdi
lea    0xf35(%rip),%rsi
mov    $0xf0,%edx
call   1070 <memcpy@plt>
movl   $0x0,-0x114(%rbp)
movslq -0x114(%rbp),%rax
cmp    $0x2,%rax
jae    1413 <main+0x2a3>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
movslq -0x114(%rbp),%rax
mov    -0x130(%rbp,%rax,8),%rsi
ff
call   1090 <setlocale@plt>
cmp    $0x0,%rax
jne    1232 <main+0xc2>
lea    0xe21(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x11c(%rbp)
jmp    13fa <main+0x28a>
lea    -0x14(%rbp),%rdi
lea    0xe14(%rip),%rsi
mov    $0x1,%edx
call   1050 <regcomp@plt>
mov    0x2d92(%rip),%rcx
cmp    (%rcx),%rax
je     1272 <main+0x102>
lea    0xe2d(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x11c(%rbp)
jmp    13f5 <main+0x285>
mov    -0x138(%rbp),%rsi
lea    -0x110(%rbp),%rcx
lea    -0x14(%rbp),%rdi
mov    $0xa,%edx
xor    %r8d,%r8d
call   1080 <regexec@plt>
mov    0x2d40(%rip),%rcx
cmp    (%rcx),%rax
jne    12bc <main+0x14c>
lea    0xe09(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x11c(%rbp)
jmp    13f0 <main+0x280>
lea    -0x110(%rbp),%rdi
lea    -0x230(%rbp),%rsi
mov    $0xf0,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%eax
jne    12ff <main+0x18f>
movslq -0x114(%rbp),%rax
mov    -0x130(%rbp,%rax,8),%rsi
ff
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13eb <main+0x27b>
movslq -0x114(%rbp),%rax
mov    -0x130(%rbp,%rax,8),%rsi
ff
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x11c(%rbp)
movl   $0x0,-0x118(%rbp)
cmpl   $0x9,-0x118(%rbp)
jge    13e6 <main+0x276>
movslq -0x118(%rbp),%rcx
lea    -0x110(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
cmpl   $0xffffffff,0x8(%rax)
je     13cd <main+0x25d>
mov    -0x118(%rbp),%esi
movslq -0x118(%rbp),%rcx
lea    -0x110(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x10(%rax),%rdx
movslq -0x118(%rbp),%rcx
lea    -0x110(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq 0x8(%rax),%rcx
xor    %eax,%eax
sub    %rcx,%rax
add    %rax,%rdx
mov    -0x138(%rbp),%rcx
movslq -0x118(%rbp),%rdi
lea    -0x110(%rbp),%rax
imul   $0x18,%rdi,%rdi
add    %rdi,%rax
movslq 0x8(%rax),%rax
add    %rax,%rcx
lea    0xd2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13d2 <main+0x262>
mov    -0x118(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
jmp    1330 <main+0x1c0>
jmp    13eb <main+0x27b>
jmp    13f0 <main+0x280>
jmp    13f5 <main+0x285>
jmp    13fa <main+0x28a>
jmp    13ff <main+0x28f>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    11df <main+0x6f>
mov    -0x11c(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1f8,%rsp
lea    0xf78(%rip),%rsi
lea    0x100(%rsp),%rdi
mov    $0xf0,%edx
call   1070 <memcpy@plt>
mov    $0x1,%r14b
mov    0x2e24(%rip),%r15
lea    0x2c45(%rip),%rbx
lea    0xc(%rsp),%r13
lea    0x10(%rsp),%r12
xor    %eax,%eax
movl   $0x0,0x4(%rsp)
jmp    11f9 <main+0x89>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe68(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,0x4(%rsp)
mov    $0x1,%eax
test   $0x1,%r14b
mov    $0x0,%r14d
je     14ea <main+0x37a>
mov    (%r15),%edi
mov    (%rbx,%rax,8),%rbp
mov    %rbp,%rsi
call   1090 <setlocale@plt>
test   %rax,%rax
je     11d0 <main+0x60>
mov    %r14d,0x8(%rsp)
mov    %rbx,%r14
mov    %r15,%rbx
mov    %r13,%r15
mov    %r13,%rdi
lea    0xe2c(%rip),%rsi
mov    $0x1,%edx
call   1050 <regcomp@plt>
mov    0x2daa(%rip),%rcx
cmp    (%rcx),%rax
jne    1280 <main+0x110>
mov    %r15,%rdi
lea    0xdc9(%rip),%rsi
mov    $0xa,%edx
mov    %r12,%rbx
mov    %r12,%rcx
xor    %r8d,%r8d
call   1080 <regexec@plt>
mov    0x2d79(%rip),%rcx
cmp    (%rcx),%rax
jne    12a7 <main+0x137>
lea    0xe46(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,0x4(%rsp)
mov    %rbx,%r12
jmp    14d2 <main+0x362>
lea    0xe04(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,0x4(%rsp)
mov    %r15,%r13
mov    %rbx,%r15
mov    %r14,%rbx
mov    0x8(%rsp),%r14d
jmp    11e4 <main+0x74>
mov    %rbx,%rdi
lea    0x100(%rsp),%rsi
mov    $0xf0,%edx
call   1060 <memcmp@plt>
test   %eax,%eax
je     14c1 <main+0x351>
lea    0xe0a(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x18(%rsp),%rcx
cmp    $0xffffffffffffffff,%rcx
je     1302 <main+0x192>
mov    0x20(%rsp),%rdx
sub    %rcx,%rdx
lea    0xd1f(%rip),%rax
add    %rax,%rcx
lea    0xdfc(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x30(%rsp),%rcx
cmp    $0xffffffffffffffff,%rcx
je     1332 <main+0x1c2>
mov    0x38(%rsp),%rdx
sub    %rcx,%rdx
lea    0xcf2(%rip),%rax
add    %rax,%rcx
lea    0xdcf(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x48(%rsp),%rcx
cmp    $0xffffffffffffffff,%rcx
je     1362 <main+0x1f2>
mov    0x50(%rsp),%rdx
sub    %rcx,%rdx
lea    0xcc2(%rip),%rax
add    %rax,%rcx
lea    0xd9f(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x60(%rsp),%rcx
cmp    $0xffffffffffffffff,%rcx
mov    0x2c56(%rip),%r15
mov    0x8(%rsp),%r14d
je     139e <main+0x22e>
mov    0x68(%rsp),%rdx
sub    %rcx,%rdx
lea    0xc86(%rip),%rax
add    %rax,%rcx
lea    0xd63(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x78(%rsp),%rcx
cmp    $0xffffffffffffffff,%rcx
lea    0x2a42(%rip),%rbx
je     13d8 <main+0x268>
mov    0x80(%rsp),%rdx
sub    %rcx,%rdx
lea    0xc4c(%rip),%rax
add    %rax,%rcx
lea    0xd29(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x90(%rsp),%rcx
cmp    $0xffffffffffffffff,%rcx
je     140e <main+0x29e>
mov    0x98(%rsp),%rdx
sub    %rcx,%rdx
lea    0xc16(%rip),%rax
add    %rax,%rcx
lea    0xcf3(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0xa8(%rsp),%rcx
cmp    $0xffffffffffffffff,%rcx
je     1444 <main+0x2d4>
mov    0xb0(%rsp),%rdx
sub    %rcx,%rdx
lea    0xbe0(%rip),%rax
add    %rax,%rcx
lea    0xcbd(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0xc0(%rsp),%rcx
cmp    $0xffffffffffffffff,%rcx
je     147a <main+0x30a>
mov    0xc8(%rsp),%rdx
sub    %rcx,%rdx
lea    0xbaa(%rip),%rax
add    %rax,%rcx
lea    0xc87(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0xd8(%rsp),%rcx
movl   $0x1,0x4(%rsp)
cmp    $0xffffffffffffffff,%rcx
je     11e4 <main+0x74>
mov    0xe0(%rsp),%rdx
sub    %rcx,%rdx
lea    0xb68(%rip),%rax
add    %rax,%rcx
lea    0xc45(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11e4 <main+0x74>
lea    0xbf2(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2aef(%rip),%r15
lea    0x2910(%rip),%rbx
mov    0x8(%rsp),%r14d
jmp    11e4 <main+0x74>
mov    0x4(%rsp),%eax
add    $0x1f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, i32, i32, i8* }
@.str = [2 x i8] c"C\00"
@.str.1 = [12 x i8] c"de_DE.UTF-8\00"
@__const.main.locales = [2 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [49 x i8] c"http://www.regex.com/pattern/matching.html#intro\00"
@__const.main.expect = [10 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 0, i32 48, i32 0, i8* null }, %struct.TYPE_5__ { i32 0, i32 5, i32 0, i8* null }, %struct.TYPE_5__ { i32 0, i32 4, i32 0, i8* null }, %struct.TYPE_5__ { i32 5, i32 20, i32 0, i8* null }, %struct.TYPE_5__ { i32 7, i32 20, i32 0, i8* null }, %struct.TYPE_5__ { i32 20, i32 42, i32 0, i8* null }, %struct.TYPE_5__ { i32 -1, i32 -1, i32 0, i8* null }, %struct.TYPE_5__ { i32 -1, i32 -1, i32 0, i8* null }, %struct.TYPE_5__ { i32 42, i32 48, i32 0, i8* null }, %struct.TYPE_5__ { i32 43, i32 48, i32 0, i8* null }]
@LC_ALL = global i32 0
@.str.3 = [18 x i8] c"cannot set locale\00"
@.str.4 = [58 x i8] c"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?\00"
@REG_NOERROR = global i64 0
@.str.5 = [38 x i8] c"cannot compile the regular expression\00"
@REG_NOMATCH = global i64 0
@.str.6 = [9 x i8] c"no match\00"
@.str.7 = [27 x i8] c"matching ok for %s locale\0A\00"
@.str.8 = [32 x i8] c"matching failed for %s locale:\0A\00"
@.str.9 = [10 x i8] c"%d: %.*s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [10 x %struct.TYPE_5__]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [2 x i8*]
%12 = alloca i8*
%13 = alloca [10 x %struct.TYPE_5__]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
%14 = bitcast [2 x i8*]* %11 to i8*
store i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i8** %12
%15 = bitcast [10 x %struct.TYPE_5__]* %13 to i8*
store i32 0, i32* %8
br label %16
16: ; preds = %104, %2
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = icmp ult i64 %18, 2
br i1 %19, label %20, label %107
20: ; preds = %16
%21 = load i32, i32* @LC_ALL
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [2 x i8*], [2 x i8*]* %11, i64 0, i64 %23
%25 = load i8*, i8** %24
%26 = call i32* @setlocale(i32 %21, i8* %25)
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %30
28: ; preds = %20
%29 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %10
br label %103
30: ; preds = %20
%31 = call i64 @regcomp(i32* %6, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i32 1)
%32 = load i64, i64* @REG_NOERROR
%33 = icmp ne i64 %31, %32
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i32 @puts(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %10
br label %102
36: ; preds = %30
%37 = load i8*, i8** %12
%38 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %7, i64 0, i64 0
%39 = call i64 @regexec(i32* %6, i8* %37, i32 10, %struct.TYPE_5__* %38, i32 0)
%40 = load i64, i64* @REG_NOMATCH
%41 = icmp eq i64 %39, %40
br i1 %41, label %42, label %44
42: ; preds = %36
%43 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %10
br label %101
44: ; preds = %36
%45 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %7, i64 0, i64 0
%46 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %13, i64 0, i64 0
%47 = call i32 @memcmp(%struct.TYPE_5__* %45, %struct.TYPE_5__* %46, i32 240)
%48 = icmp ne i32 %47, 0
br i1 %48, label %55, label %49
49: ; preds = %44
%50 = load i32, i32* %8
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [2 x i8*], [2 x i8*]* %11, i64 0, i64 %51
%53 = load i8*, i8** %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %53)
br label %100
55: ; preds = %44
%56 = load i32, i32* %8
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [2 x i8*], [2 x i8*]* %11, i64 0, i64 %57
%59 = load i8*, i8** %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i8* %59)
store i32 1, i32* %10
store i32 0, i32* %9
br label %61
61: ; preds = %96, %55
%62 = load i32, i32* %9
%63 = icmp slt i32 %62, 9
br i1 %63, label %64, label %99
64: ; preds = %61
%65 = load i32, i32* %9
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %7, i64 0, i64 %66
%68 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %67, i32 0, i32 2
%69 = load i32, i32* %68
%70 = icmp ne i32 %69, -1
br i1 %70, label %71, label %95
71: ; preds = %64
%72 = load i32, i32* %9
%73 = load i32, i32* %9
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %7, i64 0, i64 %74
%76 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %75, i32 0, i32 3
%77 = load i8*, i8** %76
%78 = load i32, i32* %9
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %7, i64 0, i64 %79
%81 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %80, i32 0, i32 2
%82 = load i32, i32* %81
%83 = sext i32 %82 to i64
%84 = sub i64 0, %83
%85 = getelementptr inbounds i8, i8* %77, i64 %84
%86 = load i8*, i8** %12
%87 = load i32, i32* %9
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %7, i64 0, i64 %88
%90 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %89, i32 0, i32 2
%91 = load i32, i32* %90
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8, i8* %86, i64 %92
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 %72, i8* %85, i8* %93)
br label %95
95: ; preds = %71, %64
br label %96
96: ; preds = %95
%97 = load i32, i32* %9
%98 = add nsw i32 %97, 1
store i32 %98, i32* %9
br label %61
99: ; preds = %61
br label %100
100: ; preds = %99, %49
br label %101
101: ; preds = %100, %42
br label %102
102: ; preds = %101, %34
br label %103
103: ; preds = %102, %28
br label %104
104: ; preds = %103
%105 = load i32, i32* %8
%106 = add nsw i32 %105, 1
store i32 %106, i32* %8
br label %16
107: ; preds = %16
%108 = load i32, i32* %10
ret i32 %108
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, i32, i32, i8* }
@.str = [2 x i8] c"C\00"
@.str.1 = [12 x i8] c"de_DE.UTF-8\00"
@__const.main.locales = [2 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [49 x i8] c"http://www.regex.com/pattern/matching.html#intro\00"
@__const.main.expect = [10 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 0, i32 48, i32 0, i8* null }, %struct.TYPE_5__ { i32 0, i32 5, i32 0, i8* null }, %struct.TYPE_5__ { i32 0, i32 4, i32 0, i8* null }, %struct.TYPE_5__ { i32 5, i32 20, i32 0, i8* null }, %struct.TYPE_5__ { i32 7, i32 20, i32 0, i8* null }, %struct.TYPE_5__ { i32 20, i32 42, i32 0, i8* null }, %struct.TYPE_5__ { i32 -1, i32 -1, i32 0, i8* null }, %struct.TYPE_5__ { i32 -1, i32 -1, i32 0, i8* null }, %struct.TYPE_5__ { i32 42, i32 48, i32 0, i8* null }, %struct.TYPE_5__ { i32 43, i32 48, i32 0, i8* null }]
@LC_ALL = global i32 0
@.str.3 = [18 x i8] c"cannot set locale\00"
@.str.4 = [58 x i8] c"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?\00"
@REG_NOERROR = global i64 0
@.str.5 = [38 x i8] c"cannot compile the regular expression\00"
@REG_NOMATCH = global i64 0
@.str.6 = [9 x i8] c"no match\00"
@.str.7 = [27 x i8] c"matching ok for %s locale\0A\00"
@.str.8 = [32 x i8] c"matching failed for %s locale:\0A\00"
@.str.9 = [10 x i8] c"%d: %.*s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [10 x %struct.TYPE_5__]
%5 = alloca [10 x %struct.TYPE_5__]
%6 = bitcast i32* %3 to i8*
%7 = bitcast [10 x %struct.TYPE_5__]* %4 to i8*
%8 = bitcast [10 x %struct.TYPE_5__]* %5 to i8*
%9 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 0
%10 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %5, i64 0, i64 0
%11 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 0, i32 2
%12 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 0, i32 3
%13 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 1, i32 2
%14 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 1, i32 3
%15 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 2, i32 2
%16 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 2, i32 3
%17 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 3, i32 2
%18 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 3, i32 3
%19 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 4, i32 2
%20 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 4, i32 3
%21 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 5, i32 2
%22 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 5, i32 3
%23 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 6, i32 2
%24 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 6, i32 3
%25 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 7, i32 2
%26 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 7, i32 3
%27 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 8, i32 2
%28 = getelementptr inbounds [10 x %struct.TYPE_5__], [10 x %struct.TYPE_5__]* %4, i64 0, i64 8, i32 3
br label %29
29: ; preds = %2, %148
%30 = phi i1 [ true, %2 ], [ false, %148 ]
%31 = phi i64 [ 0, %2 ], [ 1, %148 ]
%32 = phi i32 [ 0, %2 ], [ %149, %148 ]
%33 = load i32, i32* @LC_ALL
%34 = getelementptr inbounds [2 x i8*], [2 x i8*]* @__const.main.locales, i64 0, i64 %31
%35 = load i8*, i8** %34
%36 = call i32* @setlocale(i32 %33, i8* %35)
%37 = icmp eq i32* %36, null
br i1 %37, label %38, label %40
38: ; preds = %29
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %148
40: ; preds = %29
%41 = call i64 @regcomp(i32* %3, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i32 1)
%42 = load i64, i64* @REG_NOERROR
%43 = icmp eq i64 %41, %42
br i1 %43, label %46, label %44
44: ; preds = %40
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
br label %148
46: ; preds = %40
%47 = call i64 @regexec(i32* %3, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 10, %struct.TYPE_5__* %9, i32 0)
%48 = load i64, i64* @REG_NOMATCH
%49 = icmp eq i64 %47, %48
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
br label %148
52: ; preds = %46
%53 = call i32 @memcmp(%struct.TYPE_5__* %9, %struct.TYPE_5__* %10, i32 240)
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %35)
br label %148
57: ; preds = %52
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i8* %35)
%59 = load i32, i32* %11
%60 = icmp eq i32 %59, -1
br i1 %60, label %68, label %61
61: ; preds = %57
%62 = load i8*, i8** %12
%63 = sext i32 %59 to i64
%64 = sub nsw i64 0, %63
%65 = getelementptr inbounds i8, i8* %62, i64 %64
%66 = getelementptr inbounds [49 x i8], [49 x i8]* @.str.2, i64 0, i64 %63
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 0, i8* %65, i8* %66)
br label %68
68: ; preds = %57, %61
%69 = load i32, i32* %13
%70 = icmp eq i32 %69, -1
br i1 %70, label %78, label %71
71: ; preds = %68
%72 = load i8*, i8** %14
%73 = sext i32 %69 to i64
%74 = sub nsw i64 0, %73
%75 = getelementptr inbounds i8, i8* %72, i64 %74
%76 = getelementptr inbounds [49 x i8], [49 x i8]* @.str.2, i64 0, i64 %73
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 1, i8* %75, i8* %76)
br label %78
78: ; preds = %71, %68
%79 = load i32, i32* %15
%80 = icmp eq i32 %79, -1
br i1 %80, label %88, label %81
81: ; preds = %78
%82 = load i8*, i8** %16
%83 = sext i32 %79 to i64
%84 = sub nsw i64 0, %83
%85 = getelementptr inbounds i8, i8* %82, i64 %84
%86 = getelementptr inbounds [49 x i8], [49 x i8]* @.str.2, i64 0, i64 %83
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 2, i8* %85, i8* %86)
br label %88
88: ; preds = %81, %78
%89 = load i32, i32* %17
%90 = icmp eq i32 %89, -1
br i1 %90, label %98, label %91
91: ; preds = %88
%92 = load i8*, i8** %18
%93 = sext i32 %89 to i64
%94 = sub nsw i64 0, %93
%95 = getelementptr inbounds i8, i8* %92, i64 %94
%96 = getelementptr inbounds [49 x i8], [49 x i8]* @.str.2, i64 0, i64 %93
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 3, i8* %95, i8* %96)
br label %98
98: ; preds = %91, %88
%99 = load i32, i32* %19
%100 = icmp eq i32 %99, -1
br i1 %100, label %108, label %101
101: ; preds = %98
%102 = load i8*, i8** %20
%103 = sext i32 %99 to i64
%104 = sub nsw i64 0, %103
%105 = getelementptr inbounds i8, i8* %102, i64 %104
%106 = getelementptr inbounds [49 x i8], [49 x i8]* @.str.2, i64 0, i64 %103
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 4, i8* %105, i8* %106)
br label %108
108: ; preds = %101, %98
%109 = load i32, i32* %21
%110 = icmp eq i32 %109, -1
br i1 %110, label %118, label %111
111: ; preds = %108
%112 = load i8*, i8** %22
%113 = sext i32 %109 to i64
%114 = sub nsw i64 0, %113
%115 = getelementptr inbounds i8, i8* %112, i64 %114
%116 = getelementptr inbounds [49 x i8], [49 x i8]* @.str.2, i64 0, i64 %113
%117 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 5, i8* %115, i8* %116)
br label %118
118: ; preds = %111, %108
%119 = load i32, i32* %23
%120 = icmp eq i32 %119, -1
br i1 %120, label %128, label %121
121: ; preds = %118
%122 = load i8*, i8** %24
%123 = sext i32 %119 to i64
%124 = sub nsw i64 0, %123
%125 = getelementptr inbounds i8, i8* %122, i64 %124
%126 = getelementptr inbounds [49 x i8], [49 x i8]* @.str.2, i64 0, i64 %123
%127 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 6, i8* %125, i8* %126)
br label %128
128: ; preds = %121, %118
%129 = load i32, i32* %25
%130 = icmp eq i32 %129, -1
br i1 %130, label %138, label %131
131: ; preds = %128
%132 = load i8*, i8** %26
%133 = sext i32 %129 to i64
%134 = sub nsw i64 0, %133
%135 = getelementptr inbounds i8, i8* %132, i64 %134
%136 = getelementptr inbounds [49 x i8], [49 x i8]* @.str.2, i64 0, i64 %133
%137 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 7, i8* %135, i8* %136)
br label %138
138: ; preds = %131, %128
%139 = load i32, i32* %27
%140 = icmp eq i32 %139, -1
br i1 %140, label %148, label %141
141: ; preds = %138
%142 = load i8*, i8** %28
%143 = sext i32 %139 to i64
%144 = sub nsw i64 0, %143
%145 = getelementptr inbounds i8, i8* %142, i64 %144
%146 = getelementptr inbounds [49 x i8], [49 x i8]* @.str.2, i64 0, i64 %143
%147 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 8, i8* %145, i8* %146)
br label %148
148: ; preds = %138, %141, %38, %50, %55, %44
%149 = phi i32 [ 1, %38 ], [ 1, %44 ], [ 1, %50 ], [ %32, %55 ], [ 1, %141 ], [ 1, %138 ]
br i1 %30, label %29, label %150
150: ; preds = %148
ret i32 %149
}