#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 */
struct redfish_file {
  int dummy;
};
struct redfish_client {
  int dummy;
};

/* Variables and functions */
int redfish_close_and_free(struct redfish_file *);
int redfish_create(struct redfish_client *, char *, int, int /*<<< orphan*/,
                   int /*<<< orphan*/, int /*<<< orphan*/,
                   struct redfish_file **);
int redfish_open(struct redfish_client *, char *, struct redfish_file **);
int redfish_read(struct redfish_file *, char *, int);
int redfish_write(struct redfish_file *, char *, int);
int /*<<< orphan*/ stest_add_error(char *, char *, int, ...);
int strcmp(char *, char *);
int write_then_read(struct redfish_client *cli) {
  struct redfish_file *ofe;
  char ibuf[((sizeof("sample data!") / sizeof("sample data!"[0])) - 1)] =
      "sample data!";
  char obuf[((sizeof("sample data!") / sizeof("sample data!"[0])) - 1)] = {0};
  ofe = NULL;
  do {
    int __e__ = redfish_create(cli, "/test.txt", 0644, 0, 0, 0, &ofe);
    if (__e__) {
      stest_add_error(
          "failed on file %s, line %d: %s\n"
          "expected 0, got %d\n",
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/cmccabe/redfish/refs/heads/master/stest/"
          "write_then_read.c",
          37, "redfish_create(cli, STEST_FNAME, 0644, 0, 0, 0, &ofe)", __e__);
      return 1;
    }
  } while (0);
  ;
  do {
    int __e__ = redfish_write(
        ofe, ibuf, ((sizeof("sample data!") / sizeof("sample data!"[0])) - 1));
    if (__e__) {
      stest_add_error("failed on file %s, line %d: %s\n"
                      "expected 0, got %d\n",
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/cmccabe/redfish/refs/"
                      "heads/master/stest/write_then_read.c",
                      38, "redfish_write(ofe, ibuf, SAMPLE_DATA_LEN)", __e__);
      return 1;
    }
  } while (0);
  ;
  do {
    int __e__ = redfish_close_and_free(ofe);
    if (__e__) {
      stest_add_error("failed on file %s, line %d: %s\n"
                      "expected 0, got %d\n",
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/cmccabe/redfish/refs/"
                      "heads/master/stest/write_then_read.c",
                      39, "redfish_close_and_free(ofe)", __e__);
      return 1;
    }
  } while (0);
  ;
  ofe = NULL;
  do {
    int __e__ = redfish_open(cli, "/test.txt", &ofe);
    if (__e__) {
      stest_add_error("failed on file %s, line %d: %s\n"
                      "expected 0, got %d\n",
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/cmccabe/redfish/refs/"
                      "heads/master/stest/write_then_read.c",
                      41, "redfish_open(cli, STEST_FNAME, &ofe)", __e__);
      return 1;
    }
  } while (0);
  ;
  do {
    if ((redfish_read(
            ofe, obuf,
            ((sizeof("sample data!") / sizeof("sample data!"[0])) - 1))) !=
        (((sizeof("sample data!") / sizeof("sample data!"[0])) - 1))) {
      stest_add_error("failed on file %s, line %d\n",
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/cmccabe/redfish/refs/"
                      "heads/master/stest/write_then_read.c",
                      42);
      return 1;
    }
  } while (0);
  ;
  do {
    int __e__ = strcmp(ibuf, obuf);
    if (__e__) {
      stest_add_error("failed on file %s, line %d: %s\n"
                      "expected 0, got %d\n",
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/cmccabe/redfish/refs/"
                      "heads/master/stest/write_then_read.c",
                      44, "strcmp(ibuf, obuf)", __e__);
      return 1;
    }
  } while (0);
  ;
  do {
    int __e__ = redfish_close_and_free(ofe);
    if (__e__) {
      stest_add_error("failed on file %s, line %d: %s\n"
                      "expected 0, got %d\n",
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/cmccabe/redfish/refs/"
                      "heads/master/stest/write_then_read.c",
                      45, "redfish_close_and_free(ofe)", __e__);
      return 1;
    }
  } while (0);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<write_then_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    0xe6d(%rip),%rax
mov    %rax,-0x24(%rbp)
mov    0xe6b(%rip),%eax
mov    %eax,-0x1c(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe49(%rip),%rsi
mov    $0x1a4,%edx
xor    %r9d,%r9d
lea    -0x18(%rbp),%rax
mov    %r9d,%ecx
mov    %r9d,%r8d
mov    %rax,(%rsp)
call   1080 <redfish_create@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     121c <write_then_read+0x9c>
mov    -0x34(%rbp),%r8d
lea    0xe20(%rip),%rdi
lea    0xe4c(%rip),%rsi
mov    $0x25,%edx
lea    0xed4(%rip),%rcx
mov    $0x0,%al
call   1030 <stest_add_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    1426 <write_then_read+0x2a6>
jmp    1221 <write_then_read+0xa1>
jmp    1226 <write_then_read+0xa6>
mov    -0x18(%rbp),%rdi
lea    -0x24(%rbp),%rsi
mov    $0xc,%edx
call   1050 <redfish_write@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
je     1276 <write_then_read+0xf6>
mov    -0x38(%rbp),%r8d
lea    0xdc6(%rip),%rdi
lea    0xdf2(%rip),%rsi
mov    $0x26,%edx
lea    0xeb0(%rip),%rcx
mov    $0x0,%al
call   1030 <stest_add_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    1426 <write_then_read+0x2a6>
jmp    127b <write_then_read+0xfb>
jmp    1280 <write_then_read+0x100>
mov    -0x18(%rbp),%rdi
call   1090 <redfish_close_and_free@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     12c7 <write_then_read+0x147>
mov    -0x3c(%rbp),%r8d
lea    0xd75(%rip),%rdi
lea    0xda1(%rip),%rsi
mov    $0x27,%edx
lea    0xe89(%rip),%rcx
mov    $0x0,%al
call   1030 <stest_add_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    1426 <write_then_read+0x2a6>
jmp    12cc <write_then_read+0x14c>
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xd2d(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <redfish_open@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
je     1326 <write_then_read+0x1a6>
mov    -0x40(%rbp),%r8d
lea    0xd16(%rip),%rdi
lea    0xd42(%rip),%rsi
mov    $0x29,%edx
lea    0xe46(%rip),%rcx
mov    $0x0,%al
call   1030 <stest_add_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    1426 <write_then_read+0x2a6>
jmp    132b <write_then_read+0x1ab>
jmp    1330 <write_then_read+0x1b0>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   10a0 <redfish_read@plt>
cltq
cmp    $0xc,%rax
je     1374 <write_then_read+0x1f4>
lea    0xe29(%rip),%rdi
lea    0xced(%rip),%rsi
mov    $0x2a,%edx
mov    $0x0,%al
call   1030 <stest_add_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    1426 <write_then_read+0x2a6>
jmp    1379 <write_then_read+0x1f9>
jmp    137e <write_then_read+0x1fe>
lea    -0x24(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1070 <strcmp@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     13c9 <write_then_read+0x249>
mov    -0x44(%rbp),%r8d
lea    0xc73(%rip),%rdi
lea    0xc9f(%rip),%rsi
mov    $0x2c,%edx
lea    0xde4(%rip),%rcx
mov    $0x0,%al
call   1030 <stest_add_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    1426 <write_then_read+0x2a6>
jmp    13ce <write_then_read+0x24e>
jmp    13d3 <write_then_read+0x253>
mov    -0x18(%rbp),%rdi
call   1090 <redfish_close_and_free@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
je     141a <write_then_read+0x29a>
mov    -0x48(%rbp),%r8d
lea    0xc22(%rip),%rdi
lea    0xc4e(%rip),%rsi
mov    $0x2d,%edx
lea    0xd36(%rip),%rcx
mov    $0x0,%al
call   1030 <stest_add_error@plt>
movl   $0x1,-0x4(%rbp)
jmp    1426 <write_then_read+0x2a6>
jmp    141f <write_then_read+0x29f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_then_read>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
movabs $0x6420656c706d6173,%rax
65 20 64
mov    %rax,0x20(%rsp)
movl   $0x21617461,0x28(%rsp)
21
movl   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rax
mov    %rax,(%rsp)
lea    0xe53(%rip),%rsi
mov    $0x1a4,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1070 <redfish_create@plt>
test   %eax,%eax
je     11ee <write_then_read+0x7e>
lea    0xe40(%rip),%rdi
lea    0xe6c(%rip),%rsi
lea    0xef9(%rip),%rcx
mov    $0x25,%edx
jmp    1287 <write_then_read+0x117>
mov    0x8(%rsp),%rdi
lea    0x20(%rsp),%rsi
mov    $0xc,%edx
call   1050 <redfish_write@plt>
test   %eax,%eax
je     1222 <write_then_read+0xb2>
lea    0xe09(%rip),%rdi
lea    0xe35(%rip),%rsi
lea    0xef8(%rip),%rcx
mov    $0x26,%edx
jmp    1287 <write_then_read+0x117>
mov    0x8(%rsp),%rdi
call   1080 <redfish_close_and_free@plt>
test   %eax,%eax
je     124c <write_then_read+0xdc>
lea    0xddf(%rip),%rdi
lea    0xe0b(%rip),%rsi
lea    0xef8(%rip),%rcx
mov    $0x27,%edx
jmp    1287 <write_then_read+0x117>
movq   $0x0,0x8(%rsp)
lea    0xdb0(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <redfish_open@plt>
test   %eax,%eax
je     129c <write_then_read+0x12c>
lea    0xda2(%rip),%rdi
lea    0xdce(%rip),%rsi
lea    0xed7(%rip),%rcx
mov    $0x29,%edx
mov    %eax,%r8d
xor    %eax,%eax
call   1030 <stest_add_error@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbx
ret
mov    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    $0xc,%edx
call   1090 <redfish_read@plt>
cmp    $0xc,%eax
jne    12e4 <write_then_read+0x174>
lea    0x20(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1300 <write_then_read+0x190>
lea    0xd47(%rip),%rdi
lea    0xd73(%rip),%rsi
lea    0xebd(%rip),%rcx
mov    $0x2c,%edx
jmp    1287 <write_then_read+0x117>
lea    0xe93(%rip),%rdi
lea    0xd57(%rip),%rsi
mov    $0x2a,%edx
xor    %eax,%eax
call   1030 <stest_add_error@plt>
jmp    1291 <write_then_read+0x121>
mov    0x8(%rsp),%rdi
call   1080 <redfish_close_and_free@plt>
mov    %eax,%ebx
test   %eax,%eax
je     1334 <write_then_read+0x1c4>
lea    0xcff(%rip),%rdi
lea    0xd2b(%rip),%rsi
lea    0xe18(%rip),%rcx
mov    $0x2d,%edx
mov    %ebx,%r8d
xor    %eax,%eax
call   1030 <stest_add_error@plt>
xor    %eax,%eax
test   %ebx,%ebx
setne  %al
jmp    1296 <write_then_read+0x126>

LLVM IR (-O0):
%struct.redfish_client = type { i32 }
%struct.redfish_file = type { i32 }
@__const.write_then_read.ibuf = [12 x i8] c"sample data!"
@.str = [10 x i8] c"/test.txt\00"
@.str.1 = [51 x i8] c"failed on file %s, line %d: %s\0Aexpected 0, got %d\0A\00"
@.str.2 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cmccabe/redfish/refs/heads/master/stest/write_then_read.c\00"
@.str.3 = [54 x i8] c"redfish_create(cli, STEST_FNAME, 0644, 0, 0, 0, &ofe)\00"
@.str.4 = [42 x i8] c"redfish_write(ofe, ibuf, SAMPLE_DATA_LEN)\00"
@.str.5 = [28 x i8] c"redfish_close_and_free(ofe)\00"
@.str.6 = [37 x i8] c"redfish_open(cli, STEST_FNAME, &ofe)\00"
@.str.7 = [28 x i8] c"failed on file %s, line %d\0A\00"
@.str.8 = [19 x i8] c"strcmp(ibuf, obuf)\00"
define i32 @write_then_read(%struct.redfish_client* %0) {
%2 = alloca i32
%3 = alloca %struct.redfish_client*
%4 = alloca %struct.redfish_file*
%5 = alloca [12 x i8]
%6 = alloca [12 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store %struct.redfish_client* %0, %struct.redfish_client** %3
%13 = bitcast [12 x i8]* %5 to i8*
%14 = bitcast [12 x i8]* %6 to i8*
store %struct.redfish_file* null, %struct.redfish_file** %4
br label %15
15: ; preds = %1
%16 = load %struct.redfish_client*, %struct.redfish_client** %3
%17 = call i32 @redfish_create(%struct.redfish_client* %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 420, i32 0, i32 0, i32 0, %struct.redfish_file** %4)
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i32, i32* %7
%22 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 37, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %21)
store i32 1, i32* %2
br label %87
23: ; preds = %15
br label %24
24: ; preds = %23
br label %25
25: ; preds = %24
%26 = load %struct.redfish_file*, %struct.redfish_file** %4
%27 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%28 = call i32 @redfish_write(%struct.redfish_file* %26, i8* %27, i32 12)
store i32 %28, i32* %8
%29 = load i32, i32* %8
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = load i32, i32* %8
%33 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 38, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i32 %32)
store i32 1, i32* %2
br label %87
34: ; preds = %25
br label %35
35: ; preds = %34
br label %36
36: ; preds = %35
%37 = load %struct.redfish_file*, %struct.redfish_file** %4
%38 = call i32 @redfish_close_and_free(%struct.redfish_file* %37)
store i32 %38, i32* %9
%39 = load i32, i32* %9
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %36
%42 = load i32, i32* %9
%43 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 39, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %42)
store i32 1, i32* %2
br label %87
44: ; preds = %36
br label %45
45: ; preds = %44
store %struct.redfish_file* null, %struct.redfish_file** %4
br label %46
46: ; preds = %45
%47 = load %struct.redfish_client*, %struct.redfish_client** %3
%48 = call i32 @redfish_open(%struct.redfish_client* %47, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.redfish_file** %4)
store i32 %48, i32* %10
%49 = load i32, i32* %10
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = load i32, i32* %10
%53 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 41, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 %52)
store i32 1, i32* %2
br label %87
54: ; preds = %46
br label %55
55: ; preds = %54
br label %56
56: ; preds = %55
%57 = load %struct.redfish_file*, %struct.redfish_file** %4
%58 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%59 = call i32 @redfish_read(%struct.redfish_file* %57, i8* %58, i32 12)
%60 = sext i32 %59 to i64
%61 = icmp ne i64 %60, 12
br i1 %61, label %62, label %64
62: ; preds = %56
%63 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 42)
store i32 1, i32* %2
br label %87
64: ; preds = %56
br label %65
65: ; preds = %64
br label %66
66: ; preds = %65
%67 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%68 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%69 = call i32 @strcmp(i8* %67, i8* %68)
store i32 %69, i32* %11
%70 = load i32, i32* %11
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %66
%73 = load i32, i32* %11
%74 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 44, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %73)
store i32 1, i32* %2
br label %87
75: ; preds = %66
br label %76
76: ; preds = %75
br label %77
77: ; preds = %76
%78 = load %struct.redfish_file*, %struct.redfish_file** %4
%79 = call i32 @redfish_close_and_free(%struct.redfish_file* %78)
store i32 %79, i32* %12
%80 = load i32, i32* %12
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %77
%83 = load i32, i32* %12
%84 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %83)
store i32 1, i32* %2
br label %87
85: ; preds = %77
br label %86
86: ; preds = %85
store i32 0, i32* %2
br label %87
87: ; preds = %86, %82, %72, %62, %51, %41, %31, %20
%88 = load i32, i32* %2
ret i32 %88
}

LLVM IR (-O2):
%struct.redfish_client = type { i32 }
%struct.redfish_file = type { i32 }
@__const.write_then_read.ibuf = [12 x i8] c"sample data!"
@.str = [10 x i8] c"/test.txt\00"
@.str.1 = [51 x i8] c"failed on file %s, line %d: %s\0Aexpected 0, got %d\0A\00"
@.str.2 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cmccabe/redfish/refs/heads/master/stest/write_then_read.c\00"
@.str.3 = [54 x i8] c"redfish_create(cli, STEST_FNAME, 0644, 0, 0, 0, &ofe)\00"
@.str.4 = [42 x i8] c"redfish_write(ofe, ibuf, SAMPLE_DATA_LEN)\00"
@.str.5 = [28 x i8] c"redfish_close_and_free(ofe)\00"
@.str.6 = [37 x i8] c"redfish_open(cli, STEST_FNAME, &ofe)\00"
@.str.7 = [28 x i8] c"failed on file %s, line %d\0A\00"
@.str.8 = [19 x i8] c"strcmp(ibuf, obuf)\00"
define i32 @write_then_read(%struct.redfish_client* %0) {
%2 = alloca %struct.redfish_file*
%3 = alloca [12 x i8]
%4 = alloca [12 x i8]
%5 = bitcast %struct.redfish_file** %2 to i8*
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
store %struct.redfish_file* null, %struct.redfish_file** %2
%8 = call i32 @redfish_create(%struct.redfish_client* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 420, i32 0, i32 0, i32 0, %struct.redfish_file** %2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 37, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %8)
br label %49
12: ; preds = %1
%13 = load %struct.redfish_file*, %struct.redfish_file** %2
%14 = call i32 @redfish_write(%struct.redfish_file* %13, i8* %6, i32 12)
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 38, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i32 %14)
br label %49
18: ; preds = %12
%19 = load %struct.redfish_file*, %struct.redfish_file** %2
%20 = call i32 @redfish_close_and_free(%struct.redfish_file* %19)
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %18
%23 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 39, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %20)
br label %49
24: ; preds = %18
store %struct.redfish_file* null, %struct.redfish_file** %2
%25 = call i32 @redfish_open(%struct.redfish_client* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.redfish_file** %2)
%26 = icmp eq i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %24
%28 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 41, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 %25)
br label %49
29: ; preds = %24
%30 = load %struct.redfish_file*, %struct.redfish_file** %2
%31 = call i32 @redfish_read(%struct.redfish_file* %30, i8* %7, i32 12)
%32 = icmp eq i32 %31, 12
br i1 %32, label %35, label %33
33: ; preds = %29
%34 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 42)
br label %49
35: ; preds = %29
%36 = call i32 @strcmp(i8* %6, i8* %7)
%37 = icmp eq i32 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %35
%39 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 44, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %36)
br label %49
40: ; preds = %35
%41 = load %struct.redfish_file*, %struct.redfish_file** %2
%42 = call i32 @redfish_close_and_free(%struct.redfish_file* %41)
%43 = icmp eq i32 %42, 0
br i1 %43, label %46, label %44
44: ; preds = %40
%45 = call i32 (i8*, i8*, i32, ...) @stest_add_error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %42)
br label %46
46: ; preds = %40, %44
%47 = xor i1 %43, true
%48 = zext i1 %47 to i32
br label %49
49: ; preds = %46, %38, %27, %22, %16, %10, %33
%50 = phi i32 [ 1, %33 ], [ 1, %38 ], [ 1, %27 ], [ 1, %22 ], [ 1, %16 ], [ 1, %10 ], [ %48, %46 ]
ret i32 %50
}