#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__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
main() {
  char buf[256];
  int count = 0;
  while (fgets(buf, 256, stdin) > 0) {
    double p;
    if (buf[0] == ';' || buf[0] == '\r' || buf[0] == '\n')
      continue;
    printf("%s,\n", buf);
    count++;
    if (count == (512 / 2))
      break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x114(%rbp)
lea    -0x110(%rbp),%rdi
mov    0x2e9e(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
jle    11d1 <main+0xb1>
movsbl -0x110(%rbp),%eax
cmp    $0x3b,%eax
je     1190 <main+0x70>
movsbl -0x110(%rbp),%eax
cmp    $0xd,%eax
je     1190 <main+0x70>
movsbl -0x110(%rbp),%eax
cmp    $0xa,%eax
jne    1195 <main+0x75>
jmp    113c <main+0x1c>
lea    -0x110(%rbp),%rsi
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
cmpl   $0x100,-0x114(%rbp)
jne    11cc <main+0xac>
jmp    11d1 <main+0xb1>
jmp    113c <main+0x1c>
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    0x2eb2(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%rdi
mov    $0x100,%esi
call   1040 <fgets@plt>
test   %rax,%rax
jle    11ad <main+0x8d>
xor    %ebp,%ebp
lea    0xeac(%rip),%r14
mov    %rsp,%rbx
movabs $0x800000000002400,%r12
jmp    119b <main+0x7b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
je     11ad <main+0x8d>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1040 <fgets@plt>
test   %rax,%rax
jle    11ad <main+0x8d>
movzbl (%rsp),%eax
cmp    $0x3b,%rax
ja     1170 <main+0x50>
bt     %rax,%r12
jb     1186 <main+0x66>
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [5 x i8] c"%s,\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %34, %25, %0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i64 @fgets(i8* %6, i32 256, i32 %7)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %10, label %35
10: ; preds = %5
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 59
br i1 %14, label %25, label %15
15: ; preds = %10
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 13
br i1 %19, label %25, label %20
20: ; preds = %15
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 10
br i1 %24, label %25, label %26
25: ; preds = %20, %15, %10
br label %5
26: ; preds = %20
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%28 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
%31 = load i32, i32* %3
%32 = icmp eq i32 %31, 256
br i1 %32, label %33, label %34
33: ; preds = %26
br label %35
34: ; preds = %26
br label %5
35: ; preds = %33, %5
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [5 x i8] c"%s,\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i64 @fgets(i8* %2, i32 256, i32 %3)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %18
6: ; preds = %0, %13
%7 = phi i32 [ %14, %13 ], [ 0, %0 ]
%8 = load i8, i8* %2
switch i8 %8, label %9 [
i8 59, label %13
i8 13, label %13
i8 10, label %13
]
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2)
%11 = add nsw i32 %7, 1
%12 = icmp eq i32 %11, 256
br i1 %12, label %18, label %13
13: ; preds = %9, %6, %6, %6
%14 = phi i32 [ %7, %6 ], [ %7, %6 ], [ %7, %6 ], [ %11, %9 ]
%15 = load i32, i32* @stdin
%16 = call i64 @fgets(i8* %2, i32 256, i32 %15)
%17 = icmp sgt i64 %16, 0
br i1 %17, label %6, label %18
18: ; preds = %13, %9, %0
ret i32 0
}