#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 int ssize_t;
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
int /*<<< orphan*/ REG_EXTENDED;
int /*<<< orphan*/ feof(int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ mtrace();
int /*<<< orphan*/ printf(char *, char *, ...);
int regcomp(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int main(void) {
  mtrace();
  int res = 0;
  char *buf = NULL;
  size_t len = 0;
  while (!feof(stdin)) {
    ssize_t n = getline(&buf, &len, stdin);
    if (n <= 0)
      break;
    if (buf[n - 1] == '\n')
      buf[n - 1] = '\0';
    regex_t regex;
    int rc = regcomp(&regex, buf, REG_EXTENDED);
    if (rc != 0)
      printf("%s: Error %d (expected)\n", buf, rc);
    else {
      printf("%s: succeeded !\n", buf);
      res = 1;
    }
  }
  free(buf);
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <mtrace@plt>
movl   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11b0 <main+0x50>
jmp    125e <main+0xfe>
mov    0x2e31(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <getline@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     11d8 <main+0x78>
jmp    125e <main+0xfe>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1203 <main+0xa3>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rsi
mov    0x2dca(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rdi
call   1050 <regcomp@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1240 <main+0xe0>
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1259 <main+0xf9>
mov    -0x10(%rbp),%rsi
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
jmp    118d <main+0x2d>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <mtrace@plt>
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
mov    0x2e59(%rip),%r13
mov    0x0(%r13),%edi
call   1060 <feof@plt>
test   %eax,%eax
je     11a3 <main+0x43>
xor    %edi,%edi
jmp    1231 <main+0xd1>
mov    %rsp,%r14
lea    0x8(%rsp),%r15
mov    0x2e26(%rip),%rbp
lea    0x14(%rsp),%r12
xor    %ebx,%ebx
jmp    11e0 <main+0x80>
nopl   0x0(%rax,%rax,1)
lea    0xe52(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
mov    0x0(%r13),%edi
call   1060 <feof@plt>
test   %eax,%eax
jne    122d <main+0xcd>
mov    0x0(%r13),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <getline@plt>
test   %eax,%eax
jle    122d <main+0xcd>
mov    (%rsp),%rsi
add    $0xffffffff,%eax
cmpb   $0xa,(%rsi,%rax,1)
jne    1208 <main+0xa8>
movb   $0x0,(%rsi,%rax,1)
mov    (%rsp),%rsi
mov    0x0(%rbp),%edx
mov    %r12,%rdi
call   1050 <regcomp@plt>
mov    (%rsp),%rsi
test   %eax,%eax
je     11c0 <main+0x60>
lea    0xdde(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11d3 <main+0x73>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@REG_EXTENDED = global i32 0
@.str = [25 x i8] c"%s: Error %d (expected)\0A\00"
@.str.1 = [17 x i8] c"%s: succeeded !\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (...) @mtrace()
store i32 0, i32* %2
store i8* null, i8** %3
store i64 0, i64* %4
br label %9
9: ; preds = %48, %0
%10 = load i32, i32* @stdin
%11 = call i32 @feof(i32 %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
br i1 %13, label %14, label %49
14: ; preds = %9
%15 = load i32, i32* @stdin
%16 = call i32 @getline(i8** %3, i64* %4, i32 %15)
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = icmp sle i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %14
br label %49
20: ; preds = %14
%21 = load i8*, i8** %3
%22 = load i32, i32* %5
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %21, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 10
br i1 %28, label %29, label %35
29: ; preds = %20
%30 = load i8*, i8** %3
%31 = load i32, i32* %5
%32 = sub nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %30, i64 %33
store i8 0, i8* %34
br label %35
35: ; preds = %29, %20
%36 = load i8*, i8** %3
%37 = load i32, i32* @REG_EXTENDED
%38 = call i32 @regcomp(i32* %6, i8* %36, i32 %37)
store i32 %38, i32* %7
%39 = load i32, i32* %7
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %35
%42 = load i8*, i8** %3
%43 = load i32, i32* %7
%44 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %42, i32 %43)
br label %48
45: ; preds = %35
%46 = load i8*, i8** %3
%47 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %46)
store i32 1, i32* %2
br label %48
48: ; preds = %45, %41
br label %9
49: ; preds = %19, %9
%50 = load i8*, i8** %3
%51 = call i32 @free(i8* %50)
%52 = load i32, i32* %2
ret i32 %52
}

LLVM IR (-O2):
@stdin = global i32 0
@REG_EXTENDED = global i32 0
@.str = [25 x i8] c"%s: Error %d (expected)\0A\00"
@.str.1 = [17 x i8] c"%s: succeeded !\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i64
%3 = alloca i32
%4 = tail call i32 (...) @mtrace()
%5 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%6 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%7 = load i32, i32* @stdin
%8 = call i32 @feof(i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %44
10: ; preds = %0
%11 = bitcast i32* %3 to i8*
br label %12
12: ; preds = %10, %36
%13 = phi i32 [ 0, %10 ], [ %37, %36 ]
%14 = load i32, i32* @stdin
%15 = call i32 @getline(i8** %1, i64* %2, i32 %14)
%16 = icmp slt i32 %15, 1
br i1 %16, label %41, label %17
17: ; preds = %12
%18 = load i8*, i8** %1
%19 = add nsw i32 %15, -1
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 10
br i1 %23, label %24, label %26
24: ; preds = %17
store i8 0, i8* %21
%25 = load i8*, i8** %1
br label %26
26: ; preds = %24, %17
%27 = phi i8* [ %25, %24 ], [ %18, %17 ]
%28 = load i32, i32* @REG_EXTENDED
%29 = call i32 @regcomp(i32* %3, i8* %27, i32 %28)
%30 = icmp eq i32 %29, 0
%31 = load i8*, i8** %1
br i1 %30, label %34, label %32
32: ; preds = %26
%33 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %31, i32 %29)
br label %36
34: ; preds = %26
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %31)
br label %36
36: ; preds = %32, %34
%37 = phi i32 [ %13, %32 ], [ 1, %34 ]
%38 = load i32, i32* @stdin
%39 = call i32 @feof(i32 %38)
%40 = icmp eq i32 %39, 0
br i1 %40, label %12, label %41
41: ; preds = %12, %36
%42 = phi i32 [ %37, %36 ], [ %13, %12 ]
%43 = load i8*, i8** %1
br label %44
44: ; preds = %41, %0
%45 = phi i8* [ null, %0 ], [ %43, %41 ]
%46 = phi i32 [ 0, %0 ], [ %42, %41 ]
%47 = call i32 @free(i8* %45)
ret i32 %46
}