#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 */

/* Variables and functions */
scalar_t__ isspace(unsigned char);
int nntpreply();
int /*<<< orphan*/ putaline(char *, char *);
char *strchr(char *, char);
int isgrouponserver(char *newsgroups) {
  char *p, *q;
  int retval;
  if (!newsgroups)
    return 0;
  retval = 0;
  p = newsgroups;
  do {
    while (*(p) && isspace((unsigned char)*(p))) {
      (p)++;
    };
    q = strchr(p, ',');
    if (q)
      *q++ = '\0';
    putaline("GROUP %s", p);
    if (nntpreply() == 211)
      retval = 1;
    p = q;
  } while (q && !retval);
  return retval;
}


x86 assembly (clang, -O0):
<isgrouponserver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1163 <isgrouponserver+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1250 <isgrouponserver+0x110>
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1177 <isgrouponserver+0x37>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x25(%rbp)
je     11a2 <isgrouponserver+0x62>
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    11b2 <isgrouponserver+0x72>
jmp    11c3 <isgrouponserver+0x83>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1177 <isgrouponserver+0x37>
mov    -0x18(%rbp),%rdi
mov    $0x2c,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11f2 <isgrouponserver+0xb2>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rsi
lea    0xe03(%rip),%rdi
call   1050 <putaline@plt>
mov    $0x0,%al
call   1060 <nntpreply@plt>
cmp    $0xd3,%eax
jne    121b <isgrouponserver+0xdb>
movl   $0x1,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x26(%rbp)
je     123f <isgrouponserver+0xff>
cmpl   $0x0,-0x24(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x26(%rbp)
mov    -0x26(%rbp),%al
test   $0x1,%al
jne    1172 <isgrouponserver+0x32>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isgrouponserver>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     11dd <isgrouponserver+0x9d>
mov    %rdi,%r15
lea    0xea8(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15),%al
mov    %r15,%rbx
test   %al,%al
je     1189 <isgrouponserver+0x49>
nopw   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1189 <isgrouponserver+0x49>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1170 <isgrouponserver+0x30>
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     11b0 <isgrouponserver+0x70>
mov    %rax,%r15
add    $0x1,%r15
movb   $0x0,(%rax)
jmp    11b3 <isgrouponserver+0x73>
nopw   0x0(%rax,%rax,1)
xor    %r15d,%r15d
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <putaline@plt>
xor    %eax,%eax
call   1060 <nntpreply@plt>
test   %r15,%r15
je     11d1 <isgrouponserver+0x91>
cmp    $0xd3,%eax
jne    1160 <isgrouponserver+0x20>
xor    %ecx,%ecx
cmp    $0xd3,%eax
sete   %cl
jmp    11df <isgrouponserver+0x9f>
xor    %ecx,%ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"GROUP %s\00"
define i32 @isgrouponserver(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %1
store i32 0, i32* %2
br label %55
10: ; preds = %1
store i32 0, i32* %6
%11 = load i8*, i8** %3
store i8* %11, i8** %4
br label %12
12: ; preds = %51, %10
br label %13
13: ; preds = %25, %12
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %13
%19 = load i8*, i8** %4
%20 = load i8, i8* %19
%21 = call i64 @isspace(i8 zeroext %20)
%22 = icmp ne i64 %21, 0
br label %23
23: ; preds = %18, %13
%24 = phi i1 [ false, %13 ], [ %22, %18 ]
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %4
br label %13
28: ; preds = %23
%29 = load i8*, i8** %4
%30 = call i8* @strchr(i8* %29, i8 signext 44)
store i8* %30, i8** %5
%31 = load i8*, i8** %5
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %5
store i8 0, i8* %34
br label %36
36: ; preds = %33, %28
%37 = load i8*, i8** %4
%38 = call i32 @putaline(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %37)
%39 = call i32 (...) @nntpreply()
%40 = icmp eq i32 %39, 211
br i1 %40, label %41, label %42
41: ; preds = %36
store i32 1, i32* %6
br label %42
42: ; preds = %41, %36
%43 = load i8*, i8** %5
store i8* %43, i8** %4
br label %44
44: ; preds = %42
%45 = load i8*, i8** %5
%46 = icmp ne i8* %45, null
br i1 %46, label %47, label %51
47: ; preds = %44
%48 = load i32, i32* %6
%49 = icmp ne i32 %48, 0
%50 = xor i1 %49, true
br label %51
51: ; preds = %47, %44
%52 = phi i1 [ false, %44 ], [ %50, %47 ]
br i1 %52, label %12, label %53
53: ; preds = %51
%54 = load i32, i32* %6
store i32 %54, i32* %2
br label %55
55: ; preds = %53, %9
%56 = load i32, i32* %2
ret i32 %56
}

LLVM IR (-O2):
@.str = [9 x i8] c"GROUP %s\00"
define i32 @isgrouponserver(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %32, label %3
3: ; preds = %1, %22
%4 = phi i8* [ %23, %22 ], [ %0, %1 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %3, %12
%8 = phi i8 [ %14, %12 ], [ %5, %3 ]
%9 = phi i8* [ %13, %12 ], [ %4, %3 ]
%10 = tail call i64 @isspace(i8 zeroext %8)
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %7
%13 = getelementptr inbounds i8, i8* %9, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %7, %12, %3
%17 = phi i8* [ %4, %3 ], [ %13, %12 ], [ %9, %7 ]
%18 = tail call i8* @strchr(i8* %17, i8 signext 44)
%19 = icmp eq i8* %18, null
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = getelementptr inbounds i8, i8* %18, i64 1
store i8 0, i8* %18
br label %22
22: ; preds = %20, %16
%23 = phi i8* [ %21, %20 ], [ null, %16 ]
%24 = tail call i32 @putaline(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %17)
%25 = tail call i32 (...) @nntpreply()
%26 = icmp eq i32 %25, 211
%27 = icmp ne i8* %23, null
%28 = xor i1 %26, true
%29 = select i1 %27, i1 %28, i1 false
br i1 %29, label %3, label %30
30: ; preds = %22
%31 = zext i1 %26 to i32
br label %32
32: ; preds = %30, %1
%33 = phi i32 [ 0, %1 ], [ %31, %30 ]
ret i32 %33
}