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

/* Variables and functions */
int /*<<< orphan*/ add_comment(char *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free_comments();
int /*<<< orphan*/ keep_orig_comments();
int /*<<< orphan*/ sprintf(char *, char *, char *);
void new_comment(FILE *f) {
  char bob[256];
  char ted[256];
  keep_orig_comments();
  free_comments();
  while (!feof(f)) {
    fgets(bob, 256, f);
    sprintf(ted, "@%s", bob);
    add_comment(ted);
  }
}


x86 assembly (clang, -O0):
<new_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1080 <keep_orig_comments@plt>
mov    $0x0,%al
call   1050 <free_comments@plt>
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    119b <new_comment+0x3b>
jmp    11db <new_comment+0x7b>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
lea    -0x210(%rbp),%rdi
lea    -0x110(%rbp),%rdx
lea    0xe3b(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x210(%rbp),%rdi
call   1070 <add_comment@plt>
jmp    117d <new_comment+0x1d>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_comment>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x208,%rsp
mov    %rdi,%rbx
xor    %eax,%eax
call   1080 <keep_orig_comments@plt>
xor    %eax,%eax
call   1050 <free_comments@plt>
mov    %rbx,%rdi
call   1040 <feof@plt>
test   %eax,%eax
jne    11d2 <new_comment+0x72>
lea    0x100(%rsp),%r14
lea    0xe66(%rip),%r15
mov    %rsp,%r12
nopl   (%rax)
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1060 <sprintf@plt>
mov    %r12,%rdi
call   1070 <add_comment@plt>
mov    %rbx,%rdi
call   1040 <feof@plt>
test   %eax,%eax
je     11a0 <new_comment+0x40>
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"@%s\00"
define void @new_comment(i32* %0) {
%2 = alloca i32*
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
store i32* %0, i32** %2
%5 = call i32 (...) @keep_orig_comments()
%6 = call i32 (...) @free_comments()
br label %7
7: ; preds = %12, %1
%8 = load i32*, i32** %2
%9 = call i32 @feof(i32* %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br i1 %11, label %12, label %21
12: ; preds = %7
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%14 = load i32*, i32** %2
%15 = call i32 @fgets(i8* %13, i32 256, i32* %14)
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%18 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%20 = call i32 @add_comment(i8* %19)
br label %7
21: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"@%s\00"
define void @new_comment(i32* nocapture %0) {
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = tail call i32 (...) @keep_orig_comments()
%7 = tail call i32 (...) @free_comments()
%8 = call i32 @feof(i32* %0)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %1, %10
%11 = call i32 @fgets(i8* %4, i32 256, i32* %0)
%12 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%13 = call i32 @add_comment(i8* %5)
%14 = call i32 @feof(i32* %0)
%15 = icmp eq i32 %14, 0
br i1 %15, label %10, label %16
16: ; preds = %10, %1
ret void
}