void getstrpar(s, r, l, t) const char *s;
char *r;
int l;
const char *t;
{
  int i;
  char format[20];
  int f;
  if (t == 0)
    t = " \t\n;";
  (void)sprintf(format, "%%%d[^%s]", l, t);
  while (1) {
    if ((f = testnl()) && s)
      printf("%s: ", s);
    if (f)
      cgetc(0);
    scanf("%*[\t ;]");
    i = scanf(format, r);
    if (i < 0)
      exit(1);
    if (i != 0)
      return;
  }
}


x86 assembly (clang, -O0):
<getstrpar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    118d <getstrpar+0x2d>
lea    0xe77(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    0xe66(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    $0x0,%al
call   1080 <testnl@plt>
mov    %eax,-0x44(%rbp)
cmp    $0x0,%eax
je     11d6 <getstrpar+0x76>
cmpq   $0x0,-0x8(%rbp)
je     11d6 <getstrpar+0x76>
mov    -0x8(%rbp),%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x44(%rbp)
je     11e9 <getstrpar+0x89>
xor    %edi,%edi
mov    $0x0,%al
call   1050 <cgetc@plt>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    121d <getstrpar+0xbd>
mov    $0x1,%edi
call   1070 <exit@plt>
cmpl   $0x0,-0x24(%rbp)
je     122d <getstrpar+0xcd>
add    $0x50,%rsp
pop    %rbp
ret
jmp    11a6 <getstrpar+0x46>

x86 assembly (clang, -O2):
<getstrpar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rcx,%rcx
lea    0xe82(%rip),%rax
cmove  %rax,%rcx
lea    0xe7c(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <sprintf@plt>
lea    0xe72(%rip),%r12
lea    0xe70(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1080 <testnl@plt>
mov    %eax,%ebp
test   %rbx,%rbx
je     11cf <getstrpar+0x6f>
test   %ebp,%ebp
je     11cf <getstrpar+0x6f>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebp,%ebp
je     11dc <getstrpar+0x7c>
xor    %edi,%edi
xor    %eax,%eax
call   1050 <cgetc@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
test   %eax,%eax
js     1208 <getstrpar+0xa8>
je     11b0 <getstrpar+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" \09\0A;\00"
@.str.1 = [10 x i8] c"%%%d[^%s]\00"
@.str.2 = [5 x i8] c"%s: \00"
@.str.3 = [8 x i8] c"%*[\09 ;]\00"
define void @getstrpar(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca [20 x i8]
%11 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%12 = load i8*, i8** %8
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %15
14: ; preds = %4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %8
br label %15
15: ; preds = %14, %4
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%17 = load i32, i32* %7
%18 = load i8*, i8** %8
%19 = call i32 (i8*, i8*, ...) @sprintf(i8* %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %17, i8* %18)
br label %20
20: ; preds = %15, %46
%21 = call i32 (...) @testnl()
store i32 %21, i32* %11
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load i8*, i8** %5
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i8*, i8** %5
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %26, %23, %20
%30 = load i32, i32* %11
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (i32, ...) bitcast (i32 (...)* @cgetc to i32 (i32, ...)*)(i32 0)
br label %34
34: ; preds = %32, %29
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%36 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%37 = load i8*, i8** %6
%38 = call i32 (i8*, ...) @scanf(i8* %36, i8* %37)
store i32 %38, i32* %9
%39 = load i32, i32* %9
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %34
unreachable
42: ; preds = %34
%43 = load i32, i32* %9
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %42
ret void
46: ; preds = %42
br label %20
}

LLVM IR (-O2):
@.str = [5 x i8] c" \09\0A;\00"
@.str.1 = [10 x i8] c"%%%d[^%s]\00"
@.str.2 = [5 x i8] c"%s: \00"
@.str.3 = [8 x i8] c"%*[\09 ;]\00"
define void @getstrpar(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca [20 x i8]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%7 = icmp eq i8* %3, null
%8 = select i1 %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %2, i8* %8)
%10 = icmp ne i8* %0, null
br label %11
11: ; preds = %25, %4
%12 = tail call i32 (...) @testnl()
%13 = icmp ne i32 %12, 0
%14 = and i1 %10, %13
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %17
17: ; preds = %15, %11
br i1 %13, label %18, label %20
18: ; preds = %17
%19 = tail call i32 (i32, ...) bitcast (i32 (...)* @cgetc to i32 (i32, ...)*)(i32 0)
br label %20
20: ; preds = %18, %17
%21 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* %6, i8* %1)
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
tail call void @exit(i32 1)
unreachable
25: ; preds = %20
%26 = icmp eq i32 %22, 0
br i1 %26, label %11, label %27
27: ; preds = %25
ret void
}