#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 timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_nanosleep(int /*<<< orphan*/, int /*<<< orphan*/,
                                   struct timespec *, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usleep(int);
int _config_GC314FS(char *BASE1, int clock_source, int cardnumber) {
  int temp;
  struct timespec sleep;
  int version = 1;
  int value;
  sleep.tv_sec = 0;
  sleep.tv_nsec = 10000;
  *((unsigned int *)(BASE1 + 0x100)) &= 0xffffffef;
  *((unsigned int *)(BASE1 + 0x100)) &= 0xfffff8ff;
  *((unsigned int *)(BASE1 + 0x114)) = 3000;
  *((unsigned int *)(BASE1 + 0x100)) |= 0x00000040;
  *((unsigned int *)(BASE1 + 0x100)) |= 0x00000020;
  if ((cardnumber == -1 || -1 == -1))
    *((unsigned int *)(BASE1 + 0x100)) |= 0x00800000;
  else
    *((unsigned int *)(BASE1 + 0x100)) &= 0xff7fffff;
  if ((cardnumber == -1) || (-1 == -1))
    *((unsigned int *)(BASE1 + 0x100)) |= 0x01000000;
  else
    *((unsigned int *)(BASE1 + 0x100)) &= 0xfeffffff;
  value = 0x15;
  *((unsigned int *)(BASE1 + 0x130)) = value;
  temp = *((unsigned int *)(BASE1 + 0x130));
  if (value == temp) {
    version = 316;
    fprintf(stderr, "This appears to be a GC316\n");
  } else {
    version = 314;
    fprintf(stderr, "This appears to be a GC314\n");
  }
  fprintf(stderr, "ADC Register Value 0x%x\n", temp);
  *((unsigned int *)(BASE1 + 0x100)) &= 0xfff7ffff;
  *((unsigned int *)(BASE1 + 0x200)) &= 0xffffffdf;
  *((unsigned int *)(BASE1 + 0x100)) |= 0x00000f00;
  *((unsigned int *)(BASE1 + 0x310)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x350)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x390)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x3d0)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x410)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x450)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x490)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x4d0)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x510)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x550)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x590)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x5d0)) = 0x000002a0;
  *((unsigned int *)(BASE1 + 0x100)) |= 0x00200000;
  usleep(20);
  *((unsigned int *)(BASE1 + 0x100)) &= 0xffdfffff;
  usleep(20);
  if (clock_source == 0x10) {
    *((unsigned int *)(BASE1 + 0x100)) |= 0x00000004;
    sleep.tv_nsec = 20000000;
    clock_nanosleep(CLOCK_REALTIME, 0, &sleep, 0);
    *((unsigned int *)(BASE1 + 0x100)) &= 0xfffffff7;
  } else if (clock_source == 0x20) {
    *((unsigned int *)(BASE1 + 0x100)) &= 0xfffffffb;
    sleep.tv_nsec = 20000000;
    clock_nanosleep(CLOCK_REALTIME, 0, &sleep, 0);
    *((unsigned int *)(BASE1 + 0x100)) |= 0x00000008;
  } else {
    fprintf(stderr, "	Clock source not properly defined");
    return -1;
  }
  *((unsigned int *)(BASE1 + 0x100)) &= 0xfffff8ff;
  temp = *((unsigned int *)(BASE1 + 0x100));
  fprintf(stderr, "GCSR Register Value at end of config: %x\n", temp);
  return version;
}


x86 assembly (clang, -O0):
<_config_GC314FS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x1,-0x34(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x2710,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
and    $0xffffffef,%ecx
mov    %ecx,0x100(%rax)
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
and    $0xfffff8ff,%ecx
mov    %ecx,0x100(%rax)
mov    -0x10(%rbp),%rax
movl   $0xbb8,0x114(%rax)
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
or     $0x40,%ecx
mov    %ecx,0x100(%rax)
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
or     $0x20,%ecx
mov    %ecx,0x100(%rax)
cmpl   $0xffffffff,-0x18(%rbp)
je     11ce <_config_GC314FS+0x9e>
mov    $0x1,%al
test   $0x1,%al
jne    11ce <_config_GC314FS+0x9e>
jmp    11e9 <_config_GC314FS+0xb9>
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
or     $0x800000,%ecx
mov    %ecx,0x100(%rax)
jmp    11ff <_config_GC314FS+0xcf>
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
and    $0xff7fffff,%ecx
mov    %ecx,0x100(%rax)
cmpl   $0xffffffff,-0x18(%rbp)
je     1218 <_config_GC314FS+0xe8>
mov    $0x1,%al
test   $0x1,%al
jne    1218 <_config_GC314FS+0xe8>
jmp    1233 <_config_GC314FS+0x103>
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
or     $0x1000000,%ecx
mov    %ecx,0x100(%rax)
jmp    1249 <_config_GC314FS+0x119>
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
and    $0xfeffffff,%ecx
mov    %ecx,0x100(%rax)
movl   $0x15,-0x38(%rbp)
mov    -0x38(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x130(%rax)
mov    -0x10(%rbp),%rax
mov    0x130(%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    1299 <_config_GC314FS+0x169>
movl   $0x13c,-0x34(%rbp)
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
lea    0xd73(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12b7 <_config_GC314FS+0x187>
movl   $0x13a,-0x34(%rbp)
mov    0x2d39(%rip),%rax
mov    (%rax),%edi
lea    0xd6c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xd6e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
and    $0xfff7ffff,%ecx
mov    %ecx,0x100(%rax)
mov    -0x10(%rbp),%rax
mov    0x200(%rax),%ecx
and    $0xffffffdf,%ecx
mov    %ecx,0x200(%rax)
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
or     $0xf00,%ecx
mov    %ecx,0x100(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x310(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x350(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x390(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x3d0(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x410(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x450(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x490(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x4d0(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x510(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x550(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x590(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a0,0x5d0(%rax)
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
or     $0x200000,%ecx
mov    %ecx,0x100(%rax)
mov    $0x14,%edi
call   1050 <usleep@plt>
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
and    $0xffdfffff,%ecx
mov    %ecx,0x100(%rax)
mov    $0x14,%edi
call   1050 <usleep@plt>
cmpl   $0x10,-0x14(%rbp)
jne    144a <_config_GC314FS+0x31a>
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
or     $0x4,%ecx
mov    %ecx,0x100(%rax)
movl   $0x1312d00,-0x30(%rbp)
mov    0x2bb5(%rip),%rax
mov    (%rax),%edi
xor    %ecx,%ecx
lea    -0x30(%rbp),%rdx
mov    %ecx,%esi
call   1040 <clock_nanosleep@plt>
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
and    $0xfffffff7,%ecx
mov    %ecx,0x100(%rax)
jmp    14c4 <_config_GC314FS+0x394>
cmpl   $0x20,-0x14(%rbp)
jne    149c <_config_GC314FS+0x36c>
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
and    $0xfffffffb,%ecx
mov    %ecx,0x100(%rax)
movl   $0x1312d00,-0x30(%rbp)
mov    0x2b63(%rip),%rax
mov    (%rax),%edi
xor    %ecx,%ecx
lea    -0x30(%rbp),%rdx
mov    %ecx,%esi
call   1040 <clock_nanosleep@plt>
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
or     $0x8,%ecx
mov    %ecx,0x100(%rax)
jmp    14bf <_config_GC314FS+0x38f>
mov    0x2b3d(%rip),%rax
mov    (%rax),%edi
lea    0xba5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1507 <_config_GC314FS+0x3d7>
jmp    14c4 <_config_GC314FS+0x394>
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%ecx
and    $0xfffff8ff,%ecx
mov    %ecx,0x100(%rax)
mov    -0x10(%rbp),%rax
mov    0x100(%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2af2(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xb7a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_config_GC314FS>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
movl   $0x2710,(%rsp)
mov    $0xfe7ff88f,%eax
and    0x100(%rdi),%eax
movl   $0xbb8,0x114(%rdi)
or     $0x1800060,%eax
mov    %eax,0x100(%rdi)
movl   $0x15,0x130(%rdi)
mov    0x2e62(%rip),%r14
mov    (%r14),%edi
lea    0xe78(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xe83(%rip),%rsi
mov    $0x15,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0xffd7f0ff,%eax
and    0x100(%rbx),%eax
andb   $0xdf,0x200(%rbx)
movl   $0x2a0,0x310(%rbx)
movl   $0x2a0,0x350(%rbx)
movl   $0x2a0,0x390(%rbx)
movl   $0x2a0,0x3d0(%rbx)
movl   $0x2a0,0x410(%rbx)
movl   $0x2a0,0x450(%rbx)
movl   $0x2a0,0x490(%rbx)
movl   $0x2a0,0x4d0(%rbx)
movl   $0x2a0,0x510(%rbx)
movl   $0x2a0,0x550(%rbx)
movl   $0x2a0,0x590(%rbx)
movl   $0x2a0,0x5d0(%rbx)
or     $0x200f00,%eax
mov    %eax,0x100(%rbx)
mov    $0x14,%edi
call   1050 <usleep@plt>
andb   $0xdf,0x102(%rbx)
mov    $0x14,%edi
call   1050 <usleep@plt>
cmp    $0x20,%ebp
je     128d <_config_GC314FS+0x15d>
cmp    $0x10,%ebp
jne    12dd <_config_GC314FS+0x1ad>
orb    $0x4,0x100(%rbx)
movl   $0x1312d00,(%rsp)
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rdx
xor    %esi,%esi
xor    %ecx,%ecx
call   1040 <clock_nanosleep@plt>
mov    0x100(%rbx),%edx
and    $0xfffffff7,%edx
jmp    12b9 <_config_GC314FS+0x189>
andb   $0xfb,0x100(%rbx)
movl   $0x1312d00,(%rsp)
mov    0x2d36(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rdx
xor    %esi,%esi
xor    %ecx,%ecx
call   1040 <clock_nanosleep@plt>
mov    0x100(%rbx),%edx
or     $0x8,%edx
and    $0xfffff8ff,%edx
mov    %edx,0x100(%rbx)
mov    (%r14),%edi
lea    0xd89(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x13c,%eax
jmp    12f3 <_config_GC314FS+0x1c3>
mov    (%r14),%edi
lea    0xd4e(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
@stderr = global i32 0
@.str = [28 x i8] c"This appears to be a GC316\0A\00"
@.str.1 = [28 x i8] c"This appears to be a GC314\0A\00"
@.str.2 = [25 x i8] c"ADC Register Value 0x%x\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.3 = [35 x i8] c"\09Clock source not properly defined\00"
@.str.4 = [42 x i8] c"GCSR Register Value at end of config: %x\0A\00"
define i32 @_config_GC314FS(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.timespec
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 1, i32* %10
%12 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 1
store i64 0, i64* %12
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
store i32 10000, i32* %13
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i64 256
%16 = bitcast i8* %15 to i32*
%17 = load i32, i32* %16
%18 = and i32 %17, -17
store i32 %18, i32* %16
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 256
%21 = bitcast i8* %20 to i32*
%22 = load i32, i32* %21
%23 = and i32 %22, -1793
store i32 %23, i32* %21
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i64 276
%26 = bitcast i8* %25 to i32*
store i32 3000, i32* %26
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i64 256
%29 = bitcast i8* %28 to i32*
%30 = load i32, i32* %29
%31 = or i32 %30, 64
store i32 %31, i32* %29
%32 = load i8*, i8** %5
%33 = getelementptr inbounds i8, i8* %32, i64 256
%34 = bitcast i8* %33 to i32*
%35 = load i32, i32* %34
%36 = or i32 %35, 32
store i32 %36, i32* %34
%37 = load i32, i32* %7
%38 = icmp eq i32 %37, -1
br i1 %38, label %40, label %39
39: ; preds = %3
br i1 true, label %40, label %46
40: ; preds = %39, %3
%41 = load i8*, i8** %5
%42 = getelementptr inbounds i8, i8* %41, i64 256
%43 = bitcast i8* %42 to i32*
%44 = load i32, i32* %43
%45 = or i32 %44, 8388608
store i32 %45, i32* %43
br label %52
46: ; preds = %39
%47 = load i8*, i8** %5
%48 = getelementptr inbounds i8, i8* %47, i64 256
%49 = bitcast i8* %48 to i32*
%50 = load i32, i32* %49
%51 = and i32 %50, -8388609
store i32 %51, i32* %49
br label %52
52: ; preds = %46, %40
%53 = load i32, i32* %7
%54 = icmp eq i32 %53, -1
br i1 %54, label %56, label %55
55: ; preds = %52
br i1 true, label %56, label %62
56: ; preds = %55, %52
%57 = load i8*, i8** %5
%58 = getelementptr inbounds i8, i8* %57, i64 256
%59 = bitcast i8* %58 to i32*
%60 = load i32, i32* %59
%61 = or i32 %60, 16777216
store i32 %61, i32* %59
br label %68
62: ; preds = %55
%63 = load i8*, i8** %5
%64 = getelementptr inbounds i8, i8* %63, i64 256
%65 = bitcast i8* %64 to i32*
%66 = load i32, i32* %65
%67 = and i32 %66, -16777217
store i32 %67, i32* %65
br label %68
68: ; preds = %62, %56
store i32 21, i32* %11
%69 = load i32, i32* %11
%70 = load i8*, i8** %5
%71 = getelementptr inbounds i8, i8* %70, i64 304
%72 = bitcast i8* %71 to i32*
store i32 %69, i32* %72
%73 = load i8*, i8** %5
%74 = getelementptr inbounds i8, i8* %73, i64 304
%75 = bitcast i8* %74 to i32*
%76 = load i32, i32* %75
store i32 %76, i32* %8
%77 = load i32, i32* %11
%78 = load i32, i32* %8
%79 = icmp eq i32 %77, %78
br i1 %79, label %80, label %83
80: ; preds = %68
store i32 316, i32* %10
%81 = load i32, i32* @stderr
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %86
83: ; preds = %68
store i32 314, i32* %10
%84 = load i32, i32* @stderr
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %86
86: ; preds = %83, %80
%87 = load i32, i32* @stderr
%88 = load i32, i32* %8
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %88)
%90 = load i8*, i8** %5
%91 = getelementptr inbounds i8, i8* %90, i64 256
%92 = bitcast i8* %91 to i32*
%93 = load i32, i32* %92
%94 = and i32 %93, -524289
store i32 %94, i32* %92
%95 = load i8*, i8** %5
%96 = getelementptr inbounds i8, i8* %95, i64 512
%97 = bitcast i8* %96 to i32*
%98 = load i32, i32* %97
%99 = and i32 %98, -33
store i32 %99, i32* %97
%100 = load i8*, i8** %5
%101 = getelementptr inbounds i8, i8* %100, i64 256
%102 = bitcast i8* %101 to i32*
%103 = load i32, i32* %102
%104 = or i32 %103, 3840
store i32 %104, i32* %102
%105 = load i8*, i8** %5
%106 = getelementptr inbounds i8, i8* %105, i64 784
%107 = bitcast i8* %106 to i32*
store i32 672, i32* %107
%108 = load i8*, i8** %5
%109 = getelementptr inbounds i8, i8* %108, i64 848
%110 = bitcast i8* %109 to i32*
store i32 672, i32* %110
%111 = load i8*, i8** %5
%112 = getelementptr inbounds i8, i8* %111, i64 912
%113 = bitcast i8* %112 to i32*
store i32 672, i32* %113
%114 = load i8*, i8** %5
%115 = getelementptr inbounds i8, i8* %114, i64 976
%116 = bitcast i8* %115 to i32*
store i32 672, i32* %116
%117 = load i8*, i8** %5
%118 = getelementptr inbounds i8, i8* %117, i64 1040
%119 = bitcast i8* %118 to i32*
store i32 672, i32* %119
%120 = load i8*, i8** %5
%121 = getelementptr inbounds i8, i8* %120, i64 1104
%122 = bitcast i8* %121 to i32*
store i32 672, i32* %122
%123 = load i8*, i8** %5
%124 = getelementptr inbounds i8, i8* %123, i64 1168
%125 = bitcast i8* %124 to i32*
store i32 672, i32* %125
%126 = load i8*, i8** %5
%127 = getelementptr inbounds i8, i8* %126, i64 1232
%128 = bitcast i8* %127 to i32*
store i32 672, i32* %128
%129 = load i8*, i8** %5
%130 = getelementptr inbounds i8, i8* %129, i64 1296
%131 = bitcast i8* %130 to i32*
store i32 672, i32* %131
%132 = load i8*, i8** %5
%133 = getelementptr inbounds i8, i8* %132, i64 1360
%134 = bitcast i8* %133 to i32*
store i32 672, i32* %134
%135 = load i8*, i8** %5
%136 = getelementptr inbounds i8, i8* %135, i64 1424
%137 = bitcast i8* %136 to i32*
store i32 672, i32* %137
%138 = load i8*, i8** %5
%139 = getelementptr inbounds i8, i8* %138, i64 1488
%140 = bitcast i8* %139 to i32*
store i32 672, i32* %140
%141 = load i8*, i8** %5
%142 = getelementptr inbounds i8, i8* %141, i64 256
%143 = bitcast i8* %142 to i32*
%144 = load i32, i32* %143
%145 = or i32 %144, 2097152
store i32 %145, i32* %143
%146 = call i32 @usleep(i32 20)
%147 = load i8*, i8** %5
%148 = getelementptr inbounds i8, i8* %147, i64 256
%149 = bitcast i8* %148 to i32*
%150 = load i32, i32* %149
%151 = and i32 %150, -2097153
store i32 %151, i32* %149
%152 = call i32 @usleep(i32 20)
%153 = load i32, i32* %6
%154 = icmp eq i32 %153, 16
br i1 %154, label %155, label %169
155: ; preds = %86
%156 = load i8*, i8** %5
%157 = getelementptr inbounds i8, i8* %156, i64 256
%158 = bitcast i8* %157 to i32*
%159 = load i32, i32* %158
%160 = or i32 %159, 4
store i32 %160, i32* %158
%161 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
store i32 20000000, i32* %161
%162 = load i32, i32* @CLOCK_REALTIME
%163 = call i32 @clock_nanosleep(i32 %162, i32 0, %struct.timespec* %9, i32 0)
%164 = load i8*, i8** %5
%165 = getelementptr inbounds i8, i8* %164, i64 256
%166 = bitcast i8* %165 to i32*
%167 = load i32, i32* %166
%168 = and i32 %167, -9
store i32 %168, i32* %166
br label %190
169: ; preds = %86
%170 = load i32, i32* %6
%171 = icmp eq i32 %170, 32
br i1 %171, label %172, label %186
172: ; preds = %169
%173 = load i8*, i8** %5
%174 = getelementptr inbounds i8, i8* %173, i64 256
%175 = bitcast i8* %174 to i32*
%176 = load i32, i32* %175
%177 = and i32 %176, -5
store i32 %177, i32* %175
%178 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
store i32 20000000, i32* %178
%179 = load i32, i32* @CLOCK_REALTIME
%180 = call i32 @clock_nanosleep(i32 %179, i32 0, %struct.timespec* %9, i32 0)
%181 = load i8*, i8** %5
%182 = getelementptr inbounds i8, i8* %181, i64 256
%183 = bitcast i8* %182 to i32*
%184 = load i32, i32* %183
%185 = or i32 %184, 8
store i32 %185, i32* %183
br label %189
186: ; preds = %169
%187 = load i32, i32* @stderr
%188 = call i32 (i32, i8*, ...) @fprintf(i32 %187, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %4
br label %204
189: ; preds = %172
br label %190
190: ; preds = %189, %155
%191 = load i8*, i8** %5
%192 = getelementptr inbounds i8, i8* %191, i64 256
%193 = bitcast i8* %192 to i32*
%194 = load i32, i32* %193
%195 = and i32 %194, -1793
store i32 %195, i32* %193
%196 = load i8*, i8** %5
%197 = getelementptr inbounds i8, i8* %196, i64 256
%198 = bitcast i8* %197 to i32*
%199 = load i32, i32* %198
store i32 %199, i32* %8
%200 = load i32, i32* @stderr
%201 = load i32, i32* %8
%202 = call i32 (i32, i8*, ...) @fprintf(i32 %200, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i32 %201)
%203 = load i32, i32* %10
store i32 %203, i32* %4
br label %204
204: ; preds = %190, %186
%205 = load i32, i32* %4
ret i32 %205
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
@stderr = global i32 0
@.str = [28 x i8] c"This appears to be a GC316\0A\00"
@.str.2 = [25 x i8] c"ADC Register Value 0x%x\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.3 = [35 x i8] c"\09Clock source not properly defined\00"
@.str.4 = [42 x i8] c"GCSR Register Value at end of config: %x\0A\00"
define i32 @_config_GC314FS(i8* nocapture %0, i32 %1, i32 %2) {
%4 = alloca %struct.timespec
%5 = bitcast %struct.timespec* %4 to i8*
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 1
store i64 0, i64* %6
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 0
store i32 10000, i32* %7
%8 = getelementptr inbounds i8, i8* %0, i64 256
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = and i32 %10, -25167729
%12 = getelementptr inbounds i8, i8* %0, i64 276
%13 = bitcast i8* %12 to i32*
store i32 3000, i32* %13
%14 = or i32 %11, 25165920
store i32 %14, i32* %9
%15 = getelementptr inbounds i8, i8* %0, i64 304
%16 = bitcast i8* %15 to i32*
store i32 21, i32* %16
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 21)
%21 = load i32, i32* %9
%22 = and i32 %21, -2625281
%23 = getelementptr inbounds i8, i8* %0, i64 512
%24 = bitcast i8* %23 to i32*
%25 = load i32, i32* %24
%26 = and i32 %25, -33
store i32 %26, i32* %24
%27 = getelementptr inbounds i8, i8* %0, i64 784
%28 = bitcast i8* %27 to i32*
store i32 672, i32* %28
%29 = getelementptr inbounds i8, i8* %0, i64 848
%30 = bitcast i8* %29 to i32*
store i32 672, i32* %30
%31 = getelementptr inbounds i8, i8* %0, i64 912
%32 = bitcast i8* %31 to i32*
store i32 672, i32* %32
%33 = getelementptr inbounds i8, i8* %0, i64 976
%34 = bitcast i8* %33 to i32*
store i32 672, i32* %34
%35 = getelementptr inbounds i8, i8* %0, i64 1040
%36 = bitcast i8* %35 to i32*
store i32 672, i32* %36
%37 = getelementptr inbounds i8, i8* %0, i64 1104
%38 = bitcast i8* %37 to i32*
store i32 672, i32* %38
%39 = getelementptr inbounds i8, i8* %0, i64 1168
%40 = bitcast i8* %39 to i32*
store i32 672, i32* %40
%41 = getelementptr inbounds i8, i8* %0, i64 1232
%42 = bitcast i8* %41 to i32*
store i32 672, i32* %42
%43 = getelementptr inbounds i8, i8* %0, i64 1296
%44 = bitcast i8* %43 to i32*
store i32 672, i32* %44
%45 = getelementptr inbounds i8, i8* %0, i64 1360
%46 = bitcast i8* %45 to i32*
store i32 672, i32* %46
%47 = getelementptr inbounds i8, i8* %0, i64 1424
%48 = bitcast i8* %47 to i32*
store i32 672, i32* %48
%49 = getelementptr inbounds i8, i8* %0, i64 1488
%50 = bitcast i8* %49 to i32*
store i32 672, i32* %50
%51 = or i32 %22, 2100992
store i32 %51, i32* %9
%52 = tail call i32 @usleep(i32 20)
%53 = load i32, i32* %9
%54 = and i32 %53, -2097153
store i32 %54, i32* %9
%55 = tail call i32 @usleep(i32 20)
switch i32 %1, label %70 [
i32 16, label %56
i32 32, label %63
]
56: ; preds = %3
%57 = load i32, i32* %9
%58 = or i32 %57, 4
store i32 %58, i32* %9
store i32 20000000, i32* %7
%59 = load i32, i32* @CLOCK_REALTIME
%60 = call i32 @clock_nanosleep(i32 %59, i32 0, %struct.timespec* %4, i32 0)
%61 = load i32, i32* %9
%62 = and i32 %61, -9
br label %73
63: ; preds = %3
%64 = load i32, i32* %9
%65 = and i32 %64, -5
store i32 %65, i32* %9
store i32 20000000, i32* %7
%66 = load i32, i32* @CLOCK_REALTIME
%67 = call i32 @clock_nanosleep(i32 %66, i32 0, %struct.timespec* %4, i32 0)
%68 = load i32, i32* %9
%69 = or i32 %68, 8
br label %73
70: ; preds = %3
%71 = load i32, i32* @stderr
%72 = tail call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %78
73: ; preds = %63, %56
%74 = phi i32 [ %69, %63 ], [ %62, %56 ]
%75 = and i32 %74, -1793
store i32 %75, i32* %9
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i32 %75)
br label %78
78: ; preds = %73, %70
%79 = phi i32 [ 316, %73 ], [ -1, %70 ]
ret i32 %79
}