#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*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
unsigned int sis32toh(unsigned int);
scalar_t__ sisRead(int /*<<< orphan*/ *, unsigned int *, int, char *, int);
char *sisReadOffsetAlloc(int /*<<< orphan*/ *, unsigned int, unsigned int,
                         char *, int);
int /*<<< orphan*/ uni2ascii(char *, unsigned int);
int condString(FILE *fp, char *err, int errlen) {
  unsigned int len, off;
  char *str;
  if (sisRead(fp, &len, 4, err, errlen))
    return 1;
  if (sisRead(fp, &off, 4, err, errlen))
    return 1;
  len = sis32toh(len);
  off = sis32toh(off);
  if ((str = sisReadOffsetAlloc(fp, len, off, err, errlen)) == NULL)
    return 1;
  uni2ascii(str, len);
  printf("%s", str);
  free(str);
  return 0;
}


x86 assembly (clang, -O0):
<condString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1070 <sisRead@plt>
cmp    $0x0,%rax
je     11a3 <condString+0x43>
movl   $0x1,-0x4(%rbp)
jmp    1246 <condString+0xe6>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
call   1070 <sisRead@plt>
cmp    $0x0,%rax
je     11d3 <condString+0x73>
movl   $0x1,-0x4(%rbp)
jmp    1246 <condString+0xe6>
mov    -0x20(%rbp),%edi
call   1040 <sis32toh@plt>
mov    %eax,-0x20(%rbp)
mov    -0x24(%rbp),%edi
call   1040 <sis32toh@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1080 <sisReadOffsetAlloc@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    121a <condString+0xba>
movl   $0x1,-0x4(%rbp)
jmp    1246 <condString+0xe6>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1060 <uni2ascii@plt>
mov    -0x30(%rbp),%rsi
lea    0xdcf(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<condString>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rsp,%rsi
mov    $0x4,%edx
mov    %rbx,%rcx
mov    %r15d,%r8d
call   1070 <sisRead@plt>
mov    $0x1,%r14d
test   %rax,%rax
jne    1203 <condString+0xa3>
lea    0x4(%rsp),%rsi
mov    %rbp,%rdi
mov    $0x4,%edx
mov    %rbx,%rcx
mov    %r15d,%r8d
call   1070 <sisRead@plt>
test   %rax,%rax
jne    1203 <condString+0xa3>
mov    (%rsp),%edi
call   1040 <sis32toh@plt>
mov    %eax,(%rsp)
mov    0x4(%rsp),%edi
call   1040 <sis32toh@plt>
mov    %eax,0x4(%rsp)
mov    (%rsp),%esi
mov    %rbp,%rdi
mov    %eax,%edx
mov    %rbx,%rcx
mov    %r15d,%r8d
call   1080 <sisReadOffsetAlloc@plt>
test   %rax,%rax
je     1203 <condString+0xa3>
mov    %rax,%rbx
mov    (%rsp),%esi
mov    %rax,%rdi
call   1060 <uni2ascii@plt>
lea    0xe10(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @condString(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%11 = load i32*, i32** %5
%12 = load i8*, i8** %6
%13 = load i32, i32* %7
%14 = call i64 @sisRead(i32* %11, i32* %8, i32 4, i8* %12, i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %3
store i32 1, i32* %4
br label %45
17: ; preds = %3
%18 = load i32*, i32** %5
%19 = load i8*, i8** %6
%20 = load i32, i32* %7
%21 = call i64 @sisRead(i32* %18, i32* %9, i32 4, i8* %19, i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 1, i32* %4
br label %45
24: ; preds = %17
%25 = load i32, i32* %8
%26 = call i32 @sis32toh(i32 %25)
store i32 %26, i32* %8
%27 = load i32, i32* %9
%28 = call i32 @sis32toh(i32 %27)
store i32 %28, i32* %9
%29 = load i32*, i32** %5
%30 = load i32, i32* %8
%31 = load i32, i32* %9
%32 = load i8*, i8** %6
%33 = load i32, i32* %7
%34 = call i8* @sisReadOffsetAlloc(i32* %29, i32 %30, i32 %31, i8* %32, i32 %33)
store i8* %34, i8** %10
%35 = icmp eq i8* %34, null
br i1 %35, label %36, label %37
36: ; preds = %24
store i32 1, i32* %4
br label %45
37: ; preds = %24
%38 = load i8*, i8** %10
%39 = load i32, i32* %8
%40 = call i32 @uni2ascii(i8* %38, i32 %39)
%41 = load i8*, i8** %10
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %41)
%43 = load i8*, i8** %10
%44 = call i32 @free(i8* %43)
store i32 0, i32* %4
br label %45
45: ; preds = %37, %36, %23, %16
%46 = load i32, i32* %4
ret i32 %46
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @condString(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = call i64 @sisRead(i32* %0, i32* %4, i32 4, i8* %1, i32 %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %26
10: ; preds = %3
%11 = call i64 @sisRead(i32* %0, i32* %5, i32 4, i8* %1, i32 %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %4
%15 = call i32 @sis32toh(i32 %14)
store i32 %15, i32* %4
%16 = load i32, i32* %5
%17 = call i32 @sis32toh(i32 %16)
store i32 %17, i32* %5
%18 = load i32, i32* %4
%19 = call i8* @sisReadOffsetAlloc(i32* %0, i32 %18, i32 %17, i8* %1, i32 %2)
%20 = icmp eq i8* %19, null
br i1 %20, label %26, label %21
21: ; preds = %13
%22 = load i32, i32* %4
%23 = call i32 @uni2ascii(i8* %19, i32 %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %19)
%25 = call i32 @free(i8* %19)
br label %26
26: ; preds = %13, %10, %3, %21
%27 = phi i32 [ 0, %21 ], [ 1, %3 ], [ 1, %10 ], [ 1, %13 ]
ret i32 %27
}