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

/* Variables and functions */
int /*<<< orphan*/ free(char *);
scalar_t__ isspace(char);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ regexec(int /*<<< orphan*/ const *, char *, int /*<<< orphan*/,
                   int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ settings(char *, char *);
char *strdup(char *);
void readLine(char *in, const regex_t *reg) {
  if (regexec(reg, in, 0, NULL, 0)) {
    printf("Error on line: %s\n", in);
    return;
  }
  char *p = in;
  int i;
  while (*p != '=')
    p++;
  *p = '\0';
  p++;
  while (isspace(*p))
    p++;
  char *arg = strdup(in);
  char *param = strdup(p);
  for (i = 0; arg[i]; i++) {
    if (isspace(arg[i])) {
      arg[i] = '\0';
      break;
    }
  }
  settings(arg, param);
  free(arg);
  free(param);
}


x86 assembly (clang, -O0):
<readLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
xor    %r8d,%r8d
xor    %eax,%eax
mov    %eax,%ecx
mov    %r8d,%edx
call   1060 <regexec@plt>
cmp    $0x0,%rax
je     11a6 <readLine+0x46>
mov    -0x8(%rbp),%rsi
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
jmp    129a <readLine+0x13a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
je     11cf <readLine+0x6f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11ae <readLine+0x4e>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     1209 <readLine+0xa9>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11e2 <readLine+0x82>
mov    -0x8(%rbp),%rdi
call   1080 <strdup@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <strdup@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     127b <readLine+0x11b>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     1268 <readLine+0x108>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    127b <readLine+0x11b>
jmp    126d <readLine+0x10d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    122a <readLine+0xca>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1070 <settings@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readLine>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <regexec@plt>
test   %rax,%rax
je     1193 <readLine+0x33>
lea    0xe7a(%rip),%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <printf@plt>
lea    -0x1(%r14),%rbx
nopw   0x0(%rax,%rax,1)
cmpb   $0x3d,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    11a0 <readLine+0x40>
movb   $0x0,(%rbx)
nopl   (%rax)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1050 <isspace@plt>
test   %rax,%rax
jne    11b0 <readLine+0x50>
mov    %r14,%rdi
call   1080 <strdup@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1080 <strdup@plt>
mov    %rax,%r14
mov    (%r15),%al
test   %al,%al
je     1214 <readLine+0xb4>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1050 <isspace@plt>
test   %rax,%rax
jne    120d <readLine+0xad>
movzbl 0x1(%r15,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    11f0 <readLine+0x90>
jmp    1214 <readLine+0xb4>
mov    %ebx,%eax
movb   $0x0,(%r15,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <settings@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Error on line: %s\0A\00"
define void @readLine(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %3
store i32* %1, i32** %4
%9 = load i32*, i32** %4
%10 = load i8*, i8** %3
%11 = call i64 @regexec(i32* %9, i8* %10, i32 0, i32* null, i32 0)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %75
16: ; preds = %2
%17 = load i8*, i8** %3
store i8* %17, i8** %5
br label %18
18: ; preds = %23, %16
%19 = load i8*, i8** %5
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 61
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %5
br label %18
26: ; preds = %18
%27 = load i8*, i8** %5
store i8 0, i8* %27
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %5
br label %30
30: ; preds = %35, %26
%31 = load i8*, i8** %5
%32 = load i8, i8* %31
%33 = call i64 @isspace(i8 signext %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %30
%36 = load i8*, i8** %5
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %5
br label %30
38: ; preds = %30
%39 = load i8*, i8** %3
%40 = call i8* @strdup(i8* %39)
store i8* %40, i8** %7
%41 = load i8*, i8** %5
%42 = call i8* @strdup(i8* %41)
store i8* %42, i8** %8
store i32 0, i32* %6
br label %43
43: ; preds = %64, %38
%44 = load i8*, i8** %7
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = icmp ne i8 %48, 0
br i1 %49, label %50, label %67
50: ; preds = %43
%51 = load i8*, i8** %7
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
%56 = call i64 @isspace(i8 signext %55)
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %63
58: ; preds = %50
%59 = load i8*, i8** %7
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %59, i64 %61
store i8 0, i8* %62
br label %67
63: ; preds = %50
br label %64
64: ; preds = %63
%65 = load i32, i32* %6
%66 = add nsw i32 %65, 1
store i32 %66, i32* %6
br label %43
67: ; preds = %58, %43
%68 = load i8*, i8** %7
%69 = load i8*, i8** %8
%70 = call i32 @settings(i8* %68, i8* %69)
%71 = load i8*, i8** %7
%72 = call i32 @free(i8* %71)
%73 = load i8*, i8** %8
%74 = call i32 @free(i8* %73)
br label %75
75: ; preds = %67, %13
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Error on line: %s\0A\00"
define void @readLine(i8* %0, i32* %1) {
%3 = tail call i64 @regexec(i32* %1, i8* %0, i32 0, i32* null, i32 0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %41
7: ; preds = %2, %7
%8 = phi i8* [ %11, %7 ], [ %0, %2 ]
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 61
%11 = getelementptr inbounds i8, i8* %8, i64 1
br i1 %10, label %12, label %7
12: ; preds = %7
store i8 0, i8* %8
br label %13
13: ; preds = %13, %12
%14 = phi i8* [ %8, %12 ], [ %15, %13 ]
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = tail call i64 @isspace(i8 signext %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %13
19: ; preds = %13
%20 = tail call i8* @strdup(i8* %0)
%21 = tail call i8* @strdup(i8* %15)
%22 = load i8, i8* %20
%23 = icmp eq i8 %22, 0
br i1 %23, label %37, label %24
24: ; preds = %19, %32
%25 = phi i64 [ %33, %32 ], [ 0, %19 ]
%26 = phi i8 [ %35, %32 ], [ %22, %19 ]
%27 = tail call i64 @isspace(i8 signext %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %24
%30 = and i64 %25, 4294967295
%31 = getelementptr inbounds i8, i8* %20, i64 %30
store i8 0, i8* %31
br label %37
32: ; preds = %24
%33 = add nuw i64 %25, 1
%34 = getelementptr inbounds i8, i8* %20, i64 %33
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, 0
br i1 %36, label %37, label %24
37: ; preds = %32, %19, %29
%38 = tail call i32 @settings(i8* %20, i8* %21)
%39 = tail call i32 @free(i8* %20)
%40 = tail call i32 @free(i8* %21)
br label %41
41: ; preds = %37, %5
ret void
}