#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 u_long;
struct __res_state {
  int options;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
struct __res_state _res;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
char *p_option(int);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
void fp_resstat(struct __res_state *statp, FILE *file) {
  u_long mask;
  fprintf(file, ";; res options:");
  if (!statp)
    statp = &_res;
  for (mask = 1; mask != 0; mask <<= 1)
    if (statp->options & mask)
      fprintf(file, " %s", p_option(mask));
  putc('\n', file);
}


x86 assembly (clang, -O0):
<fp_resstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
cmpq   $0x0,-0x8(%rbp)
jne    1168 <fp_resstat+0x38>
mov    0x2e84(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11c3 <fp_resstat+0x93>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    -0x14(%rbp),%eax
cmp    $0x0,%eax
je     11b0 <fp_resstat+0x80>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <p_option@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rdx
lea    0xe67(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    11b5 <fp_resstat+0x85>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116f <fp_resstat+0x3f>
mov    -0x10(%rbp),%rsi
mov    $0xa,%edi
call   1040 <putc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fp_resstat>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeac(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1060 <fwrite@plt>
test   %rbx,%rbx
jne    1172 <fp_resstat+0x32>
mov    0x2e76(%rip),%rbx
mov    $0x1,%ebp
lea    0xe92(%rip),%r15
jmp    1184 <fp_resstat+0x44>
add    %ebp,%ebp
je     11a1 <fp_resstat+0x61>
test   %ebp,(%rbx)
je     1180 <fp_resstat+0x40>
mov    %ebp,%edi
call   1030 <p_option@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1180 <fp_resstat+0x40>
mov    $0xa,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <putc@plt>

LLVM IR (-O0):
%struct.__res_state = type { i32 }
@.str = [16 x i8] c";; res options:\00"
@_res = global %struct.__res_state zeroinitializer
@.str.1 = [4 x i8] c" %s\00"
define void @fp_resstat(%struct.__res_state* %0, i32* %1) {
%3 = alloca %struct.__res_state*
%4 = alloca i32*
%5 = alloca i32
store %struct.__res_state* %0, %struct.__res_state** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = load %struct.__res_state*, %struct.__res_state** %3
%9 = icmp ne %struct.__res_state* %8, null
br i1 %9, label %11, label %10
10: ; preds = %2
store %struct.__res_state* @_res, %struct.__res_state** %3
br label %11
11: ; preds = %10, %2
store i32 1, i32* %5
br label %12
12: ; preds = %28, %11
%13 = load i32, i32* %5
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %31
15: ; preds = %12
%16 = load %struct.__res_state*, %struct.__res_state** %3
%17 = getelementptr inbounds %struct.__res_state, %struct.__res_state* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = load i32, i32* %5
%20 = and i32 %18, %19
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %15
%23 = load i32*, i32** %4
%24 = load i32, i32* %5
%25 = call i8* @p_option(i32 %24)
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %22, %15
br label %28
28: ; preds = %27
%29 = load i32, i32* %5
%30 = shl i32 %29, 1
store i32 %30, i32* %5
br label %12
31: ; preds = %12
%32 = load i32*, i32** %4
%33 = call i32 @putc(i8 signext 10, i32* %32)
ret void
}

LLVM IR (-O2):
%struct.__res_state = type { i32 }
@.str = [16 x i8] c";; res options:\00"
@_res = global %struct.__res_state zeroinitializer
@.str.1 = [4 x i8] c" %s\00"
define void @fp_resstat(%struct.__res_state* %0, i32* nocapture %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 15, i64 1, i32* %1)
%4 = icmp eq %struct.__res_state* %0, null
%5 = select i1 %4, %struct.__res_state* @_res, %struct.__res_state* %0
%6 = getelementptr inbounds %struct.__res_state, %struct.__res_state* %5, i64 0, i32 0
br label %7
7: ; preds = %2, %15
%8 = phi i32 [ 1, %2 ], [ %16, %15 ]
%9 = load i32, i32* %6
%10 = and i32 %9, %8
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = tail call i8* @p_option(i32 %8)
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %7, %12
%16 = shl i32 %8, 1
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %7
18: ; preds = %15
%19 = tail call i32 @putc(i8 signext 10, i32* %1)
ret void
}