#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*/ buffer;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
scalar_t__ set_opts(char *);
int /*<<< orphan*/ stderr;
int strlen(char *);
void parse_opt_file(FILE *fp) {
  char buffer[256];
  int line_num = 0;
  while (NULL != fgets(buffer, sizeof(buffer), fp)) {
    line_num++;
    if ('#' == buffer[0]) {
      ;
    } else {
      if ('\n' == buffer[strlen(buffer) - 1])
        buffer[strlen(buffer) - 1] = '\0';
      if (0 != set_opts(buffer))
        fprintf(stderr, "%d: warning: error processing option file\n",
                line_num);
    }
  }
}


x86 assembly (clang, -O0):
<parse_opt_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x114(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1222 <parse_opt_file+0xe2>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
movsbl -0x110(%rbp),%ecx
mov    $0x23,%eax
cmp    %ecx,%eax
jne    11a4 <parse_opt_file+0x64>
jmp    121d <parse_opt_file+0xdd>
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%ecx
ff
mov    $0xa,%eax
cmp    %ecx,%eax
jne    11e3 <parse_opt_file+0xa3>
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x110(%rbp,%rax,1)
lea    -0x110(%rbp),%rdi
call   1060 <set_opts@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1218 <parse_opt_file+0xd8>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
mov    -0x114(%rbp),%edx
lea    0xded(%rip),%rsi
call   1050 <fprintf@plt>
jmp    121d <parse_opt_file+0xdd>
jmp    1159 <parse_opt_file+0x19>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_opt_file>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     11db <parse_opt_file+0x9b>
mov    $0x1,%ebp
mov    0x2e6a(%rip),%r12
lea    0xe83(%rip),%r15
jmp    1198 <parse_opt_file+0x58>
nop
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
add    $0x1,%ebp
test   %rax,%rax
je     11db <parse_opt_file+0x9b>
cmpb   $0x23,(%rsp)
je     1180 <parse_opt_file+0x40>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    11be <parse_opt_file+0x7e>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
call   1060 <set_opts@plt>
test   %rax,%rax
je     1180 <parse_opt_file+0x40>
mov    (%r12),%edi
mov    %r15,%rsi
mov    %ebp,%edx
call   1050 <fprintf@plt>
jmp    1180 <parse_opt_file+0x40>
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"%d: warning: error processing option file\0A\00"
define void @parse_opt_file(i32* %0) {
%2 = alloca i32*
%3 = alloca [256 x i8]
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %4
br label %5
5: ; preds = %42, %1
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = load i32*, i32** %2
%8 = call i32* @fgets(i8* %6, i32 256, i32* %7)
%9 = icmp ne i32* null, %8
br i1 %9, label %10, label %43
10: ; preds = %5
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 35, %15
br i1 %16, label %17, label %18
17: ; preds = %10
br label %42
18: ; preds = %10
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 10, %25
br i1 %26, label %27, label %33
27: ; preds = %18
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%29 = call i32 @strlen(i8* %28)
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %31
store i8 0, i8* %32
br label %33
33: ; preds = %27, %18
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%35 = call i64 @set_opts(i8* %34)
%36 = icmp ne i64 0, %35
br i1 %36, label %37, label %41
37: ; preds = %33
%38 = load i32, i32* @stderr
%39 = load i32, i32* %4
%40 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %37, %33
br label %42
42: ; preds = %41, %17
br label %5
43: ; preds = %5
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"%d: warning: error processing option file\0A\00"
define void @parse_opt_file(i32* nocapture %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32* @fgets(i8* %3, i32 256, i32* %0)
%5 = icmp eq i32* %4, null
br i1 %5, label %32, label %6
6: ; preds = %1, %29
%7 = phi i32 [ %8, %29 ], [ 0, %1 ]
%8 = add nuw nsw i32 %7, 1
%9 = load i8, i8* %3
%10 = icmp eq i8 %9, 35
br i1 %10, label %29, label %11
11: ; preds = %6
%12 = call i32 @strlen(i8* %3)
%13 = add nsw i32 %12, -1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 10
br i1 %17, label %18, label %23
18: ; preds = %11
%19 = call i32 @strlen(i8* %3)
%20 = add nsw i32 %19, -1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %21
store i8 0, i8* %22
br label %23
23: ; preds = %18, %11
%24 = call i64 @set_opts(i8* %3)
%25 = icmp eq i64 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %29
29: ; preds = %23, %26, %6
%30 = call i32* @fgets(i8* %3, i32 256, i32* %0)
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %6
32: ; preds = %29, %1
ret void
}