#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 EINVAL;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ handle_bad_opts();
int i2c_open(int);
int i2c_select(int, int);
int i2c_write_freq(int, int /*<<< orphan*/);
char *optarg;
scalar_t__ opterr;
int /*<<< orphan*/ print_help(char *);
int read_int(char *);
int sscanf(char *, char *, float *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ tea5767_mhz_to_regs(float);
int main(int argc, char *argv[]) {
  int file = -1;
  int res;
  if (argc < 2) {
    print_help(argv[0]);
    return 0;
  }
  int c;
  int ad = (0x60);
  opterr = 0;
  while ((c = getopt(argc, argv, "a:b:f:")) != -1) {
    switch (c) {
    case 'a': {
      if (file < 0) {
        fprintf(stderr,
                "ERROR: bus number not set prior to address selection.\n\n");
        print_help(argv[0]);
        return -EINVAL;
      }
      if ((ad = read_int(optarg)) < 0) {
        fprintf(stderr, "ERROR: invalid slave address `%s'.\n\n", optarg);
        print_help(argv[0]);
        return -EINVAL;
      }
      if ((ad < 0x03) || (ad > 0x7f)) {
        fprintf(stderr,
                "ERROR: invalid slave address `%s' (out of valid range of 0x03 "
                "to 0x7f).\n\n",
                optarg);
        print_help(argv[0]);
        return -EINVAL;
      }
      if ((res = i2c_select(file, ad)) < 0) {
        close(file);
        return res;
      }
      fprintf(stdout, "Address set to 0x%02x\n", ad);
      break;
    }
    case 'b': {
      if (file >= 0) {
        close(file);
        file = -1;
      }
      int bn;
      if ((bn = read_int(optarg)) < 0) {
        fprintf(stderr, "ERROR: invalid bus number `%s'.\n\n", optarg);
        print_help(argv[0]);
        return -EINVAL;
      }
      if ((file = i2c_open(bn)) < 0) {
        return file;
      }
      if ((res = i2c_select(file, ad)) < 0) {
        close(file);
        return res;
      }
      fprintf(stdout, "Address set to 0x%02x\n", ad);
      break;
    }
    case 'f': {
      if (file < 0) {
        fprintf(stderr, "ERROR: bus number not set prior to operation.\n\n");
        print_help(argv[0]);
        return -EINVAL;
      }
      float mhz;
      res = sscanf(optarg, "%f", &mhz);
      if ((1 != res) || (mhz < 76.0f) || (mhz > 108.0f)) {
        fprintf(stderr, "ERROR: invalid frequency: `%s'.\n\n", optarg);
        return -EINVAL;
      }
      if ((res = i2c_write_freq(file, tea5767_mhz_to_regs(mhz))) < 0) {
        close(file);
        return res;
      }
      fprintf(stdout, "Frequency set to: %3.1f MHz\n", mhz);
      break;
    }
    case '?': {
      handle_bad_opts();
      print_help(argv[0]);
      return -EINVAL;
    }
    default: {
      fprintf(stderr, "BUG: switch fall-through on `%c'!\n", c);
      abort();
    }
    }
  }
  if (file >= 0) {
    close(file);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11ff <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <print_help@plt>
movl   $0x0,-0x4(%rbp)
jmp    15fa <main+0x43a>
movl   $0x60,-0x20(%rbp)
mov    0x2dc3(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe86(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     15e1 <main+0x421>
mov    -0x1c(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x27,%eax
ja     15bb <main+0x3fb>
mov    -0x30(%rbp),%rax
lea    0xdb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x0,-0x14(%rbp)
jge    129c <main+0xdc>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
lea    0xe39(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <print_help@plt>
xor    %eax,%eax
mov    0x2d36(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    15fa <main+0x43a>
mov    0x2d55(%rip),%rax
mov    (%rax),%rdi
call   1090 <read_int@plt>
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jge    12f7 <main+0x137>
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
mov    0x2d31(%rip),%rax
mov    (%rax),%rdx
lea    0xe16(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <print_help@plt>
xor    %eax,%eax
mov    0x2cdb(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    15fa <main+0x43a>
cmpl   $0x3,-0x20(%rbp)
jl     130b <main+0x14b>
cmpl   $0x7f,-0x20(%rbp)
jle    134b <main+0x18b>
mov    0x2cc6(%rip),%rax
mov    (%rax),%edi
mov    0x2cdd(%rip),%rax
mov    (%rax),%rdx
lea    0xde7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <print_help@plt>
xor    %eax,%eax
mov    0x2c87(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    15fa <main+0x43a>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%esi
call   10d0 <i2c_select@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1375 <main+0x1b5>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15fa <main+0x43a>
mov    0x2c44(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%edx
lea    0xdce(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    15dc <main+0x41c>
cmpl   $0x0,-0x14(%rbp)
jl     13ad <main+0x1ed>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
movl   $0xffffffff,-0x14(%rbp)
mov    0x2c44(%rip),%rax
mov    (%rax),%rdi
call   1090 <read_int@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jge    1408 <main+0x248>
mov    0x2c09(%rip),%rax
mov    (%rax),%edi
mov    0x2c20(%rip),%rax
mov    (%rax),%rdx
lea    0xd8b(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <print_help@plt>
xor    %eax,%eax
mov    0x2bca(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    15fa <main+0x43a>
mov    -0x24(%rbp),%edi
call   1060 <i2c_open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1427 <main+0x267>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15fa <main+0x43a>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%esi
call   10d0 <i2c_select@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1451 <main+0x291>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15fa <main+0x43a>
mov    0x2b68(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%edx
lea    0xcf2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    15dc <main+0x41c>
cmpl   $0x0,-0x14(%rbp)
jge    14b0 <main+0x2f0>
mov    0x2b57(%rip),%rax
mov    (%rax),%edi
lea    0xd05(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <print_help@plt>
xor    %eax,%eax
mov    0x2b22(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    15fa <main+0x43a>
mov    0x2b41(%rip),%rax
mov    (%rax),%rdi
lea    0xcfe(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   10a0 <sscanf@plt>
mov    %eax,-0x18(%rbp)
mov    $0x1,%eax
cmp    -0x18(%rbp),%eax
jne    1503 <main+0x343>
movss  0xb1d(%rip),%xmm0
ucomiss -0x28(%rbp),%xmm0
ja     1503 <main+0x343>
movss  -0x28(%rbp),%xmm0
movss  0xb0a(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1537 <main+0x377>
mov    0x2ace(%rip),%rax
mov    (%rax),%edi
mov    0x2ae5(%rip),%rax
mov    (%rax),%rdx
lea    0xca5(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
xor    %eax,%eax
mov    0x2a9b(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    15fa <main+0x43a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
movss  -0x28(%rbp),%xmm0
call   10e0 <tea5767_mhz_to_regs@plt>
mov    -0x34(%rbp),%edi
mov    %eax,%esi
call   1040 <i2c_write_freq@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1570 <main+0x3b0>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15fa <main+0x43a>
mov    0x2a49(%rip),%rax
mov    (%rax),%edi
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc5b(%rip),%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
jmp    15dc <main+0x41c>
mov    $0x0,%al
call   1050 <handle_bad_opts@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <print_help@plt>
xor    %eax,%eax
mov    0x2a17(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    15fa <main+0x43a>
mov    0x2a16(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xc33(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1214 <main+0x54>
cmpl   $0x0,-0x14(%rbp)
jl     15f3 <main+0x433>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
cmp    $0x1,%edi
jg     11e5 <main+0x25>
mov    (%r14),%rdi
call   10c0 <print_help@plt>
xor    %ebx,%ebx
jmp    1404 <main+0x244>
mov    %edi,%ebp
mov    0x2de2(%rip),%rax
movq   $0x0,(%rax)
mov    $0x60,%eax
mov    %rax,0x10(%rsp)
mov    $0xffffffff,%r12d
lea    0xdfc(%rip),%r15
mov    0x2de5(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   10b0 <getopt@plt>
cmp    $0x66,%eax
jne    12c0 <main+0x100>
test   %r12d,%r12d
js     13af <main+0x1ef>
mov    0x0(%r13),%rdi
lea    0xed5(%rip),%rsi
lea    0xc(%rsp),%rdx
call   10a0 <sscanf@plt>
cmp    $0x1,%eax
jne    13de <main+0x21e>
movss  0xc(%rsp),%xmm0
movss  0xd95(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     13de <main+0x21e>
ucomiss 0xd89(%rip),%xmm0
ja     13de <main+0x21e>
call   10e0 <tea5767_mhz_to_regs@plt>
mov    %r12d,%edi
mov    %eax,%esi
call   1040 <i2c_write_freq@plt>
test   %eax,%eax
js     13d2 <main+0x212>
mov    0x2d21(%rip),%rax
mov    (%rax),%edi
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe92(%rip),%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
jmp    1220 <main+0x60>
xchg   %ax,%ax
cmp    $0x60,%eax
jle    138d <main+0x1cd>
cmp    $0x62,%eax
je     132a <main+0x16a>
cmp    $0x61,%eax
jne    147a <main+0x2ba>
test   %r12d,%r12d
js     1415 <main+0x255>
mov    0x0(%r13),%rdi
call   1090 <read_int@plt>
test   %eax,%eax
js     143d <main+0x27d>
lea    -0x80(%rax),%ecx
cmp    $0xffffff82,%ecx
jbe    1458 <main+0x298>
mov    %r12d,%edi
mov    %rax,%r13
mov    %r13d,%esi
call   10d0 <i2c_select@plt>
test   %eax,%eax
js     13d2 <main+0x212>
mov    0x2ca6(%rip),%rax
mov    (%rax),%edi
lea    0xd93(%rip),%rsi
mov    %r13,0x10(%rsp)
jmp    137e <main+0x1be>
test   %r12d,%r12d
js     1337 <main+0x177>
mov    %r12d,%edi
call   1070 <close@plt>
mov    0x0(%r13),%rdi
call   1090 <read_int@plt>
test   %eax,%eax
js     1427 <main+0x267>
mov    %eax,%edi
call   1060 <i2c_open@plt>
mov    %eax,%r12d
test   %eax,%eax
js     1453 <main+0x293>
mov    %r12d,%edi
mov    0x10(%rsp),%r13
mov    %r13d,%esi
call   10d0 <i2c_select@plt>
test   %eax,%eax
js     13d2 <main+0x212>
mov    0x2c4b(%rip),%rax
mov    (%rax),%edi
lea    0xd38(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    120c <main+0x4c>
cmp    $0xffffffff,%eax
je     13a6 <main+0x1e6>
cmp    $0x3f,%eax
jne    147a <main+0x2ba>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <handle_bad_opts@plt>
jmp    13c8 <main+0x208>
xor    %ebx,%ebx
test   %r12d,%r12d
jns    13d4 <main+0x214>
jmp    1404 <main+0x244>
mov    0x2c22(%rip),%rax
mov    (%rax),%edi
lea    0xd30(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%r14),%rdi
call   10c0 <print_help@plt>
jmp    13fb <main+0x23b>
mov    %eax,%ebx
mov    %r12d,%edi
call   1070 <close@plt>
jmp    1404 <main+0x244>
mov    0x2bf3(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xd30(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x2bc6(%rip),%rax
sub    (%rax),%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bbc(%rip),%rax
mov    (%rax),%edi
lea    0xbea(%rip),%rsi
jmp    13bf <main+0x1ff>
mov    0x2baa(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xc92(%rip),%rsi
jmp    146c <main+0x2ac>
mov    0x2b94(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xbf6(%rip),%rsi
jmp    146c <main+0x2ac>
mov    %r12d,%ebx
jmp    1404 <main+0x244>
mov    0x2b79(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xc00(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    13c8 <main+0x208>
mov    0x2b57(%rip),%rcx
mov    (%rcx),%edi
lea    0xcd7(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@opterr = global i64 0
@.str = [7 x i8] c"a:b:f:\00"
@stderr = global i32 0
@.str.1 = [56 x i8] c"ERROR: bus number not set prior to address selection.\0A\0A\00"
@EINVAL = global i32 0
@optarg = global i8* null
@.str.2 = [37 x i8] c"ERROR: invalid slave address `%s'.\0A\0A\00"
@.str.3 = [74 x i8] c"ERROR: invalid slave address `%s' (out of valid range of 0x03 to 0x7f).\0A\0A\00"
@stdout = global i32 0
@.str.4 = [23 x i8] c"Address set to 0x%02x\0A\00"
@.str.5 = [34 x i8] c"ERROR: invalid bus number `%s'.\0A\0A\00"
@.str.6 = [48 x i8] c"ERROR: bus number not set prior to operation.\0A\0A\00"
@.str.7 = [3 x i8] c"%f\00"
@.str.8 = [34 x i8] c"ERROR: invalid frequency: `%s'.\0A\0A\00"
@.str.9 = [29 x i8] c"Frequency set to: %3.1f MHz\0A\00"
@.str.10 = [35 x i8] c"BUG: switch fall-through on `%c'!\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 float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @print_help(i8* %17)
store i32 0, i32* %3
br label %186
19: ; preds = %2
store i32 96, i32* %9
store i64 0, i64* @opterr
br label %20
20: ; preds = %178, %19
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
%23 = call i32 @getopt(i32 %21, i8** %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %23, i32* %8
%24 = icmp ne i32 %23, -1
br i1 %24, label %25, label %179
25: ; preds = %20
%26 = load i32, i32* %8
switch i32 %26, label %173 [
i32 97, label %27
i32 98, label %82
i32 102, label %121
i32 63, label %165
]
27: ; preds = %25
%28 = load i32, i32* %6
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %39
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = call i32 @print_help(i8* %35)
%37 = load i32, i32* @EINVAL
%38 = sub nsw i32 0, %37
store i32 %38, i32* %3
br label %186
39: ; preds = %27
%40 = load i8*, i8** @optarg
%41 = call i32 @read_int(i8* %40)
store i32 %41, i32* %9
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %53
43: ; preds = %39
%44 = load i32, i32* @stderr
%45 = load i8*, i8** @optarg
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %45)
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 0
%49 = load i8*, i8** %48
%50 = call i32 @print_help(i8* %49)
%51 = load i32, i32* @EINVAL
%52 = sub nsw i32 0, %51
store i32 %52, i32* %3
br label %186
53: ; preds = %39
%54 = load i32, i32* %9
%55 = icmp slt i32 %54, 3
br i1 %55, label %59, label %56
56: ; preds = %53
%57 = load i32, i32* %9
%58 = icmp sgt i32 %57, 127
br i1 %58, label %59, label %69
59: ; preds = %56, %53
%60 = load i32, i32* @stderr
%61 = load i8*, i8** @optarg
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.3, i64 0, i64 0), i8* %61)
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 0
%65 = load i8*, i8** %64
%66 = call i32 @print_help(i8* %65)
%67 = load i32, i32* @EINVAL
%68 = sub nsw i32 0, %67
store i32 %68, i32* %3
br label %186
69: ; preds = %56
%70 = load i32, i32* %6
%71 = load i32, i32* %9
%72 = call i32 @i2c_select(i32 %70, i32 %71)
store i32 %72, i32* %7
%73 = icmp slt i32 %72, 0
br i1 %73, label %74, label %78
74: ; preds = %69
%75 = load i32, i32* %6
%76 = call i32 @close(i32 %75)
%77 = load i32, i32* %7
store i32 %77, i32* %3
br label %186
78: ; preds = %69
%79 = load i32, i32* @stdout
%80 = load i32, i32* %9
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %80)
br label %178
82: ; preds = %25
%83 = load i32, i32* %6
%84 = icmp sge i32 %83, 0
br i1 %84, label %85, label %88
85: ; preds = %82
%86 = load i32, i32* %6
%87 = call i32 @close(i32 %86)
store i32 -1, i32* %6
br label %88
88: ; preds = %85, %82
%89 = load i8*, i8** @optarg
%90 = call i32 @read_int(i8* %89)
store i32 %90, i32* %10
%91 = icmp slt i32 %90, 0
br i1 %91, label %92, label %102
92: ; preds = %88
%93 = load i32, i32* @stderr
%94 = load i8*, i8** @optarg
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %93, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* %94)
%96 = load i8**, i8*** %5
%97 = getelementptr inbounds i8*, i8** %96, i64 0
%98 = load i8*, i8** %97
%99 = call i32 @print_help(i8* %98)
%100 = load i32, i32* @EINVAL
%101 = sub nsw i32 0, %100
store i32 %101, i32* %3
br label %186
102: ; preds = %88
%103 = load i32, i32* %10
%104 = call i32 @i2c_open(i32 %103)
store i32 %104, i32* %6
%105 = icmp slt i32 %104, 0
br i1 %105, label %106, label %108
106: ; preds = %102
%107 = load i32, i32* %6
store i32 %107, i32* %3
br label %186
108: ; preds = %102
%109 = load i32, i32* %6
%110 = load i32, i32* %9
%111 = call i32 @i2c_select(i32 %109, i32 %110)
store i32 %111, i32* %7
%112 = icmp slt i32 %111, 0
br i1 %112, label %113, label %117
113: ; preds = %108
%114 = load i32, i32* %6
%115 = call i32 @close(i32 %114)
%116 = load i32, i32* %7
store i32 %116, i32* %3
br label %186
117: ; preds = %108
%118 = load i32, i32* @stdout
%119 = load i32, i32* %9
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %118, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %119)
br label %178
121: ; preds = %25
%122 = load i32, i32* %6
%123 = icmp slt i32 %122, 0
br i1 %123, label %124, label %133
124: ; preds = %121
%125 = load i32, i32* @stderr
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
%127 = load i8**, i8*** %5
%128 = getelementptr inbounds i8*, i8** %127, i64 0
%129 = load i8*, i8** %128
%130 = call i32 @print_help(i8* %129)
%131 = load i32, i32* @EINVAL
%132 = sub nsw i32 0, %131
store i32 %132, i32* %3
br label %186
133: ; preds = %121
%134 = load i8*, i8** @optarg
%135 = call i32 @sscanf(i8* %134, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %11)
store i32 %135, i32* %7
%136 = load i32, i32* %7
%137 = icmp ne i32 1, %136
br i1 %137, label %144, label %138
138: ; preds = %133
%139 = load float, float* %11
%140 = fcmp olt float %139, 7.600000e+01
br i1 %140, label %144, label %141
141: ; preds = %138
%142 = load float, float* %11
%143 = fcmp ogt float %142, 1.080000e+02
br i1 %143, label %144, label %150
144: ; preds = %141, %138, %133
%145 = load i32, i32* @stderr
%146 = load i8*, i8** @optarg
%147 = call i32 (i32, i8*, ...) @fprintf(i32 %145, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i8* %146)
%148 = load i32, i32* @EINVAL
%149 = sub nsw i32 0, %148
store i32 %149, i32* %3
br label %186
150: ; preds = %141
%151 = load i32, i32* %6
%152 = load float, float* %11
%153 = call i32 @tea5767_mhz_to_regs(float %152)
%154 = call i32 @i2c_write_freq(i32 %151, i32 %153)
store i32 %154, i32* %7
%155 = icmp slt i32 %154, 0
br i1 %155, label %156, label %160
156: ; preds = %150
%157 = load i32, i32* %6
%158 = call i32 @close(i32 %157)
%159 = load i32, i32* %7
store i32 %159, i32* %3
br label %186
160: ; preds = %150
%161 = load i32, i32* @stdout
%162 = load float, float* %11
%163 = fpext float %162 to double
%164 = call i32 (i32, i8*, ...) @fprintf(i32 %161, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), double %163)
br label %178
165: ; preds = %25
%166 = call i32 (...) @handle_bad_opts()
%167 = load i8**, i8*** %5
%168 = getelementptr inbounds i8*, i8** %167, i64 0
%169 = load i8*, i8** %168
%170 = call i32 @print_help(i8* %169)
%171 = load i32, i32* @EINVAL
%172 = sub nsw i32 0, %171
store i32 %172, i32* %3
br label %186
173: ; preds = %25
%174 = load i32, i32* @stderr
%175 = load i32, i32* %8
%176 = call i32 (i32, i8*, ...) @fprintf(i32 %174, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), i32 %175)
%177 = call i32 (...) @abort()
unreachable
178: ; preds = %160, %117, %78
br label %20
179: ; preds = %20
%180 = load i32, i32* %6
%181 = icmp sge i32 %180, 0
br i1 %181, label %182, label %185
182: ; preds = %179
%183 = load i32, i32* %6
%184 = call i32 @close(i32 %183)
br label %185
185: ; preds = %182, %179
store i32 0, i32* %3
br label %186
186: ; preds = %185, %165, %156, %144, %124, %113, %106, %92, %74, %59, %43, %30, %14
%187 = load i32, i32* %3
ret i32 %187
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [7 x i8] c"a:b:f:\00"
@stderr = global i32 0
@.str.1 = [56 x i8] c"ERROR: bus number not set prior to address selection.\0A\0A\00"
@EINVAL = global i32 0
@optarg = global i8* null
@.str.2 = [37 x i8] c"ERROR: invalid slave address `%s'.\0A\0A\00"
@.str.3 = [74 x i8] c"ERROR: invalid slave address `%s' (out of valid range of 0x03 to 0x7f).\0A\0A\00"
@stdout = global i32 0
@.str.4 = [23 x i8] c"Address set to 0x%02x\0A\00"
@.str.5 = [34 x i8] c"ERROR: invalid bus number `%s'.\0A\0A\00"
@.str.6 = [48 x i8] c"ERROR: bus number not set prior to operation.\0A\0A\00"
@.str.7 = [3 x i8] c"%f\00"
@.str.8 = [34 x i8] c"ERROR: invalid frequency: `%s'.\0A\0A\00"
@.str.9 = [29 x i8] c"Frequency set to: %3.1f MHz\0A\00"
@.str.10 = [35 x i8] c"BUG: switch fall-through on `%c'!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca float
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 @print_help(i8* %6)
br label %135
8: ; preds = %2
store i64 0, i64* @opterr
%9 = bitcast float* %3 to i8*
br label %10
10: ; preds = %82, %8
%11 = phi i32 [ %75, %82 ], [ -1, %8 ]
%12 = phi i32 [ %16, %82 ], [ 96, %8 ]
%13 = icmp slt i32 %11, 0
%14 = icmp slt i32 %11, 0
br label %15
15: ; preds = %10, %55
%16 = phi i32 [ %12, %10 ], [ %29, %55 ]
br label %17
17: ; preds = %15, %116
%18 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
switch i32 %18, label %127 [
i32 -1, label %131
i32 97, label %19
i32 98, label %58
i32 102, label %85
i32 63, label %121
]
19: ; preds = %17
br i1 %14, label %20, label %27
20: ; preds = %19
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%23 = load i8*, i8** %1
%24 = call i32 @print_help(i8* %23)
%25 = load i32, i32* @EINVAL
%26 = sub nsw i32 0, %25
br label %135
27: ; preds = %19
%28 = load i8*, i8** @optarg
%29 = call i32 @read_int(i8* %28)
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %27
%32 = load i32, i32* @stderr
%33 = load i8*, i8** @optarg
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = load i8*, i8** %1
%36 = call i32 @print_help(i8* %35)
%37 = load i32, i32* @EINVAL
%38 = sub nsw i32 0, %37
br label %135
39: ; preds = %27
%40 = add nsw i32 %29, -128
%41 = icmp ult i32 %40, -125
br i1 %41, label %42, label %50
42: ; preds = %39
%43 = load i32, i32* @stderr
%44 = load i8*, i8** @optarg
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.3, i64 0, i64 0), i8* %44)
%46 = load i8*, i8** %1
%47 = call i32 @print_help(i8* %46)
%48 = load i32, i32* @EINVAL
%49 = sub nsw i32 0, %48
br label %135
50: ; preds = %39
%51 = call i32 @i2c_select(i32 %11, i32 %29)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = call i32 @close(i32 %11)
br label %135
55: ; preds = %50
%56 = load i32, i32* @stdout
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %29)
br label %15
58: ; preds = %17
%59 = icmp sgt i32 %11, -1
br i1 %59, label %60, label %62
60: ; preds = %58
%61 = call i32 @close(i32 %11)
br label %62
62: ; preds = %60, %58
%63 = load i8*, i8** @optarg
%64 = call i32 @read_int(i8* %63)
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %74
66: ; preds = %62
%67 = load i32, i32* @stderr
%68 = load i8*, i8** @optarg
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* %68)
%70 = load i8*, i8** %1
%71 = call i32 @print_help(i8* %70)
%72 = load i32, i32* @EINVAL
%73 = sub nsw i32 0, %72
br label %135
74: ; preds = %62
%75 = call i32 @i2c_open(i32 %64)
%76 = icmp slt i32 %75, 0
br i1 %76, label %135, label %77
77: ; preds = %74
%78 = call i32 @i2c_select(i32 %75, i32 %16)
%79 = icmp slt i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %77
%81 = call i32 @close(i32 %75)
br label %135
82: ; preds = %77
%83 = load i32, i32* @stdout
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %16)
br label %10
85: ; preds = %17
br i1 %13, label %86, label %93
86: ; preds = %85
%87 = load i32, i32* @stderr
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
%89 = load i8*, i8** %1
%90 = call i32 @print_help(i8* %89)
%91 = load i32, i32* @EINVAL
%92 = sub nsw i32 0, %91
br label %135
93: ; preds = %85
%94 = load i8*, i8** @optarg
%95 = call i32 @sscanf(i8* %94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %3)
%96 = icmp ne i32 %95, 1
%97 = load float, float* %3
%98 = fcmp olt float %97, 7.600000e+01
%99 = select i1 %96, i1 true, i1 %98
%100 = fcmp ogt float %97, 1.080000e+02
%101 = select i1 %99, i1 true, i1 %100
br i1 %101, label %102, label %108
102: ; preds = %93
%103 = load i32, i32* @stderr
%104 = load i8*, i8** @optarg
%105 = call i32 (i32, i8*, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i8* %104)
%106 = load i32, i32* @EINVAL
%107 = sub nsw i32 0, %106
br label %114
108: ; preds = %93
%109 = call i32 @tea5767_mhz_to_regs(float %97)
%110 = call i32 @i2c_write_freq(i32 %11, i32 %109)
%111 = icmp slt i32 %110, 0
br i1 %111, label %112, label %116
112: ; preds = %108
%113 = call i32 @close(i32 %11)
br label %114
114: ; preds = %112, %102
%115 = phi i32 [ %107, %102 ], [ %110, %112 ]
br label %135
116: ; preds = %108
%117 = load i32, i32* @stdout
%118 = load float, float* %3
%119 = fpext float %118 to double
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), double %119)
br label %17
121: ; preds = %17
%122 = call i32 (...) @handle_bad_opts()
%123 = load i8*, i8** %1
%124 = call i32 @print_help(i8* %123)
%125 = load i32, i32* @EINVAL
%126 = sub nsw i32 0, %125
br label %135
127: ; preds = %17
%128 = load i32, i32* @stderr
%129 = call i32 (i32, i8*, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), i32 %18)
%130 = call i32 (...) @abort()
unreachable
131: ; preds = %17
%132 = icmp sgt i32 %11, -1
br i1 %132, label %133, label %135
133: ; preds = %131
%134 = call i32 @close(i32 %11)
br label %135
135: ; preds = %74, %66, %80, %114, %20, %31, %42, %53, %86, %121, %133, %131, %5
%136 = phi i32 [ 0, %5 ], [ %126, %121 ], [ %92, %86 ], [ %26, %20 ], [ %38, %31 ], [ %49, %42 ], [ %51, %53 ], [ 0, %133 ], [ 0, %131 ], [ %115, %114 ], [ %73, %66 ], [ %78, %80 ], [ %75, %74 ]
ret i32 %136
}