#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*/ btConfirmPersistence(int, int, int);
int readNextInt();
scalar_t__ readSetting(int);
int readSettingWord(int);
void btProcessPersistenceRead(void) {
  int addr = readNextInt();
  int dataSize = readNextInt();
  int value;
  if (dataSize == 1) {
    value = (int)readSetting(addr);
  } else if (dataSize == 2) {
    value = readSettingWord(addr);
  }
  btConfirmPersistence(addr, dataSize, value);
}


x86 assembly (clang, -O0):
<btProcessPersistenceRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <readNextInt@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <readNextInt@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1176 <btProcessPersistenceRead+0x36>
mov    -0x4(%rbp),%edi
call   1050 <readSetting@plt>
mov    %eax,-0xc(%rbp)
jmp    1190 <btProcessPersistenceRead+0x50>
cmpl   $0x2,-0x8(%rbp)
jne    118b <btProcessPersistenceRead+0x4b>
mov    -0x4(%rbp),%edi
call   1040 <readSettingWord@plt>
mov    %eax,-0xc(%rbp)
jmp    1190 <btProcessPersistenceRead+0x50>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1060 <btConfirmPersistence@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btProcessPersistenceRead>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <readNextInt@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <readNextInt@plt>
mov    %eax,%ebp
mov    %ebx,%edi
cmp    $0x1,%eax
jne    1163 <btProcessPersistenceRead+0x23>
call   1050 <readSetting@plt>
jmp    1168 <btProcessPersistenceRead+0x28>
call   1040 <readSettingWord@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <btConfirmPersistence@plt>

LLVM IR (-O0):
define void @btProcessPersistenceRead() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @readNextInt()
store i32 %4, i32* %1
%5 = call i32 (...) @readNextInt()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* %1
%10 = call i64 @readSetting(i32 %9)
%11 = trunc i64 %10 to i32
store i32 %11, i32* %3
br label %19
12: ; preds = %0
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %1
%17 = call i32 @readSettingWord(i32 %16)
store i32 %17, i32* %3
br label %18
18: ; preds = %15, %12
br label %19
19: ; preds = %18, %8
%20 = load i32, i32* %1
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = call i32 @btConfirmPersistence(i32 %20, i32 %21, i32 %22)
ret void
}

LLVM IR (-O2):
define void @btProcessPersistenceRead() {
%1 = tail call i32 (...) @readNextInt()
%2 = tail call i32 (...) @readNextInt()
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = tail call i64 @readSetting(i32 %1)
%6 = trunc i64 %5 to i32
br label %9
7: ; preds = %0
%8 = tail call i32 @readSettingWord(i32 %1)
br label %9
9: ; preds = %7, %4
%10 = phi i32 [ %6, %4 ], [ %8, %7 ]
%11 = tail call i32 @btConfirmPersistence(i32 %1, i32 %2, i32 %10)
ret void
}