#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*/ SelectShiftIR();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ jtag_read_data(char *, int);
int /*<<< orphan*/ send_cmd(int /*<<< orphan*/, int);
int /*<<< orphan*/ send_cmdWord_msb_last(int, int, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ syncJTAGs();
void checkUserId(int x) {
  syncJTAGs();
  SelectShiftIR();
  send_cmdWord_msb_last(0x3FC8, 1, 14);
  send_cmd(0, 1);
  send_cmd(0, 1);
  send_cmd(0, 0);
  send_cmd(0, 0);
  int data;
  jtag_read_data((char *)&data, 32);
  if (!x)
    fprintf(stderr, "\nUserID Before programming: %08X", data);
  else
    fprintf(stderr, "\nUserID After programming: %08X", data);
  send_cmd(0, 1);
  send_cmd(0, 0);
  send_cmd(0, 0);
}


x86 assembly (clang, -O0):
<checkUserId>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1050 <syncJTAGs@plt>
mov    $0x0,%al
call   1060 <SelectShiftIR@plt>
mov    $0x3fc8,%edi
mov    $0x1,%esi
mov    $0xe,%edx
call   1030 <send_cmdWord_msb_last@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1080 <send_cmd@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1080 <send_cmd@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1080 <send_cmd@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1080 <send_cmd@plt>
lea    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1040 <jtag_read_data@plt>
cmpl   $0x0,-0x4(%rbp)
jne    11ec <checkUserId+0x8c>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xe1e(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1204 <checkUserId+0xa4>
mov    0x2ded(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xe22(%rip),%rsi
call   1070 <fprintf@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1080 <send_cmd@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1080 <send_cmd@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1080 <send_cmd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkUserId>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <syncJTAGs@plt>
xor    %eax,%eax
call   1060 <SelectShiftIR@plt>
mov    $0x3fc8,%edi
mov    $0x1,%esi
mov    $0xe,%edx
call   1030 <send_cmdWord_msb_last@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1080 <send_cmd@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1080 <send_cmd@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1080 <send_cmd@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1080 <send_cmd@plt>
lea    0xc(%rsp),%rdi
mov    $0x20,%esi
call   1040 <jtag_read_data@plt>
test   %ebx,%ebx
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
mov    0xc(%rsp),%edx
lea    0xe28(%rip),%rax
lea    0xe42(%rip),%rsi
cmove  %rax,%rsi
call   1070 <fprintf@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1080 <send_cmd@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1080 <send_cmd@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1080 <send_cmd@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"\0AUserID Before programming: %08X\00"
@.str.1 = [32 x i8] c"\0AUserID After programming: %08X\00"
define void @checkUserId(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @syncJTAGs()
%5 = call i32 (...) @SelectShiftIR()
%6 = call i32 @send_cmdWord_msb_last(i32 16328, i32 1, i32 14)
%7 = call i32 @send_cmd(i32 0, i32 1)
%8 = call i32 @send_cmd(i32 0, i32 1)
%9 = call i32 @send_cmd(i32 0, i32 0)
%10 = call i32 @send_cmd(i32 0, i32 0)
%11 = bitcast i32* %3 to i8*
%12 = call i32 @jtag_read_data(i8* %11, i32 32)
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %1
%16 = load i32, i32* @stderr
%17 = load i32, i32* %3
%18 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %23
19: ; preds = %1
%20 = load i32, i32* @stderr
%21 = load i32, i32* %3
%22 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %19, %15
%24 = call i32 @send_cmd(i32 0, i32 1)
%25 = call i32 @send_cmd(i32 0, i32 0)
%26 = call i32 @send_cmd(i32 0, i32 0)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"\0AUserID Before programming: %08X\00"
@.str.1 = [32 x i8] c"\0AUserID After programming: %08X\00"
define void @checkUserId(i32 %0) {
%2 = alloca i32
%3 = tail call i32 (...) @syncJTAGs()
%4 = tail call i32 (...) @SelectShiftIR()
%5 = tail call i32 @send_cmdWord_msb_last(i32 16328, i32 1, i32 14)
%6 = tail call i32 @send_cmd(i32 0, i32 1)
%7 = tail call i32 @send_cmd(i32 0, i32 1)
%8 = tail call i32 @send_cmd(i32 0, i32 0)
%9 = tail call i32 @send_cmd(i32 0, i32 0)
%10 = bitcast i32* %2 to i8*
%11 = call i32 @jtag_read_data(i8* %10, i32 32)
%12 = icmp eq i32 %0, 0
%13 = load i32, i32* @stderr
%14 = load i32, i32* %2
%15 = select i1 %12, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0)
%16 = call i32 @fprintf(i32 %13, i8* %15, i32 %14)
%17 = call i32 @send_cmd(i32 0, i32 1)
%18 = call i32 @send_cmd(i32 0, i32 0)
%19 = call i32 @send_cmd(i32 0, i32 0)
ret void
}