#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 __u8;
typedef int __s32;

/* Variables and functions */
int /*<<< orphan*/ I2C_SLAVE;
int /*<<< orphan*/ O_RDWR;
int atoi(char *);
int /*<<< orphan*/ exit(int);
int getopt(int, char **, char *);
int i2c_smbus_read_word_data(int, int);
int /*<<< orphan*/ i2c_smbus_write_word_data(int, int, int);
scalar_t__ ioctl(int, int /*<<< orphan*/, int);
int open(char *, int /*<<< orphan*/);
char *optarg;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  int c, conf_reg, address, file, temp_high, temp_low;
  float t;
  __u8 reg = 0x00;
  __s32 res, b1, b0;
  while (1) {
    c = getopt(argc, argv, "A:C:L:H:");
    if (c == -1) {
      break;
    }
    switch (c) {
    case 'A':
      address = atoi(optarg);
      printf("The selected chip-address is: %s\n", optarg);
      break;
    case 'C':
      conf_reg = atoi(optarg);
      printf("The CONFIG_REGISTER value is: %s\n", optarg);
      break;
    case 'L':
      temp_low = atoi(optarg);
      printf("The TEMP_LOW_REGISTER value is: %s\n", optarg);
      break;
    case 'H':
      temp_high = atoi(optarg);
      printf("The TEMP_HIGH_REGISTER value is: %s\n", optarg);
      break;
    default:
      printf("Usage: %s -A [chip-address] -C [config-reg] -L [t_low-reg] -H "
             "[t_high-reg] \n",
             argv[0]);
      exit(1);
    }
  }
  printf("The value stored in the parameters: %#04x %#04x %#04x %#04x !\n",
         address, conf_reg, temp_low, temp_high);
  file = open("/dev/i2c-1", O_RDWR);
  if (file < 0) {
    printf("ERROR open(%d)failed\n", file);
    exit(1);
  }
  if (address < 0 || address > 119) {
    printf("Chip address is out of 0x00 - 0x77 range!\n");
    exit(-1);
  }
  if (ioctl(file, I2C_SLAVE, address) < 0) {
    printf("IOCTL failed\n");
    exit(1);
  }
  if (conf_reg > 255 || conf_reg < 0) {
    printf("The CONFIG_REGISTER value is out of range!\n");
    exit(-1);
  } else {
    i2c_smbus_write_word_data(file, 0x01, conf_reg);
  }
  if (temp_low > 65535 || temp_low < 0) {
    printf("The TEMP_LOW_REGISTER register value is out of range!\n");
    exit(-1);
  } else {
    i2c_smbus_write_word_data(file, 0x02, temp_low);
  }
  if (temp_high > 65535 || temp_high < 0) {
    printf("The TEMP_HIGH_REGISTER value is out of range!\n");
    exit(-1);
  } else {
    i2c_smbus_write_word_data(file, 0x03, temp_high);
  }
  while (1) {
    res = i2c_smbus_read_word_data(file, reg);
    if (res < 0) {
      printf("SMBus read failed\n");
      exit(1);
    } else {
      b1 = (res & 0X000000ff) << 4;
      b0 = (res & 0X0000f000) >> 12;
      t = (b0 + b1) * 0.0625;
      printf("The temperature is: %.4f °C\n", t);
    }
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe7d(%rip),%rdx
call   1080 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    11d2 <main+0x42>
jmp    12db <main+0x14b>
mov    -0x14(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0xb,%eax
ja     12b7 <main+0x127>
mov    -0x48(%rbp),%rax
lea    0xe16(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2df6(%rip),%rax
mov    (%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2de4(%rip),%rax
mov    (%rax),%rsi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d6 <main+0x146>
mov    0x2dc7(%rip),%rax
mov    (%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    0x2db5(%rip),%rax
mov    (%rax),%rsi
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d6 <main+0x146>
mov    0x2d98(%rip),%rax
mov    (%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    0x2d86(%rip),%rax
mov    (%rax),%rsi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d6 <main+0x146>
mov    0x2d69(%rip),%rax
mov    (%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    0x2d57(%rip),%rax
mov    (%rax),%rsi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d6 <main+0x146>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    11ad <main+0x1d>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%r8d
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2ce3(%rip),%rax
mov    (%rax),%esi
lea    0xe54(%rip),%rdi
call   1070 <open@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    1333 <main+0x1a3>
mov    -0x20(%rbp),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
cmpl   $0x0,-0x1c(%rbp)
jl     1347 <main+0x1b7>
cmpl   $0x77,-0x1c(%rbp)
jle    135f <main+0x1cf>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%edi
mov    0x2c6f(%rip),%rax
mov    (%rax),%esi
mov    -0x1c(%rbp),%edx
call   1040 <ioctl@plt>
cmp    $0x0,%rax
jge    1395 <main+0x205>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
cmpl   $0xff,-0x18(%rbp)
jg     13ac <main+0x21c>
cmpl   $0x0,-0x18(%rbp)
jge    13c4 <main+0x234>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%edx
mov    $0x1,%esi
call   1050 <i2c_smbus_write_word_data@plt>
cmpl   $0xffff,-0x28(%rbp)
jg     13eb <main+0x25b>
cmpl   $0x0,-0x28(%rbp)
jge    1403 <main+0x273>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%edi
mov    -0x28(%rbp),%edx
mov    $0x2,%esi
call   1050 <i2c_smbus_write_word_data@plt>
cmpl   $0xffff,-0x24(%rbp)
jg     142a <main+0x29a>
cmpl   $0x0,-0x24(%rbp)
jge    1442 <main+0x2b2>
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%edx
mov    $0x3,%esi
call   1050 <i2c_smbus_write_word_data@plt>
jmp    1457 <main+0x2c7>
mov    -0x20(%rbp),%edi
mov    -0x30(%rbp),%esi
call   1060 <i2c_smbus_read_word_data@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1487 <main+0x2f7>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x34(%rbp),%eax
and    $0xff,%eax
shl    $0x4,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
and    $0xf000,%eax
sar    $0xc,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
add    -0x38(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xb4b(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd87(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
jmp    1457 <main+0x2c7>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r12
mov    %edi,%ebx
lea    0xe4e(%rip),%r14
mov    0x2e37(%rip),%r15
jmp    11ef <main+0x4f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r15),%rbp
mov    %rbp,%rdi
call   10a0 <atoi@plt>
mov    %eax,%r13d
lea    0xe4e(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r14,%rdx
call   1090 <getopt@plt>
cmp    $0x43,%eax
je     11d0 <main+0x30>
cmp    $0x47,%eax
jle    122c <main+0x8c>
cmp    $0x48,%eax
je     1249 <main+0xa9>
cmp    $0x4c,%eax
jne    12bb <main+0x11b>
mov    (%r15),%rbp
mov    %rbp,%rdi
call   10a0 <atoi@plt>
mov    %eax,0x10(%rsp)
lea    0xe2b(%rip),%rdi
jmp    11e5 <main+0x45>
cmp    $0x41,%eax
jne    1261 <main+0xc1>
mov    (%r15),%rbp
mov    %rbp,%rdi
call   10a0 <atoi@plt>
mov    %eax,0x14(%rsp)
lea    0xdca(%rip),%rdi
jmp    11e5 <main+0x45>
mov    (%r15),%rbp
mov    %rbp,%rdi
call   10a0 <atoi@plt>
mov    %eax,0xc(%rsp)
lea    0xe1a(%rip),%rdi
jmp    11e5 <main+0x45>
cmp    $0xffffffff,%eax
jne    12bb <main+0x11b>
lea    0xe7e(%rip),%rdi
mov    0x14(%rsp),%ebp
mov    %ebp,%esi
mov    %r13d,%edx
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2d53(%rip),%rax
mov    (%rax),%esi
lea    0xe94(%rip),%rdi
call   1080 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    12d7 <main+0x137>
lea    0xe8d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    (%r12),%rsi
lea    0xdd8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
cmp    $0x78,%ebp
jb     12f2 <main+0x152>
lea    0xf34(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    0x2cdf(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %ebp,%edx
call   1050 <ioctl@plt>
test   %rax,%rax
jns    131f <main+0x17f>
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
cmp    $0x100,%r13d
jb     1331 <main+0x191>
lea    0xeb0(%rip),%rdi
jmp    12e3 <main+0x143>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %r13d,%edx
call   1060 <i2c_smbus_write_word_data@plt>
mov    0x10(%rsp),%edx
cmp    $0x10000,%edx
jb     1355 <main+0x1b5>
lea    0xe56(%rip),%rdi
jmp    12e3 <main+0x143>
mov    %ebx,%edi
mov    $0x2,%esi
call   1060 <i2c_smbus_write_word_data@plt>
mov    0xc(%rsp),%edx
cmp    $0x10000,%edx
jb     1379 <main+0x1d9>
lea    0xe07(%rip),%rdi
jmp    12e3 <main+0x143>
mov    %ebx,%edi
mov    $0x3,%esi
call   1060 <i2c_smbus_write_word_data@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <i2c_smbus_read_word_data@plt>
test   %eax,%eax
js     13e6 <main+0x246>
lea    0xdb2(%rip),%rbp
nopl   0x0(%rax)
movzbl %al,%ecx
shl    $0x4,%ecx
shr    $0xc,%eax
and    $0xf,%eax
or     %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xc43(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <i2c_smbus_read_word_data@plt>
test   %eax,%eax
jns    13a0 <main+0x200>
lea    0xd7c(%rip),%rdi
jmp    1310 <main+0x170>

LLVM IR (-O0):
@.str = [9 x i8] c"A:C:L:H:\00"
@optarg = global i8* null
@.str.1 = [34 x i8] c"The selected chip-address is: %s\0A\00"
@.str.2 = [34 x i8] c"The CONFIG_REGISTER value is: %s\0A\00"
@.str.3 = [36 x i8] c"The TEMP_LOW_REGISTER value is: %s\0A\00"
@.str.4 = [37 x i8] c"The TEMP_HIGH_REGISTER value is: %s\0A\00"
@.str.5 = [77 x i8] c"Usage: %s -A [chip-address] -C [config-reg] -L [t_low-reg] -H [t_high-reg] \0A\00"
@.str.6 = [63 x i8] c"The value stored in the parameters: %x %x %x %x !\0A\00"
@.str.7 = [11 x i8] c"/dev/i2c-1\00"
@O_RDWR = global i32 0
@.str.8 = [22 x i8] c"ERROR open(%d)failed\0A\00"
@.str.9 = [43 x i8] c"Chip address is out of 0x00 - 0x77 range!\0A\00"
@I2C_SLAVE = global i32 0
@.str.10 = [14 x i8] c"IOCTL failed\0A\00"
@.str.11 = [44 x i8] c"The CONFIG_REGISTER value is out of range!\0A\00"
@.str.12 = [55 x i8] c"The TEMP_LOW_REGISTER register value is out of range!\0A\00"
@.str.13 = [47 x i8] c"The TEMP_HIGH_REGISTER value is out of range!\0A\00"
@.str.14 = [19 x i8] c"SMBus read failed\0A\00"
@.str.15 = [30 x i8] c"The temperature is: %.4f \C2\B0C\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca float
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %13
br label %17
17: ; preds = %2, %52
%18 = load i32, i32* %4
%19 = load i8**, i8*** %5
%20 = call i32 @getopt(i32 %18, i8** %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %24
23: ; preds = %17
br label %53
24: ; preds = %17
%25 = load i32, i32* %6
switch i32 %25, label %46 [
i32 65, label %26
i32 67, label %31
i32 76, label %36
i32 72, label %41
]
26: ; preds = %24
%27 = load i8*, i8** @optarg
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %8
%29 = load i8*, i8** @optarg
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %29)
br label %52
31: ; preds = %24
%32 = load i8*, i8** @optarg
%33 = call i32 @atoi(i8* %32)
store i32 %33, i32* %7
%34 = load i8*, i8** @optarg
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %34)
br label %52
36: ; preds = %24
%37 = load i8*, i8** @optarg
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %11
%39 = load i8*, i8** @optarg
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %39)
br label %52
41: ; preds = %24
%42 = load i8*, i8** @optarg
%43 = call i32 @atoi(i8* %42)
store i32 %43, i32* %10
%44 = load i8*, i8** @optarg
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %44)
br label %52
46: ; preds = %24
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 0
%49 = load i8*, i8** %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.5, i64 0, i64 0), i8* %49)
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %41, %36, %31, %26
br label %17
53: ; preds = %23
%54 = load i32, i32* %8
%55 = load i32, i32* %7
%56 = load i32, i32* %11
%57 = load i32, i32* %10
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i32 %54, i32 %55, i32 %56, i32 %57)
%59 = load i32, i32* @O_RDWR
%60 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %59)
store i32 %60, i32* %9
%61 = load i32, i32* %9
%62 = icmp slt i32 %61, 0
br i1 %62, label %63, label %67
63: ; preds = %53
%64 = load i32, i32* %9
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 %64)
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %53
%68 = load i32, i32* %8
%69 = icmp slt i32 %68, 0
br i1 %69, label %73, label %70
70: ; preds = %67
%71 = load i32, i32* %8
%72 = icmp sgt i32 %71, 119
br i1 %72, label %73, label %76
73: ; preds = %70, %67
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0))
%75 = call i32 @exit(i32 -1)
unreachable
76: ; preds = %70
%77 = load i32, i32* %9
%78 = load i32, i32* @I2C_SLAVE
%79 = load i32, i32* %8
%80 = call i64 @ioctl(i32 %77, i32 %78, i32 %79)
%81 = icmp slt i64 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %76
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %76
%86 = load i32, i32* %7
%87 = icmp sgt i32 %86, 255
br i1 %87, label %91, label %88
88: ; preds = %85
%89 = load i32, i32* %7
%90 = icmp slt i32 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %88, %85
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0))
%93 = call i32 @exit(i32 -1)
unreachable
94: ; preds = %88
%95 = load i32, i32* %9
%96 = load i32, i32* %7
%97 = call i32 @i2c_smbus_write_word_data(i32 %95, i32 1, i32 %96)
br label %98
98: ; preds = %94
%99 = load i32, i32* %11
%100 = icmp sgt i32 %99, 65535
br i1 %100, label %104, label %101
101: ; preds = %98
%102 = load i32, i32* %11
%103 = icmp slt i32 %102, 0
br i1 %103, label %104, label %107
104: ; preds = %101, %98
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.12, i64 0, i64 0))
%106 = call i32 @exit(i32 -1)
unreachable
107: ; preds = %101
%108 = load i32, i32* %9
%109 = load i32, i32* %11
%110 = call i32 @i2c_smbus_write_word_data(i32 %108, i32 2, i32 %109)
br label %111
111: ; preds = %107
%112 = load i32, i32* %10
%113 = icmp sgt i32 %112, 65535
br i1 %113, label %117, label %114
114: ; preds = %111
%115 = load i32, i32* %10
%116 = icmp slt i32 %115, 0
br i1 %116, label %117, label %120
117: ; preds = %114, %111
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.13, i64 0, i64 0))
%119 = call i32 @exit(i32 -1)
unreachable
120: ; preds = %114
%121 = load i32, i32* %9
%122 = load i32, i32* %10
%123 = call i32 @i2c_smbus_write_word_data(i32 %121, i32 3, i32 %122)
br label %124
124: ; preds = %120
br label %125
125: ; preds = %124, %150
%126 = load i32, i32* %9
%127 = load i32, i32* %13
%128 = call i32 @i2c_smbus_read_word_data(i32 %126, i32 %127)
store i32 %128, i32* %14
%129 = load i32, i32* %14
%130 = icmp slt i32 %129, 0
br i1 %130, label %131, label %134
131: ; preds = %125
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0))
%133 = call i32 @exit(i32 1)
unreachable
134: ; preds = %125
%135 = load i32, i32* %14
%136 = and i32 %135, 255
%137 = shl i32 %136, 4
store i32 %137, i32* %15
%138 = load i32, i32* %14
%139 = and i32 %138, 61440
%140 = ashr i32 %139, 12
store i32 %140, i32* %16
%141 = load i32, i32* %16
%142 = load i32, i32* %15
%143 = add nsw i32 %141, %142
%144 = sitofp i32 %143 to double
%145 = fmul double %144, 6.250000e-02
%146 = fptrunc double %145 to float
store float %146, float* %12
%147 = load float, float* %12
%148 = fpext float %147 to double
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.15, i64 0, i64 0), double %148)
br label %150
150: ; preds = %134
%151 = call i32 @sleep(i32 1)
br label %125
}

LLVM IR (-O2):
@.str = [9 x i8] c"A:C:L:H:\00"
@optarg = global i8* null
@.str.1 = [34 x i8] c"The selected chip-address is: %s\0A\00"
@.str.2 = [34 x i8] c"The CONFIG_REGISTER value is: %s\0A\00"
@.str.3 = [36 x i8] c"The TEMP_LOW_REGISTER value is: %s\0A\00"
@.str.4 = [37 x i8] c"The TEMP_HIGH_REGISTER value is: %s\0A\00"
@.str.5 = [77 x i8] c"Usage: %s -A [chip-address] -C [config-reg] -L [t_low-reg] -H [t_high-reg] \0A\00"
@.str.6 = [63 x i8] c"The value stored in the parameters: %x %x %x %x !\0A\00"
@.str.7 = [11 x i8] c"/dev/i2c-1\00"
@O_RDWR = global i32 0
@.str.8 = [22 x i8] c"ERROR open(%d)failed\0A\00"
@I2C_SLAVE = global i32 0
@.str.15 = [30 x i8] c"The temperature is: %.4f \C2\B0C\0A\00"
@str = [18 x i8] c"SMBus read failed\00"
@str.16 = [46 x i8] c"The TEMP_HIGH_REGISTER value is out of range!\00"
@str.17 = [54 x i8] c"The TEMP_LOW_REGISTER register value is out of range!\00"
@str.18 = [43 x i8] c"The CONFIG_REGISTER value is out of range!\00"
@str.19 = [13 x i8] c"IOCTL failed\00"
@str.20 = [42 x i8] c"Chip address is out of 0x00 - 0x77 range!\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %26, %2
%4 = phi i32 [ %28, %26 ], [ undef, %2 ]
%5 = phi i32 [ %9, %26 ], [ undef, %2 ]
%6 = phi i32 [ %13, %26 ], [ undef, %2 ]
%7 = phi i32 [ %16, %26 ], [ undef, %2 ]
br label %8
8: ; preds = %3, %30
%9 = phi i32 [ %5, %3 ], [ %32, %30 ]
%10 = phi i32 [ %6, %3 ], [ %13, %30 ]
%11 = phi i32 [ %7, %3 ], [ %16, %30 ]
br label %12
12: ; preds = %8, %18
%13 = phi i32 [ %10, %8 ], [ %20, %18 ]
%14 = phi i32 [ %11, %8 ], [ %16, %18 ]
br label %15
15: ; preds = %12, %22
%16 = phi i32 [ %24, %22 ], [ %14, %12 ]
%17 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
switch i32 %17, label %34 [
i32 -1, label %38
i32 65, label %18
i32 67, label %22
i32 76, label %26
i32 72, label %30
]
18: ; preds = %15
%19 = load i8*, i8** @optarg
%20 = tail call i32 @atoi(i8* %19)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %12
22: ; preds = %15
%23 = load i8*, i8** @optarg
%24 = tail call i32 @atoi(i8* %23)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %23)
br label %15
26: ; preds = %15
%27 = load i8*, i8** @optarg
%28 = tail call i32 @atoi(i8* %27)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %27)
br label %3
30: ; preds = %15
%31 = load i8*, i8** @optarg
%32 = tail call i32 @atoi(i8* %31)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %31)
br label %8
34: ; preds = %15
%35 = load i8*, i8** %1
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @.str.5, i64 0, i64 0), i8* %35)
%37 = tail call i32 @exit(i32 1)
unreachable
38: ; preds = %15
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i32 %13, i32 %16, i32 %4, i32 %9)
%40 = load i32, i32* @O_RDWR
%41 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %40)
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i32 %41)
%45 = tail call i32 @exit(i32 1)
unreachable
46: ; preds = %38
%47 = icmp ugt i32 %13, 119
br i1 %47, label %48, label %51
48: ; preds = %46
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.20, i64 0, i64 0))
%50 = tail call i32 @exit(i32 -1)
unreachable
51: ; preds = %46
%52 = load i32, i32* @I2C_SLAVE
%53 = tail call i64 @ioctl(i32 %41, i32 %52, i32 %13)
%54 = icmp slt i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %51
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.19, i64 0, i64 0))
%57 = tail call i32 @exit(i32 1)
unreachable
58: ; preds = %51
%59 = icmp ugt i32 %16, 255
br i1 %59, label %60, label %63
60: ; preds = %58
%61 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.18, i64 0, i64 0))
%62 = tail call i32 @exit(i32 -1)
unreachable
63: ; preds = %58
%64 = tail call i32 @i2c_smbus_write_word_data(i32 %41, i32 1, i32 %16)
%65 = icmp ugt i32 %4, 65535
br i1 %65, label %66, label %69
66: ; preds = %63
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.17, i64 0, i64 0))
%68 = tail call i32 @exit(i32 -1)
unreachable
69: ; preds = %63
%70 = tail call i32 @i2c_smbus_write_word_data(i32 %41, i32 2, i32 %4)
%71 = icmp ugt i32 %9, 65535
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.16, i64 0, i64 0))
%74 = tail call i32 @exit(i32 -1)
unreachable
75: ; preds = %69
%76 = tail call i32 @i2c_smbus_write_word_data(i32 %41, i32 3, i32 %9)
%77 = tail call i32 @i2c_smbus_read_word_data(i32 %41, i32 0)
%78 = icmp slt i32 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %82, %75
%80 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%81 = tail call i32 @exit(i32 1)
unreachable
82: ; preds = %75, %82
%83 = phi i32 [ %95, %82 ], [ %77, %75 ]
%84 = shl i32 %83, 4
%85 = and i32 %84, 4080
%86 = lshr i32 %83, 12
%87 = and i32 %86, 15
%88 = or i32 %87, %85
%89 = sitofp i32 %88 to double
%90 = fmul double %89, 6.250000e-02
%91 = fptrunc double %90 to float
%92 = fpext float %91 to double
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.15, i64 0, i64 0), double %92)
%94 = tail call i32 @sleep(i32 1)
%95 = tail call i32 @i2c_smbus_read_word_data(i32 %41, i32 0)
%96 = icmp slt i32 %95, 0
br i1 %96, label %79, label %82
}