#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void help(void) {
  FILE *fptr;
  char s[100];
  fprintf(stderr,
          "Syntax: eepromer [-r|-w|-e|-p]  -f /dev/i2c-X  ADDRESS \n\n");
  fprintf(stderr, "  ADDRESS is address of i2c device eg. 0x51\n");
  if ((fptr = fopen("/proc/bus/i2c", "r"))) {
    fprintf(stderr, "  Installed I2C busses:\n");
    while (fgets(s, 100, fptr))
      fprintf(stderr, "    %s", s);
    fclose(fptr);
  }
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xecb(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
lea    0xeea(%rip),%rdi
lea    0xef1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     11f3 <help+0xb3>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x64,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11ea <help+0xaa>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
lea    -0x70(%rbp),%rdx
lea    0xeb2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    11ae <help+0x6e>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    0x2e8e(%rip),%r12
mov    (%r12),%edi
lea    0xea3(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r12),%edi
lea    0xecb(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xeea(%rip),%rdi
lea    0xef1(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11fe <help+0xbe>
mov    %rax,%r15
mov    (%r12),%edi
lea    0xedb(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rsp,%rdi
mov    $0x64,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     11f6 <help+0xb6>
lea    0xed1(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12),%edi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    11d0 <help+0x90>
mov    %r15,%rdi
call   1030 <fclose@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [58 x i8] c"Syntax: eepromer [-r|-w|-e|-p] -f /dev/i2c-X ADDRESS \0A\0A\00"
@.str.1 = [45 x i8] c" ADDRESS is address of i2c device eg. 0x51\0A\00"
@.str.2 = [14 x i8] c"/proc/bus/i2c\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [25 x i8] c" Installed I2C busses:\0A\00"
@.str.5 = [7 x i8] c" %s\00"
define void @help() {
%1 = alloca i32*
%2 = alloca [100 x i8]
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %7, i32** %1
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %24
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
br label %12
12: ; preds = %17, %9
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%14 = load i32*, i32** %1
%15 = call i64 @fgets(i8* %13, i32 100, i32* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %19)
br label %12
21: ; preds = %12
%22 = load i32*, i32** %1
%23 = call i32 @fclose(i32* %22)
br label %24
24: ; preds = %21, %0
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [58 x i8] c"Syntax: eepromer [-r|-w|-e|-p] -f /dev/i2c-X ADDRESS \0A\0A\00"
@.str.1 = [45 x i8] c" ADDRESS is address of i2c device eg. 0x51\0A\00"
@.str.2 = [14 x i8] c"/proc/bus/i2c\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [25 x i8] c" Installed I2C busses:\0A\00"
@.str.5 = [7 x i8] c" %s\00"
define void @help() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stderr
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %21, label %9
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%12 = call i64 @fgets(i8* %2, i32 100, i32* %7)
%13 = icmp eq i64 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %9, %14
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%17 = call i64 @fgets(i8* %2, i32 100, i32* %7)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %14
19: ; preds = %14, %9
%20 = call i32 @fclose(i32* %7)
br label %21
21: ; preds = %19, %0
ret void
}