#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 */
int /*<<< orphan*/ printf(char *, char *);
int write_sysinfo(char *);
int write_sysinfo_fb() {
  char fn[] = "dbginfo.txt";
  int status = write_sysinfo(fn);
  if (status == 1) {
    printf("\r\nError: couldn't open %s for writing.", fn);
  }
  if (status == 0) {
    printf("\r\nWrote system information to %s.", fn);
  }
  return status;
}


x86 assembly (clang, -O0):
<write_sysinfo_fb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <write_sysinfo@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    1162 <write_sysinfo_fb+0x42>
lea    -0xc(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x10(%rbp)
jne    117c <write_sysinfo_fb+0x5c>
lea    -0xc(%rbp),%rsi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_sysinfo_fb>:
push   %rbx
sub    $0x10,%rsp
movabs $0x2e6f666e69676264,%rax
66 6f 2e
mov    %rax,(%rsp)
movl   $0x747874,0x8(%rsp)
mov    %rsp,%rdi
call   1040 <write_sysinfo@plt>
mov    %eax,%ebx
cmp    $0x1,%eax
je     1157 <write_sysinfo_fb+0x37>
test   %ebx,%ebx
jne    1166 <write_sysinfo_fb+0x46>
lea    0xede(%rip),%rdi
jmp    115e <write_sysinfo_fb+0x3e>
lea    0xeae(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.write_sysinfo_fb.fn = [12 x i8] c"dbginfo.txt\00"
@.str = [39 x i8] c"\0D\0AError: couldn't open %s for writing.\00"
@.str.1 = [34 x i8] c"\0D\0AWrote system information to %s.\00"
define i32 @write_sysinfo_fb() {
%1 = alloca [12 x i8]
%2 = alloca i32
%3 = bitcast [12 x i8]* %1 to i8*
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%5 = call i32 @write_sysinfo(i8* %4)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %0
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %14, %11
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@__const.write_sysinfo_fb.fn = [12 x i8] c"dbginfo.txt\00"
@.str = [39 x i8] c"\0D\0AError: couldn't open %s for writing.\00"
@.str.1 = [34 x i8] c"\0D\0AWrote system information to %s.\00"
define i32 @write_sysinfo_fb() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @write_sysinfo(i8* %2)
switch i32 %3, label %8 [
i32 1, label %5
i32 0, label %4
]
4: ; preds = %0
br label %5
5: ; preds = %0, %4
%6 = phi i8* [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), %0 ]
%7 = call i32 @printf(i8* %6, i8* %2)
br label %8
8: ; preds = %5, %0
ret i32 %3
}