#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 option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_1;
};
typedef int ssize_t;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int O_CREAT;
int O_RDWR;
int /*<<< orphan*/ SEEK_SET;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
int getopt_long(int, char **, char const *, struct option const *,
                int /*<<< orphan*/ *);
scalar_t__ isprint(char);
int lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
char *malloc(size_t);
int /*<<< orphan*/ no_argument;
int open(char *, int, int);
char *optarg;
size_t optind;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, size_t);
int /*<<< orphan*/ required_argument;
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strtol(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ usage_error(char *);
int write(int, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int fd, opt, j;
  off_t offset = 0;
  char *buf;
  ssize_t num_read, num_write;
  size_t opt_read;
  int flag_lseek = 0;
  int flag_read = 0;
  int flag_write = 0;
  const char shortopts[] = "ho:r:w:";
  const struct option longopts[] = {
      {"help", no_argument, 0, 'h'},
      {"offset", required_argument, 0, 'o'},
      {"read", required_argument, 0, 'r'},
      {"write", required_argument, 0, 'w'},
      {0, 0, 0, 0},
  };
  if (argc < 2) {
    usage_error(argv[0]);
  }
  while ((opt = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
    switch (opt) {
    case 'h':
      usage_error(argv[0]);
    case 'o':
      flag_lseek = 1;
      offset = (off_t)strtol(optarg, NULL, 10);
      break;
    case 'r':
      flag_read = 1;
      opt_read = (ssize_t)strtol(optarg, NULL, 10);
      break;
    case 'w':
      flag_write = 1;
      buf = optarg;
      break;
    case '?':
      break;
    default:
      fprintf(stderr, "Unexpected error\n");
      exit(EXIT_FAILURE);
    }
  }
  if (flag_write && flag_read) {
    fprintf(stderr, "don't using read and write at same time\n");
    usage_error(argv[0]);
  }
  if (argv[optind] == NULL) {
    printf("Choose a file to open\n\n");
    usage_error(argv[0]);
  }
  fd = open(argv[optind], O_RDWR | O_CREAT,
            S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
  if (flag_lseek && lseek(fd, offset, SEEK_SET) == -1) {
    perror("lseek");
    exit(EXIT_FAILURE);
  }
  if (flag_write == 1) {
    if ((num_write = write(fd, buf, strlen(buf))) == -1) {
      perror("write");
      exit(EXIT_FAILURE);
    }
    printf("write succeeded\n");
  }
  if (flag_read == 1) {
    if ((buf = malloc(opt_read)) == NULL) {
      perror("malloc");
      exit(EXIT_FAILURE);
    }
    if ((num_read = read(fd, buf, opt_read)) == -1) {
      perror("read");
      exit(EXIT_FAILURE);
    }
    printf("[file]: %s [start position]: %ld\n", argv[optind], offset);
    for (j = 0; j < num_read; j++) {
      printf("%c", isprint(buf[j]) ? buf[j] : '~');
    }
    printf("\n");
    free(buf);
  }
  close(fd);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    0xdb4(%rip),%rax
mov    %rax,-0x4c(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0xdaa(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    0x2d1c(%rip),%rax
mov    (%rax),%eax
mov    %al,-0xc8(%rbp)
movl   $0x0,-0xc4(%rbp)
movl   $0x68,-0xc0(%rbp)
add    $0x18,%rdi
lea    0xd7a(%rip),%rax
mov    %rax,-0xb8(%rbp)
mov    0x2d17(%rip),%rax
mov    (%rax),%eax
mov    %al,-0xb0(%rbp)
movl   $0x0,-0xac(%rbp)
movl   $0x6f,-0xa8(%rbp)
add    $0x18,%rdi
lea    0xd4c(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0x2ce2(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x98(%rbp)
movl   $0x0,-0x94(%rbp)
movl   $0x72,-0x90(%rbp)
add    $0x18,%rdi
lea    0xd1c(%rip),%rax
mov    %rax,-0x88(%rbp)
mov    0x2cad(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x80(%rbp)
movl   $0x0,-0x7c(%rbp)
movl   $0x77,-0x78(%rbp)
add    $0x18,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1090 <memset@plt>
cmpl   $0x2,-0x8(%rbp)
jge    1344 <main+0x134>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <usage_error@plt>
jmp    1349 <main+0x139>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
lea    -0xd0(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1060 <getopt_long@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     147c <main+0x26c>
mov    -0x18(%rbp),%eax
mov    %eax,-0xd4(%rbp)
sub    $0x3f,%eax
je     144f <main+0x23f>
jmp    1388 <main+0x178>
mov    -0xd4(%rbp),%eax
sub    $0x68,%eax
je     13d8 <main+0x1c8>
jmp    139c <main+0x18c>
mov    -0xd4(%rbp),%eax
sub    $0x6f,%eax
je     13e4 <main+0x1d4>
jmp    13b0 <main+0x1a0>
mov    -0xd4(%rbp),%eax
sub    $0x72,%eax
je     140b <main+0x1fb>
jmp    13c4 <main+0x1b4>
mov    -0xd4(%rbp),%eax
sub    $0x77,%eax
je     1435 <main+0x225>
jmp    1454 <main+0x244>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <usage_error@plt>
movl   $0x1,-0x3c(%rbp)
mov    0x2bfe(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10e0 <strtol@plt>
mov    %eax,-0x20(%rbp)
jmp    1477 <main+0x267>
movl   $0x1,-0x40(%rbp)
mov    0x2bd7(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10e0 <strtol@plt>
cltq
mov    %rax,-0x38(%rbp)
jmp    1477 <main+0x267>
movl   $0x1,-0x44(%rbp)
mov    0x2bad(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1477 <main+0x267>
jmp    1477 <main+0x267>
mov    0x2b4d(%rip),%rax
mov    (%rax),%edi
lea    0xbbb(%rip),%rsi
call   10d0 <fprintf@plt>
mov    0x2b10(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>
jmp    1349 <main+0x139>
cmpl   $0x0,-0x44(%rbp)
je     14b1 <main+0x2a1>
cmpl   $0x0,-0x40(%rbp)
je     14b1 <main+0x2a1>
mov    0x2b11(%rip),%rax
mov    (%rax),%edi
lea    0xb91(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <usage_error@plt>
mov    -0x10(%rbp),%rax
mov    0x2b04(%rip),%rcx
mov    (%rcx),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    14e4 <main+0x2d4>
lea    0xb89(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <usage_error@plt>
mov    -0x10(%rbp),%rax
mov    0x2ad1(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2adb(%rip),%rax
mov    (%rax),%esi
mov    0x2af2(%rip),%rax
or     (%rax),%esi
mov    0x2a69(%rip),%rax
mov    (%rax),%edx
mov    0x2ab0(%rip),%rax
or     (%rax),%edx
mov    0x2a77(%rip),%rax
or     (%rax),%edx
mov    0x2aa6(%rip),%rax
or     (%rax),%edx
mov    0x2a5d(%rip),%rax
or     (%rax),%edx
mov    0x2a24(%rip),%rax
or     (%rax),%edx
call   1110 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1587 <main+0x377>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    0x2a43(%rip),%rax
mov    (%rax),%edx
call   1080 <lseek@plt>
cmp    $0xffffffff,%eax
jne    1587 <main+0x377>
lea    0xafe(%rip),%rdi
call   1120 <perror@plt>
mov    0x2a00(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>
cmpl   $0x1,-0x44(%rbp)
jne    15f6 <main+0x3e6>
mov    -0x14(%rbp),%eax
mov    %eax,-0xe4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xe4(%rbp),%edi
mov    -0xe0(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %eax,-0x30(%rbp)
cmp    $0xffffffff,%eax
jne    15e8 <main+0x3d8>
lea    0xa44(%rip),%rdi
call   1120 <perror@plt>
mov    0x299f(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>
lea    0xa89(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x1,-0x40(%rbp)
jne    1718 <main+0x508>
mov    -0x38(%rbp),%rdi
call   10f0 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1631 <main+0x421>
lea    0xa6b(%rip),%rdi
call   1120 <perror@plt>
mov    0x2956(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   10b0 <read@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
jne    1667 <main+0x457>
lea    0x9c0(%rip),%rdi
call   1120 <perror@plt>
mov    0x2920(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x294e(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%edx
lea    0xa0d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1701 <main+0x4f1>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1100 <isprint@plt>
cmp    $0x0,%rax
je     16cf <main+0x4bf>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0xe8(%rbp)
jmp    16df <main+0x4cf>
mov    $0x7e,%eax
mov    %eax,-0xe8(%rbp)
jmp    16df <main+0x4cf>
mov    -0xe8(%rbp),%esi
lea    0x9c6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1691 <main+0x481>
lea    0x968(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%edi
call   10a0 <close@plt>
mov    0x2849(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rsi,%r13
mov    %edi,%ebp
movabs $0x3a773a723a6f68,%rax
mov    %rax,0x28(%rsp)
lea    0xdf4(%rip),%rax
mov    %rax,0x30(%rsp)
mov    0x2d30(%rip),%rax
mov    (%rax),%al
mov    %al,0x38(%rsp)
movabs $0x6800000000,%rax
mov    %rax,0x3c(%rsp)
lea    0xdd1(%rip),%rax
mov    %rax,0x48(%rsp)
mov    0x2d38(%rip),%rax
mov    (%rax),%al
mov    %al,0x50(%rsp)
movabs $0x6f00000000,%rcx
mov    %rcx,0x54(%rsp)
lea    0xdb0(%rip),%rcx
mov    %rcx,0x60(%rsp)
mov    %al,0x68(%rsp)
movabs $0x7200000000,%rcx
mov    %rcx,0x6c(%rsp)
lea    0xd96(%rip),%rcx
mov    %rcx,0x78(%rsp)
mov    %al,0x80(%rsp)
movabs $0x7700000000,%rax
mov    %rax,0x84(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x90(%rsp)
movq   $0x0,0xa0(%rsp)
cmp    $0x1,%edi
jg     12fe <main+0xde>
mov    0x0(%r13),%rdi
call   10d0 <usage_error@plt>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
lea    0x28(%rsp),%rbx
lea    0x30(%rsp),%r15
lea    0xcea(%rip),%r14
mov    0x2cd3(%rip),%r12
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
xor    %eax,%eax
jmp    133b <main+0x11b>
mov    (%r12),%rax
mov    %rax,0x18(%rsp)
mov    $0x1,%al
mov    %rax,0x10(%rsp)
jmp    1370 <main+0x150>
mov    0x0(%r13),%rdi
call   10d0 <usage_error@plt>
mov    (%r12),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10f0 <strtol@plt>
mov    %rax,0x8(%rsp)
movl   $0x1,0x4(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1080 <getopt_long@plt>
cmp    $0x3f,%eax
je     1370 <main+0x150>
lea    -0x68(%rax),%ecx
cmp    $0xf,%ecx
ja     13b9 <main+0x199>
movslq (%r14,%rcx,4),%rax
add    %r14,%rax
jmp    *%rax
mov    (%r12),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10f0 <strtol@plt>
cltq
mov    %rax,0x20(%rsp)
movl   $0x1,(%rsp)
jmp    1370 <main+0x150>
cmp    $0xffffffff,%eax
jne    14a7 <main+0x287>
mov    (%rsp),%ebp
test   %ebp,%ebp
setne  %al
mov    0x10(%rsp),%rbx
and    %bl,%al
cmp    $0x1,%al
jne    13f3 <main+0x1d3>
mov    0x2bcc(%rip),%rax
mov    (%rax),%edi
lea    0xc84(%rip),%rsi
call   10e0 <fprintf@plt>
mov    0x0(%r13),%rdi
call   10d0 <usage_error@plt>
mov    0x2bc6(%rip),%r14
mov    (%r14),%rax
mov    0x0(%r13,%rax,8),%rdi
test   %rdi,%rdi
mov    0x20(%rsp),%r12
jne    1429 <main+0x209>
lea    0xcbe(%rip),%rdi
call   1050 <puts@plt>
mov    0x0(%r13),%rdi
call   10d0 <usage_error@plt>
mov    (%r14),%rax
mov    0x0(%r13,%rax,8),%rdi
mov    0x2ba8(%rip),%rax
mov    0x2bc1(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2b36(%rip),%rax
mov    0x2b7f(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2b44(%rip),%rax
or     (%rax),%edx
mov    0x2b73(%rip),%rax
or     (%rax),%edx
mov    0x2b2a(%rip),%rax
or     (%rax),%edx
mov    0x2af1(%rip),%rax
or     (%rax),%edx
call   1120 <open@plt>
mov    %eax,%r15d
cmpl   $0x0,0x4(%rsp)
je     14be <main+0x29e>
mov    0x2b19(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
mov    0x8(%rsp),%rsi
call   10a0 <lseek@plt>
cmp    $0xffffffff,%eax
jne    14be <main+0x29e>
lea    0xbf0(%rip),%rdi
jmp    1536 <main+0x316>
mov    0x2afa(%rip),%rax
mov    (%rax),%edi
lea    0xba0(%rip),%rsi
call   10e0 <fprintf@plt>
jmp    153b <main+0x31b>
test   $0x1,%bl
je     14f7 <main+0x2d7>
mov    0x18(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <write@plt>
cmp    $0xffffffff,%eax
jne    14eb <main+0x2cb>
lea    0xb68(%rip),%rdi
jmp    1536 <main+0x316>
lea    0xbcf(%rip),%rdi
call   1050 <puts@plt>
cmp    $0x1,%ebp
jne    15b5 <main+0x395>
mov    %r14,%rbp
mov    %r12,%rdi
call   1100 <malloc@plt>
test   %rax,%rax
jne    1519 <main+0x2f9>
lea    0xb81(%rip),%rdi
jmp    1536 <main+0x316>
mov    %rax,%r14
mov    %r15d,%edi
mov    %rax,%rsi
mov    %r12,%rdx
call   10c0 <read@plt>
cmp    $0xffffffff,%eax
jne    1549 <main+0x329>
lea    0xb16(%rip),%rdi
call   1130 <perror@plt>
mov    0x2a3e(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    %eax,%ebx
mov    0x0(%rbp),%rax
mov    0x0(%r13,%rax,8),%rsi
lea    0xb44(%rip),%rdi
mov    0x8(%rsp),%rdx
xor    %eax,%eax
call   1090 <printf@plt>
test   %ebx,%ebx
jle    15a3 <main+0x383>
mov    %ebx,%r12d
xor    %ebx,%ebx
mov    $0x7e,%r13d
cs nopw 0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%ebp
mov    %ebp,%edi
call   1110 <isprint@plt>
test   %rax,%rax
cmove  %r13d,%ebp
mov    %ebp,%edi
call   1040 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1580 <main+0x360>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    0x29ac(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@__const.main.shortopts = [8 x i8] c"ho:r:w:\00"
@.str = [5 x i8] c"help\00"
@no_argument = global i32 0
@.str.1 = [7 x i8] c"offset\00"
@required_argument = global i32 0
@.str.2 = [5 x i8] c"read\00"
@.str.3 = [6 x i8] c"write\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.4 = [18 x i8] c"Unexpected error\0A\00"
@EXIT_FAILURE = global i32 0
@.str.5 = [41 x i8] c"don't using read and write at same time\0A\00"
@optind = global i64 0
@.str.6 = [24 x i8] c"Choose a file to open\0A\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@SEEK_SET = global i32 0
@.str.7 = [6 x i8] c"lseek\00"
@.str.8 = [17 x i8] c"write succeeded\0A\00"
@.str.9 = [7 x i8] c"malloc\00"
@.str.10 = [34 x i8] c"[file]: %s [start position]: %ld\0A\00"
@.str.11 = [3 x i8] c"%c\00"
@.str.12 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
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 i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [8 x i8]
%18 = alloca [5 x %struct.option]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
%19 = bitcast [8 x i8]* %17 to i8*
%20 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %18, i64 0, i64 0
%21 = getelementptr inbounds %struct.option, %struct.option* %20, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %21
%22 = getelementptr inbounds %struct.option, %struct.option* %20, i32 0, i32 1
%23 = load i32, i32* @no_argument
%24 = trunc i32 %23 to i8
store i8 %24, i8* %22
%25 = getelementptr inbounds %struct.option, %struct.option* %20, i32 0, i32 2
store i32 0, i32* %25
%26 = getelementptr inbounds %struct.option, %struct.option* %20, i32 0, i32 3
store i32 104, i32* %26
%27 = getelementptr inbounds %struct.option, %struct.option* %20, i64 1
%28 = getelementptr inbounds %struct.option, %struct.option* %27, i32 0, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %28
%29 = getelementptr inbounds %struct.option, %struct.option* %27, i32 0, i32 1
%30 = load i32, i32* @required_argument
%31 = trunc i32 %30 to i8
store i8 %31, i8* %29
%32 = getelementptr inbounds %struct.option, %struct.option* %27, i32 0, i32 2
store i32 0, i32* %32
%33 = getelementptr inbounds %struct.option, %struct.option* %27, i32 0, i32 3
store i32 111, i32* %33
%34 = getelementptr inbounds %struct.option, %struct.option* %27, i64 1
%35 = getelementptr inbounds %struct.option, %struct.option* %34, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %35
%36 = getelementptr inbounds %struct.option, %struct.option* %34, i32 0, i32 1
%37 = load i32, i32* @required_argument
%38 = trunc i32 %37 to i8
store i8 %38, i8* %36
%39 = getelementptr inbounds %struct.option, %struct.option* %34, i32 0, i32 2
store i32 0, i32* %39
%40 = getelementptr inbounds %struct.option, %struct.option* %34, i32 0, i32 3
store i32 114, i32* %40
%41 = getelementptr inbounds %struct.option, %struct.option* %34, i64 1
%42 = getelementptr inbounds %struct.option, %struct.option* %41, i32 0, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %42
%43 = getelementptr inbounds %struct.option, %struct.option* %41, i32 0, i32 1
%44 = load i32, i32* @required_argument
%45 = trunc i32 %44 to i8
store i8 %45, i8* %43
%46 = getelementptr inbounds %struct.option, %struct.option* %41, i32 0, i32 2
store i32 0, i32* %46
%47 = getelementptr inbounds %struct.option, %struct.option* %41, i32 0, i32 3
store i32 119, i32* %47
%48 = getelementptr inbounds %struct.option, %struct.option* %41, i64 1
%49 = bitcast %struct.option* %48 to i8*
%50 = load i32, i32* %4
%51 = icmp slt i32 %50, 2
br i1 %51, label %52, label %57
52: ; preds = %2
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 0
%55 = load i8*, i8** %54
%56 = call i32 @usage_error(i8* %55)
br label %57
57: ; preds = %52, %2
br label %58
58: ; preds = %87, %57
%59 = load i32, i32* %4
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds [8 x i8], [8 x i8]* %17, i64 0, i64 0
%62 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %18, i64 0, i64 0
%63 = call i32 @getopt_long(i32 %59, i8** %60, i8* %61, %struct.option* %62, i32* null)
store i32 %63, i32* %7
%64 = icmp ne i32 %63, -1
br i1 %64, label %65, label %88
65: ; preds = %58
%66 = load i32, i32* %7
switch i32 %66, label %82 [
i32 104, label %67
i32 111, label %72
i32 114, label %75
i32 119, label %79
i32 63, label %81
]
67: ; preds = %65
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 0
%70 = load i8*, i8** %69
%71 = call i32 @usage_error(i8* %70)
br label %72
72: ; preds = %65, %67
store i32 1, i32* %14
%73 = load i8*, i8** @optarg
%74 = call i32 @strtol(i8* %73, i32* null, i32 10)
store i32 %74, i32* %9
br label %87
75: ; preds = %65
store i32 1, i32* %15
%76 = load i8*, i8** @optarg
%77 = call i32 @strtol(i8* %76, i32* null, i32 10)
%78 = sext i32 %77 to i64
store i64 %78, i64* %13
br label %87
79: ; preds = %65
store i32 1, i32* %16
%80 = load i8*, i8** @optarg
store i8* %80, i8** %10
br label %87
81: ; preds = %65
br label %87
82: ; preds = %65
%83 = load i32, i32* @stderr
%84 = call i32 @fprintf(i32 %83, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%85 = load i32, i32* @EXIT_FAILURE
%86 = call i32 @exit(i32 %85)
unreachable
87: ; preds = %81, %79, %75, %72
br label %58
88: ; preds = %58
%89 = load i32, i32* %16
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %101
91: ; preds = %88
%92 = load i32, i32* %15
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %101
94: ; preds = %91
%95 = load i32, i32* @stderr
%96 = call i32 @fprintf(i32 %95, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%97 = load i8**, i8*** %5
%98 = getelementptr inbounds i8*, i8** %97, i64 0
%99 = load i8*, i8** %98
%100 = call i32 @usage_error(i8* %99)
br label %101
101: ; preds = %94, %91, %88
%102 = load i8**, i8*** %5
%103 = load i64, i64* @optind
%104 = getelementptr inbounds i8*, i8** %102, i64 %103
%105 = load i8*, i8** %104
%106 = icmp eq i8* %105, null
br i1 %106, label %107, label %113
107: ; preds = %101
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%109 = load i8**, i8*** %5
%110 = getelementptr inbounds i8*, i8** %109, i64 0
%111 = load i8*, i8** %110
%112 = call i32 @usage_error(i8* %111)
br label %113
113: ; preds = %107, %101
%114 = load i8**, i8*** %5
%115 = load i64, i64* @optind
%116 = getelementptr inbounds i8*, i8** %114, i64 %115
%117 = load i8*, i8** %116
%118 = load i32, i32* @O_RDWR
%119 = load i32, i32* @O_CREAT
%120 = or i32 %118, %119
%121 = load i32, i32* @S_IRUSR
%122 = load i32, i32* @S_IWUSR
%123 = or i32 %121, %122
%124 = load i32, i32* @S_IRGRP
%125 = or i32 %123, %124
%126 = load i32, i32* @S_IWGRP
%127 = or i32 %125, %126
%128 = load i32, i32* @S_IROTH
%129 = or i32 %127, %128
%130 = load i32, i32* @S_IWOTH
%131 = or i32 %129, %130
%132 = call i32 @open(i8* %117, i32 %120, i32 %131)
store i32 %132, i32* %6
%133 = load i32, i32* %14
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %145
135: ; preds = %113
%136 = load i32, i32* %6
%137 = load i32, i32* %9
%138 = load i32, i32* @SEEK_SET
%139 = call i32 @lseek(i32 %136, i32 %137, i32 %138)
%140 = icmp eq i32 %139, -1
br i1 %140, label %141, label %145
141: ; preds = %135
%142 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%143 = load i32, i32* @EXIT_FAILURE
%144 = call i32 @exit(i32 %143)
unreachable
145: ; preds = %135, %113
%146 = load i32, i32* %16
%147 = icmp eq i32 %146, 1
br i1 %147, label %148, label %161
148: ; preds = %145
%149 = load i32, i32* %6
%150 = load i8*, i8** %10
%151 = load i8*, i8** %10
%152 = call i32 @strlen(i8* %151)
%153 = call i32 @write(i32 %149, i8* %150, i32 %152)
store i32 %153, i32* %12
%154 = icmp eq i32 %153, -1
br i1 %154, label %155, label %159
155: ; preds = %148
%156 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%157 = load i32, i32* @EXIT_FAILURE
%158 = call i32 @exit(i32 %157)
unreachable
159: ; preds = %148
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
br label %161
161: ; preds = %159, %145
%162 = load i32, i32* %15
%163 = icmp eq i32 %162, 1
br i1 %163, label %164, label %219
164: ; preds = %161
%165 = load i64, i64* %13
%166 = call i8* @malloc(i64 %165)
store i8* %166, i8** %10
%167 = icmp eq i8* %166, null
br i1 %167, label %168, label %172
168: ; preds = %164
%169 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%170 = load i32, i32* @EXIT_FAILURE
%171 = call i32 @exit(i32 %170)
unreachable
172: ; preds = %164
%173 = load i32, i32* %6
%174 = load i8*, i8** %10
%175 = load i64, i64* %13
%176 = call i32 @read(i32 %173, i8* %174, i64 %175)
store i32 %176, i32* %11
%177 = icmp eq i32 %176, -1
br i1 %177, label %178, label %182
178: ; preds = %172
%179 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%180 = load i32, i32* @EXIT_FAILURE
%181 = call i32 @exit(i32 %180)
unreachable
182: ; preds = %172
%183 = load i8**, i8*** %5
%184 = load i64, i64* @optind
%185 = getelementptr inbounds i8*, i8** %183, i64 %184
%186 = load i8*, i8** %185
%187 = load i32, i32* %9
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i8* %186, i32 %187)
store i32 0, i32* %8
br label %189
189: ; preds = %212, %182
%190 = load i32, i32* %8
%191 = load i32, i32* %11
%192 = icmp slt i32 %190, %191
br i1 %192, label %193, label %215
193: ; preds = %189
%194 = load i8*, i8** %10
%195 = load i32, i32* %8
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds i8, i8* %194, i64 %196
%198 = load i8, i8* %197
%199 = call i64 @isprint(i8 signext %198)
%200 = icmp ne i64 %199, 0
br i1 %200, label %201, label %208
201: ; preds = %193
%202 = load i8*, i8** %10
%203 = load i32, i32* %8
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds i8, i8* %202, i64 %204
%206 = load i8, i8* %205
%207 = sext i8 %206 to i32
br label %209
208: ; preds = %193
br label %209
209: ; preds = %208, %201
%210 = phi i32 [ %207, %201 ], [ 126, %208 ]
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32 %210)
br label %212
212: ; preds = %209
%213 = load i32, i32* %8
%214 = add nsw i32 %213, 1
store i32 %214, i32* %8
br label %189
215: ; preds = %189
%216 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%217 = load i8*, i8** %10
%218 = call i32 @free(i8* %217)
br label %219
219: ; preds = %215, %161
%220 = load i32, i32* %6
%221 = call i32 @close(i32 %220)
%222 = load i32, i32* @EXIT_SUCCESS
%223 = call i32 @exit(i32 %222)
unreachable
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@.str = [5 x i8] c"help\00"
@no_argument = global i32 0
@.str.1 = [7 x i8] c"offset\00"
@required_argument = global i32 0
@.str.2 = [5 x i8] c"read\00"
@.str.3 = [6 x i8] c"write\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.4 = [18 x i8] c"Unexpected error\0A\00"
@EXIT_FAILURE = global i32 0
@.str.5 = [41 x i8] c"don't using read and write at same time\0A\00"
@optind = global i64 0
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@SEEK_SET = global i32 0
@.str.7 = [6 x i8] c"lseek\00"
@.str.9 = [7 x i8] c"malloc\00"
@.str.10 = [34 x i8] c"[file]: %s [start position]: %ld\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [16 x i8] c"write succeeded\00"
@str.13 = [23 x i8] c"Choose a file to open\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i64
%4 = alloca [5 x %struct.option]
%5 = bitcast i64* %3 to i8*
store i64 16456641557458792, i64* %3
%6 = bitcast [5 x %struct.option]* %4 to i8*
%7 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 0
%8 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 0, i32 1
%10 = load i32, i32* @no_argument
%11 = trunc i32 %10 to i8
store i8 %11, i8* %9
%12 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 0, i32 2
store i32 0, i32* %12
%13 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 0, i32 3
store i32 104, i32* %13
%14 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 1, i32 1
%16 = load i32, i32* @required_argument
%17 = trunc i32 %16 to i8
store i8 %17, i8* %15
%18 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 1, i32 2
store i32 0, i32* %18
%19 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 1, i32 3
store i32 111, i32* %19
%20 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 2, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %20
%21 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 2, i32 1
store i8 %17, i8* %21
%22 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 2, i32 2
store i32 0, i32* %22
%23 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 2, i32 3
store i32 114, i32* %23
%24 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 3, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %24
%25 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 3, i32 1
store i8 %17, i8* %25
%26 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 3, i32 2
store i32 0, i32* %26
%27 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 3, i32 3
store i32 119, i32* %27
%28 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %4, i64 0, i64 4
%29 = bitcast %struct.option* %28 to i8*
%30 = icmp slt i32 %0, 2
br i1 %30, label %31, label %34
31: ; preds = %2
%32 = load i8*, i8** %1
%33 = tail call i32 @usage_error(i8* %32)
br label %34
34: ; preds = %31, %2
br label %35
35: ; preds = %34, %62
%36 = phi i8* [ undef, %34 ], [ %63, %62 ]
%37 = phi i32 [ 0, %34 ], [ %43, %62 ]
%38 = phi i64 [ undef, %34 ], [ %48, %62 ]
%39 = phi i32 [ 0, %34 ], [ %45, %62 ]
%40 = phi i32 [ 0, %34 ], [ %49, %62 ]
%41 = phi i1 [ false, %34 ], [ true, %62 ]
br label %42
42: ; preds = %35, %55
%43 = phi i32 [ %37, %35 ], [ %57, %55 ]
%44 = phi i64 [ %38, %35 ], [ %48, %55 ]
%45 = phi i32 [ %39, %35 ], [ 1, %55 ]
%46 = phi i32 [ %40, %35 ], [ %49, %55 ]
br label %47
47: ; preds = %42, %58
%48 = phi i64 [ %44, %42 ], [ %61, %58 ]
%49 = phi i32 [ %46, %42 ], [ 1, %58 ]
br label %50
50: ; preds = %47, %50
%51 = call i32 @getopt_long(i32 %0, i8** %1, i8* %5, %struct.option* %7, i32* null)
switch i32 %51, label %64 [
i32 -1, label %69
i32 104, label %52
i32 111, label %55
i32 114, label %58
i32 119, label %62
i32 63, label %50
]
52: ; preds = %50
%53 = load i8*, i8** %1
%54 = call i32 @usage_error(i8* %53)
br label %55
55: ; preds = %50, %52
%56 = load i8*, i8** @optarg
%57 = call i32 @strtol(i8* nocapture %56, i32* null, i32 10)
br label %42
58: ; preds = %50
%59 = load i8*, i8** @optarg
%60 = call i32 @strtol(i8* nocapture %59, i32* null, i32 10)
%61 = sext i32 %60 to i64
br label %47
62: ; preds = %50
%63 = load i8*, i8** @optarg
br label %35
64: ; preds = %50
%65 = load i32, i32* @stderr
%66 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%67 = load i32, i32* @EXIT_FAILURE
%68 = call i32 @exit(i32 %67)
unreachable
69: ; preds = %50
%70 = icmp ne i32 %49, 0
%71 = select i1 %41, i1 %70, i1 false
br i1 %71, label %72, label %77
72: ; preds = %69
%73 = load i32, i32* @stderr
%74 = call i32 @fprintf(i32 %73, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%75 = load i8*, i8** %1
%76 = call i32 @usage_error(i8* %75)
br label %77
77: ; preds = %72, %69
%78 = load i64, i64* @optind
%79 = getelementptr inbounds i8*, i8** %1, i64 %78
%80 = load i8*, i8** %79
%81 = icmp eq i8* %80, null
br i1 %81, label %82, label %89
82: ; preds = %77
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.13, i64 0, i64 0))
%84 = load i8*, i8** %1
%85 = call i32 @usage_error(i8* %84)
%86 = load i64, i64* @optind
%87 = getelementptr inbounds i8*, i8** %1, i64 %86
%88 = load i8*, i8** %87
br label %89
89: ; preds = %82, %77
%90 = phi i8* [ %88, %82 ], [ %80, %77 ]
%91 = load i32, i32* @O_RDWR
%92 = load i32, i32* @O_CREAT
%93 = or i32 %92, %91
%94 = load i32, i32* @S_IRUSR
%95 = load i32, i32* @S_IWUSR
%96 = or i32 %95, %94
%97 = load i32, i32* @S_IRGRP
%98 = or i32 %96, %97
%99 = load i32, i32* @S_IWGRP
%100 = or i32 %98, %99
%101 = load i32, i32* @S_IROTH
%102 = or i32 %100, %101
%103 = load i32, i32* @S_IWOTH
%104 = or i32 %102, %103
%105 = call i32 @open(i8* %90, i32 %93, i32 %104)
%106 = icmp eq i32 %45, 0
br i1 %106, label %115, label %107
107: ; preds = %89
%108 = load i32, i32* @SEEK_SET
%109 = call i32 @lseek(i32 %105, i32 %43, i32 %108)
%110 = icmp eq i32 %109, -1
br i1 %110, label %111, label %115
111: ; preds = %107
%112 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%113 = load i32, i32* @EXIT_FAILURE
%114 = call i32 @exit(i32 %113)
unreachable
115: ; preds = %107, %89
br i1 %41, label %116, label %126
116: ; preds = %115
%117 = call i32 @strlen(i8* %36)
%118 = call i32 @write(i32 %105, i8* %36, i32 %117)
%119 = icmp eq i32 %118, -1
br i1 %119, label %120, label %124
120: ; preds = %116
%121 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%122 = load i32, i32* @EXIT_FAILURE
%123 = call i32 @exit(i32 %122)
unreachable
124: ; preds = %116
%125 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %126
126: ; preds = %124, %115
%127 = icmp eq i32 %49, 1
br i1 %127, label %128, label %164
128: ; preds = %126
%129 = call i8* @malloc(i64 %48)
%130 = icmp eq i8* %129, null
br i1 %130, label %131, label %135
131: ; preds = %128
%132 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%133 = load i32, i32* @EXIT_FAILURE
%134 = call i32 @exit(i32 %133)
unreachable
135: ; preds = %128
%136 = call i32 @read(i32 %105, i8* %129, i64 %48)
%137 = icmp eq i32 %136, -1
br i1 %137, label %138, label %142
138: ; preds = %135
%139 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%140 = load i32, i32* @EXIT_FAILURE
%141 = call i32 @exit(i32 %140)
unreachable
142: ; preds = %135
%143 = load i64, i64* @optind
%144 = getelementptr inbounds i8*, i8** %1, i64 %143
%145 = load i8*, i8** %144
%146 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i8* %145, i32 %43)
%147 = icmp sgt i32 %136, 0
br i1 %147, label %148, label %161
148: ; preds = %142
%149 = zext i32 %136 to i64
br label %150
150: ; preds = %148, %150
%151 = phi i64 [ 0, %148 ], [ %159, %150 ]
%152 = getelementptr inbounds i8, i8* %129, i64 %151
%153 = load i8, i8* %152
%154 = call i64 @isprint(i8 signext %153)
%155 = icmp eq i64 %154, 0
%156 = sext i8 %153 to i32
%157 = select i1 %155, i32 126, i32 %156
%158 = call i32 @putchar(i32 %157)
%159 = add nuw nsw i64 %151, 1
%160 = icmp eq i64 %159, %149
br i1 %160, label %161, label %150
161: ; preds = %150, %142
%162 = call i32 @putchar(i32 10)
%163 = call i32 @free(i8* %129)
br label %164
164: ; preds = %161, %126
%165 = call i32 @close(i32 %105)
%166 = load i32, i32* @EXIT_SUCCESS
%167 = call i32 @exit(i32 %166)
unreachable
}