#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 0;
}


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>
xor    %eax,%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),%rbp
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
test   %eax,%eax
jne    1227 <main+0xc7>
mov    %rsp,%r14
lea    0x8(%rsp),%rbx
mov    0x2e2a(%rip),%r12
lea    0x14(%rsp),%r15
lea    0xe46(%rip),%r13
jmp    11da <main+0x7a>
nopl   0x0(%rax)
lea    0xe52(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
test   %eax,%eax
jne    1223 <main+0xc3>
mov    0x0(%rbp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <getline@plt>
test   %eax,%eax
jle    1223 <main+0xc3>
mov    (%rsp),%rsi
add    $0xffffffff,%eax
cmpb   $0xa,(%rsi,%rax,1)
jne    1201 <main+0xa1>
movb   $0x0,(%rsi,%rax,1)
mov    (%rsp),%rsi
mov    (%r12),%edx
mov    %r15,%rdi
call   1050 <regcomp@plt>
mov    (%rsp),%rsi
test   %eax,%eax
je     11c0 <main+0x60>
mov    %r13,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ce <main+0x6e>
mov    (%rsp),%rbx
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%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)
ret i32 0
}

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 %41
10: ; preds = %0
%11 = bitcast i32* %3 to i8*
br label %12
12: ; preds = %10, %35
%13 = load i32, i32* @stdin
%14 = call i32 @getline(i8** %1, i64* %2, i32 %13)
%15 = icmp slt i32 %14, 1
br i1 %15, label %39, label %16
16: ; preds = %12
%17 = load i8*, i8** %1
%18 = add nsw i32 %14, -1
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 10
br i1 %22, label %23, label %25
23: ; preds = %16
store i8 0, i8* %20
%24 = load i8*, i8** %1
br label %25
25: ; preds = %23, %16
%26 = phi i8* [ %24, %23 ], [ %17, %16 ]
%27 = load i32, i32* @REG_EXTENDED
%28 = call i32 @regcomp(i32* %3, i8* %26, i32 %27)
%29 = icmp eq i32 %28, 0
%30 = load i8*, i8** %1
br i1 %29, label %33, label %31
31: ; preds = %25
%32 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %30, i32 %28)
br label %35
33: ; preds = %25
%34 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %30)
br label %35
35: ; preds = %31, %33
%36 = load i32, i32* @stdin
%37 = call i32 @feof(i32 %36)
%38 = icmp eq i32 %37, 0
br i1 %38, label %12, label %39
39: ; preds = %12, %35
%40 = load i8*, i8** %1
br label %41
41: ; preds = %39, %0
%42 = phi i8* [ %40, %39 ], [ null, %0 ]
%43 = call i32 @free(i8* %42)
ret i32 0
}