#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*/ JTAG_DELAY();
char JTAG_GET_TDO();
int /*<<< orphan*/ JTAG_Reset();
int /*<<< orphan*/ JTAG_SET(int);
unsigned int JTAG_ReadId(void) {
  int i;
  char id[32];
  unsigned int id32;
  JTAG_Reset();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET(0 | 0 | 0);
  JTAG_DELAY();
  JTAG_SET(0 | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  for (i = 0; i <= 30; i++) {
    JTAG_SET((1 << 3) | 0 | 0);
    JTAG_DELAY();
    JTAG_SET((1 << 3) | 0 | (1 << 2));
    JTAG_DELAY();
    id[i] = JTAG_GET_TDO();
  }
  JTAG_SET((1 << 3) | (1 << 1) | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | (1 << 2));
  JTAG_DELAY();
  id[i] = JTAG_GET_TDO();
  JTAG_SET((1 << 3) | (1 << 1) | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | (1 << 1) | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | 0);
  JTAG_DELAY();
  JTAG_SET((1 << 3) | 0 | (1 << 2));
  JTAG_DELAY();
  id32 = 0;
  for (i = 31; i >= 0; i--) {
    if (id[i] == '1')
      id32 |= (1 << i);
  }
  return id32;
}


x86 assembly (clang, -O0):
<JTAG_ReadId>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x0,%al
call   1050 <JTAG_Reset@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
xor    %edi,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x4,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x1e,-0x4(%rbp)
jg     13be <JTAG_ReadId+0x27e>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x0,%al
call   1040 <JTAG_GET_TDO@plt>
mov    %al,%cl
movslq -0x4(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1373 <JTAG_ReadId+0x233>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x0,%al
call   1040 <JTAG_GET_TDO@plt>
mov    %al,%cl
movslq -0x4(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
mov    $0x0,%al
call   1030 <JTAG_DELAY@plt>
movl   $0x0,-0x34(%rbp)
movl   $0x1f,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     14c6 <JTAG_ReadId+0x386>
movslq -0x4(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x31,%eax
jne    14b3 <JTAG_ReadId+0x373>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    14b8 <JTAG_ReadId+0x378>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1487 <JTAG_ReadId+0x347>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<JTAG_ReadId>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
xor    %eax,%eax
call   1050 <JTAG_Reset@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
xor    %edi,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x4,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
xor    %ebx,%ebx
xchg   %ax,%ax
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
xor    %eax,%eax
call   1040 <JTAG_GET_TDO@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x1f,%rbx
jne    1370 <JTAG_ReadId+0x230>
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
xor    %eax,%eax
call   1040 <JTAG_GET_TDO@plt>
mov    %eax,%ebx
mov    %al,0x1f(%rsp)
mov    $0xa,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xe,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0x8,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
mov    $0xc,%edi
call   1060 <JTAG_SET@plt>
xor    %eax,%eax
call   1030 <JTAG_DELAY@plt>
xor    %edi,%edi
cmp    $0x31,%bl
sete   %dil
shl    $0x1f,%edi
mov    $0x1e,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%ebx
mov    %esi,%ecx
shl    %cl,%ebx
cmpb   $0x31,(%rsp,%rsi,1)
cmovne %r14d,%ebx
lea    -0x1(%rsi),%ecx
mov    $0x1,%ebp
shl    %cl,%ebp
or     %edi,%ebx
cmpb   $0x31,-0x1(%rsp,%rsi,1)
cmovne %r14d,%ebp
lea    -0x2(%rsi),%rdx
mov    $0x1,%eax
mov    %edx,%ecx
shl    %cl,%eax
cmpb   $0x31,-0x2(%rsp,%rsi,1)
cmovne %r14d,%eax
or     %ebp,%eax
or     %ebx,%eax
test   %rdx,%rdx
je     14e3 <JTAG_ReadId+0x3a3>
lea    -0x1(%rdx),%ecx
mov    $0x1,%edi
shl    %cl,%edi
cmpb   $0x31,-0x3(%rsp,%rsi,1)
cmovne %r14d,%edi
or     %eax,%edi
add    $0xfffffffffffffffe,%rdx
mov    %rdx,%rsi
jmp    1480 <JTAG_ReadId+0x340>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @JTAG_ReadId() {
%1 = alloca i32
%2 = alloca [32 x i8]
%3 = alloca i32
%4 = call i32 (...) @JTAG_Reset()
%5 = call i32 @JTAG_SET(i32 8)
%6 = call i32 (...) @JTAG_DELAY()
%7 = call i32 @JTAG_SET(i32 12)
%8 = call i32 (...) @JTAG_DELAY()
%9 = call i32 @JTAG_SET(i32 8)
%10 = call i32 (...) @JTAG_DELAY()
%11 = call i32 @JTAG_SET(i32 12)
%12 = call i32 (...) @JTAG_DELAY()
%13 = call i32 @JTAG_SET(i32 8)
%14 = call i32 (...) @JTAG_DELAY()
%15 = call i32 @JTAG_SET(i32 12)
%16 = call i32 (...) @JTAG_DELAY()
%17 = call i32 @JTAG_SET(i32 8)
%18 = call i32 (...) @JTAG_DELAY()
%19 = call i32 @JTAG_SET(i32 12)
%20 = call i32 (...) @JTAG_DELAY()
%21 = call i32 @JTAG_SET(i32 10)
%22 = call i32 (...) @JTAG_DELAY()
%23 = call i32 @JTAG_SET(i32 14)
%24 = call i32 (...) @JTAG_DELAY()
%25 = call i32 @JTAG_SET(i32 10)
%26 = call i32 (...) @JTAG_DELAY()
%27 = call i32 @JTAG_SET(i32 14)
%28 = call i32 (...) @JTAG_DELAY()
%29 = call i32 @JTAG_SET(i32 8)
%30 = call i32 (...) @JTAG_DELAY()
%31 = call i32 @JTAG_SET(i32 12)
%32 = call i32 (...) @JTAG_DELAY()
%33 = call i32 @JTAG_SET(i32 8)
%34 = call i32 (...) @JTAG_DELAY()
%35 = call i32 @JTAG_SET(i32 12)
%36 = call i32 (...) @JTAG_DELAY()
%37 = call i32 @JTAG_SET(i32 0)
%38 = call i32 (...) @JTAG_DELAY()
%39 = call i32 @JTAG_SET(i32 4)
%40 = call i32 (...) @JTAG_DELAY()
%41 = call i32 @JTAG_SET(i32 8)
%42 = call i32 (...) @JTAG_DELAY()
%43 = call i32 @JTAG_SET(i32 12)
%44 = call i32 (...) @JTAG_DELAY()
%45 = call i32 @JTAG_SET(i32 8)
%46 = call i32 (...) @JTAG_DELAY()
%47 = call i32 @JTAG_SET(i32 12)
%48 = call i32 (...) @JTAG_DELAY()
%49 = call i32 @JTAG_SET(i32 10)
%50 = call i32 (...) @JTAG_DELAY()
%51 = call i32 @JTAG_SET(i32 14)
%52 = call i32 (...) @JTAG_DELAY()
%53 = call i32 @JTAG_SET(i32 10)
%54 = call i32 (...) @JTAG_DELAY()
%55 = call i32 @JTAG_SET(i32 14)
%56 = call i32 (...) @JTAG_DELAY()
%57 = call i32 @JTAG_SET(i32 10)
%58 = call i32 (...) @JTAG_DELAY()
%59 = call i32 @JTAG_SET(i32 14)
%60 = call i32 (...) @JTAG_DELAY()
%61 = call i32 @JTAG_SET(i32 8)
%62 = call i32 (...) @JTAG_DELAY()
%63 = call i32 @JTAG_SET(i32 12)
%64 = call i32 (...) @JTAG_DELAY()
%65 = call i32 @JTAG_SET(i32 8)
%66 = call i32 (...) @JTAG_DELAY()
%67 = call i32 @JTAG_SET(i32 12)
%68 = call i32 (...) @JTAG_DELAY()
store i32 0, i32* %1
br label %69
69: ; preds = %81, %0
%70 = load i32, i32* %1
%71 = icmp sle i32 %70, 30
br i1 %71, label %72, label %84
72: ; preds = %69
%73 = call i32 @JTAG_SET(i32 8)
%74 = call i32 (...) @JTAG_DELAY()
%75 = call i32 @JTAG_SET(i32 12)
%76 = call i32 (...) @JTAG_DELAY()
%77 = call signext i8 (...) @JTAG_GET_TDO()
%78 = load i32, i32* %1
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 %79
store i8 %77, i8* %80
br label %81
81: ; preds = %72
%82 = load i32, i32* %1
%83 = add nsw i32 %82, 1
store i32 %83, i32* %1
br label %69
84: ; preds = %69
%85 = call i32 @JTAG_SET(i32 10)
%86 = call i32 (...) @JTAG_DELAY()
%87 = call i32 @JTAG_SET(i32 14)
%88 = call i32 (...) @JTAG_DELAY()
%89 = call signext i8 (...) @JTAG_GET_TDO()
%90 = load i32, i32* %1
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 %91
store i8 %89, i8* %92
%93 = call i32 @JTAG_SET(i32 10)
%94 = call i32 (...) @JTAG_DELAY()
%95 = call i32 @JTAG_SET(i32 14)
%96 = call i32 (...) @JTAG_DELAY()
%97 = call i32 @JTAG_SET(i32 8)
%98 = call i32 (...) @JTAG_DELAY()
%99 = call i32 @JTAG_SET(i32 12)
%100 = call i32 (...) @JTAG_DELAY()
%101 = call i32 @JTAG_SET(i32 8)
%102 = call i32 (...) @JTAG_DELAY()
%103 = call i32 @JTAG_SET(i32 12)
%104 = call i32 (...) @JTAG_DELAY()
%105 = call i32 @JTAG_SET(i32 8)
%106 = call i32 (...) @JTAG_DELAY()
%107 = call i32 @JTAG_SET(i32 12)
%108 = call i32 (...) @JTAG_DELAY()
store i32 0, i32* %3
store i32 31, i32* %1
br label %109
109: ; preds = %125, %84
%110 = load i32, i32* %1
%111 = icmp sge i32 %110, 0
br i1 %111, label %112, label %128
112: ; preds = %109
%113 = load i32, i32* %1
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 %114
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = icmp eq i32 %117, 49
br i1 %118, label %119, label %124
119: ; preds = %112
%120 = load i32, i32* %1
%121 = shl i32 1, %120
%122 = load i32, i32* %3
%123 = or i32 %122, %121
store i32 %123, i32* %3
br label %124
124: ; preds = %119, %112
br label %125
125: ; preds = %124
%126 = load i32, i32* %1
%127 = add nsw i32 %126, -1
store i32 %127, i32* %1
br label %109
128: ; preds = %109
%129 = load i32, i32* %3
ret i32 %129
}

LLVM IR (-O2):
define i32 @JTAG_ReadId() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @JTAG_Reset()
%4 = tail call i32 @JTAG_SET(i32 8)
%5 = tail call i32 (...) @JTAG_DELAY()
%6 = tail call i32 @JTAG_SET(i32 12)
%7 = tail call i32 (...) @JTAG_DELAY()
%8 = tail call i32 @JTAG_SET(i32 8)
%9 = tail call i32 (...) @JTAG_DELAY()
%10 = tail call i32 @JTAG_SET(i32 12)
%11 = tail call i32 (...) @JTAG_DELAY()
%12 = tail call i32 @JTAG_SET(i32 8)
%13 = tail call i32 (...) @JTAG_DELAY()
%14 = tail call i32 @JTAG_SET(i32 12)
%15 = tail call i32 (...) @JTAG_DELAY()
%16 = tail call i32 @JTAG_SET(i32 8)
%17 = tail call i32 (...) @JTAG_DELAY()
%18 = tail call i32 @JTAG_SET(i32 12)
%19 = tail call i32 (...) @JTAG_DELAY()
%20 = tail call i32 @JTAG_SET(i32 10)
%21 = tail call i32 (...) @JTAG_DELAY()
%22 = tail call i32 @JTAG_SET(i32 14)
%23 = tail call i32 (...) @JTAG_DELAY()
%24 = tail call i32 @JTAG_SET(i32 10)
%25 = tail call i32 (...) @JTAG_DELAY()
%26 = tail call i32 @JTAG_SET(i32 14)
%27 = tail call i32 (...) @JTAG_DELAY()
%28 = tail call i32 @JTAG_SET(i32 8)
%29 = tail call i32 (...) @JTAG_DELAY()
%30 = tail call i32 @JTAG_SET(i32 12)
%31 = tail call i32 (...) @JTAG_DELAY()
%32 = tail call i32 @JTAG_SET(i32 8)
%33 = tail call i32 (...) @JTAG_DELAY()
%34 = tail call i32 @JTAG_SET(i32 12)
%35 = tail call i32 (...) @JTAG_DELAY()
%36 = tail call i32 @JTAG_SET(i32 0)
%37 = tail call i32 (...) @JTAG_DELAY()
%38 = tail call i32 @JTAG_SET(i32 4)
%39 = tail call i32 (...) @JTAG_DELAY()
%40 = tail call i32 @JTAG_SET(i32 8)
%41 = tail call i32 (...) @JTAG_DELAY()
%42 = tail call i32 @JTAG_SET(i32 12)
%43 = tail call i32 (...) @JTAG_DELAY()
%44 = tail call i32 @JTAG_SET(i32 8)
%45 = tail call i32 (...) @JTAG_DELAY()
%46 = tail call i32 @JTAG_SET(i32 12)
%47 = tail call i32 (...) @JTAG_DELAY()
%48 = tail call i32 @JTAG_SET(i32 10)
%49 = tail call i32 (...) @JTAG_DELAY()
%50 = tail call i32 @JTAG_SET(i32 14)
%51 = tail call i32 (...) @JTAG_DELAY()
%52 = tail call i32 @JTAG_SET(i32 10)
%53 = tail call i32 (...) @JTAG_DELAY()
%54 = tail call i32 @JTAG_SET(i32 14)
%55 = tail call i32 (...) @JTAG_DELAY()
%56 = tail call i32 @JTAG_SET(i32 10)
%57 = tail call i32 (...) @JTAG_DELAY()
%58 = tail call i32 @JTAG_SET(i32 14)
%59 = tail call i32 (...) @JTAG_DELAY()
%60 = tail call i32 @JTAG_SET(i32 8)
%61 = tail call i32 (...) @JTAG_DELAY()
%62 = tail call i32 @JTAG_SET(i32 12)
%63 = tail call i32 (...) @JTAG_DELAY()
%64 = tail call i32 @JTAG_SET(i32 8)
%65 = tail call i32 (...) @JTAG_DELAY()
%66 = tail call i32 @JTAG_SET(i32 12)
%67 = tail call i32 (...) @JTAG_DELAY()
br label %68
68: ; preds = %0, %68
%69 = phi i64 [ 0, %0 ], [ %76, %68 ]
%70 = tail call i32 @JTAG_SET(i32 8)
%71 = tail call i32 (...) @JTAG_DELAY()
%72 = tail call i32 @JTAG_SET(i32 12)
%73 = tail call i32 (...) @JTAG_DELAY()
%74 = tail call signext i8 (...) @JTAG_GET_TDO()
%75 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 %69
store i8 %74, i8* %75
%76 = add nuw nsw i64 %69, 1
%77 = icmp eq i64 %76, 31
br i1 %77, label %78, label %68
78: ; preds = %68
%79 = tail call i32 @JTAG_SET(i32 10)
%80 = tail call i32 (...) @JTAG_DELAY()
%81 = tail call i32 @JTAG_SET(i32 14)
%82 = tail call i32 (...) @JTAG_DELAY()
%83 = tail call signext i8 (...) @JTAG_GET_TDO()
%84 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 31
store i8 %83, i8* %84
%85 = tail call i32 @JTAG_SET(i32 10)
%86 = tail call i32 (...) @JTAG_DELAY()
%87 = tail call i32 @JTAG_SET(i32 14)
%88 = tail call i32 (...) @JTAG_DELAY()
%89 = tail call i32 @JTAG_SET(i32 8)
%90 = tail call i32 (...) @JTAG_DELAY()
%91 = tail call i32 @JTAG_SET(i32 12)
%92 = tail call i32 (...) @JTAG_DELAY()
%93 = tail call i32 @JTAG_SET(i32 8)
%94 = tail call i32 (...) @JTAG_DELAY()
%95 = tail call i32 @JTAG_SET(i32 12)
%96 = tail call i32 (...) @JTAG_DELAY()
%97 = tail call i32 @JTAG_SET(i32 8)
%98 = tail call i32 (...) @JTAG_DELAY()
%99 = tail call i32 @JTAG_SET(i32 12)
%100 = tail call i32 (...) @JTAG_DELAY()
%101 = icmp eq i8 %83, 49
%102 = select i1 %101, i32 -2147483648, i32 0
br label %103
103: ; preds = %131, %78
%104 = phi i64 [ 30, %78 ], [ %139, %131 ]
%105 = phi i32 [ %102, %78 ], [ %138, %131 ]
%106 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 %104
%107 = load i8, i8* %106
%108 = icmp eq i8 %107, 49
%109 = trunc i64 %104 to i32
%110 = shl nuw i32 1, %109
%111 = select i1 %108, i32 %110, i32 0
%112 = or i32 %111, %105
%113 = add nsw i64 %104, -1
%114 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 %113
%115 = load i8, i8* %114
%116 = icmp eq i8 %115, 49
%117 = trunc i64 %113 to i32
%118 = shl nuw i32 1, %117
%119 = select i1 %116, i32 %118, i32 0
%120 = or i32 %119, %112
%121 = add nsw i64 %104, -2
%122 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 %121
%123 = load i8, i8* %122
%124 = icmp eq i8 %123, 49
%125 = trunc i64 %121 to i32
%126 = shl nuw i32 1, %125
%127 = select i1 %124, i32 %126, i32 0
%128 = or i32 %127, %120
%129 = add nsw i64 %104, -3
%130 = icmp eq i64 %121, 0
br i1 %130, label %140, label %131
131: ; preds = %103
%132 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 %129
%133 = load i8, i8* %132
%134 = icmp eq i8 %133, 49
%135 = trunc i64 %129 to i32
%136 = shl nuw i32 1, %135
%137 = select i1 %134, i32 %136, i32 0
%138 = or i32 %137, %128
%139 = add nsw i64 %104, -4
br label %103
140: ; preds = %103
ret i32 %128
}