#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *getenv(char *);
int getopt(int, char **, char *);
int getsockfd(char *, char *);
int getttyfd(char *, int);
char *malloc(scalar_t__);
scalar_t__ multipipe(int, int **);
char *optarg;
int opterr;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ show_help(char *);
int sscanf(char *, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  char *env;
  int option, device_fd, socket_fd;
  static char *device = "/dev/ttyUSB0";
  char *opt_device = NULL;
  int speed = 19200;
  static char *host = "r2d2";
  char *opt_host = NULL;
  static char *port = "7771";
  char *opt_port = NULL;
  env = getenv("CANGATEWAY_DEVICE");
  if ((env != NULL) && (strlen(env) != 0)) {
    opt_device = malloc(strlen(env) + 1);
    if (opt_device == NULL) {
      perror("malloc");
      exit(1);
    }
    strcpy(opt_device, env);
    device = opt_device;
  }
  env = getenv("CANGATEWAY_SPEED");
  if ((env != NULL) && (strlen(env) != 0)) {
    sscanf(env, "%d", speed);
  }
  env = getenv("CANGATEWAY_HOST");
  if ((env != NULL) && (strlen(env) != 0)) {
    opt_host = malloc(strlen(env) + 1);
    if (opt_host == NULL) {
      perror("malloc");
      exit(1);
    }
    strcpy(opt_host, env);
    host = opt_host;
  }
  env = getenv("CANGATEWAY_PORT");
  if ((env != NULL) && (strlen(env) != 0)) {
    opt_port = malloc(strlen(env) + 1);
    if (opt_port == NULL) {
      perror("malloc");
      exit(1);
    }
    strcpy(opt_port, env);
    port = opt_port;
  }
  opterr = 1;
  while (1) {
    option = getopt(argc, argv, "D:H:P:S:h");
    if (option == -1)
      break;
    switch (option) {
    case 'D':
      opt_device = malloc(strlen(optarg) + 1);
      if (opt_device == NULL) {
        perror("malloc");
        exit(1);
      }
      strcpy(opt_device, optarg);
      device = opt_device;
      break;
    case 'S':
      if (sscanf(optarg, "%d", speed) != 1) {
        fprintf(stderr, "Bad argument for '-S' option\n");
        show_help(argv[0]);
        exit(1);
      }
      break;
    case 'H':
      opt_host = malloc(strlen(optarg) + 1);
      if (opt_host == NULL) {
        perror("malloc");
        exit(1);
      }
      strcpy(opt_host, optarg);
      host = opt_host;
      break;
    case 'P':
      opt_port = malloc(strlen(optarg) + 1);
      if (opt_port == NULL) {
        perror("malloc");
        exit(1);
      }
      strcpy(opt_port, optarg);
      port = opt_port;
      break;
    case 'h':
      show_help(argv[0]);
      exit(0);
    case '?':
      show_help(argv[0]);
      exit(1);
    default:
      break;
    }
  }
  printf("Gateway settings:\n");
  printf("\tSerial device : %s\n", device);
  printf("\tSpeed : %d\n", speed);
  printf("\tSocket  : %s:%s\n", host, port);
  if ((device_fd = getttyfd(device, speed)) < 0) {
    fprintf(stderr, "error: getttyfd(%s, %d) failed\n", device, speed);
    exit(1);
  }
  if ((socket_fd = getsockfd(host, port)) < 0) {
    fprintf(stderr, "error: getsockfd(%s, %s) failed\n", host, port);
    exit(1);
  }
  int fd[2][2] = {{device_fd, socket_fd}, {socket_fd, device_fd}};
  if (multipipe(2, fd)) {
    fprintf(stderr, "error: an error occured during data transfer\n");
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x4b00,-0x34(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
lea    0xea3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1295 <main+0xb5>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x0,%rax
je     1295 <main+0xb5>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    127d <main+0x9d>
lea    0xe63(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x30(%rbp),%rax
mov    %rax,0x2dfb(%rip)
lea    0xe3c(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     12d6 <main+0xf6>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x0,%rax
je     12d6 <main+0xf6>
mov    -0x18(%rbp),%rdi
mov    -0x34(%rbp),%edx
lea    0xe18(%rip),%rsi
call   10b0 <sscanf@plt>
lea    0xe0f(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1356 <main+0x176>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x0,%rax
je     1356 <main+0x176>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    133e <main+0x15e>
lea    0xda2(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x40(%rbp),%rax
mov    %rax,0x2d42(%rip)
lea    0xd9f(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     13d6 <main+0x1f6>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x0,%rax
je     13d6 <main+0x1f6>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    13be <main+0x1de>
lea    0xd22(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x48(%rbp),%rax
mov    %rax,0x2cca(%rip)
mov    0x2bf3(%rip),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd1b(%rip),%rdx
call   10d0 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1408 <main+0x228>
jmp    15e1 <main+0x401>
mov    -0x1c(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x68(%rbp)
sub    $0x29,%eax
ja     15d7 <main+0x3f7>
mov    -0x68(%rbp),%rax
lea    0xbd8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2bc0(%rip),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1471 <main+0x291>
lea    0xc6f(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x30(%rbp),%rdi
mov    0x2b7c(%rip),%rax
mov    (%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x30(%rbp),%rax
mov    %rax,0x2c01(%rip)
jmp    15dc <main+0x3fc>
mov    0x2b5d(%rip),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%edx
lea    0xc41(%rip),%rsi
call   10b0 <sscanf@plt>
cmp    $0x1,%eax
je     14e3 <main+0x303>
mov    0x2b1b(%rip),%rax
mov    (%rax),%edi
lea    0xc50(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <show_help@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    15dc <main+0x3fc>
mov    0x2b09(%rip),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1528 <main+0x348>
lea    0xbb8(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x40(%rbp),%rdi
mov    0x2ac5(%rip),%rax
mov    (%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x40(%rbp),%rax
mov    %rax,0x2b52(%rip)
jmp    15dc <main+0x3fc>
mov    0x2aa6(%rip),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    158b <main+0x3ab>
lea    0xb55(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x48(%rbp),%rdi
mov    0x2a62(%rip),%rax
mov    (%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x48(%rbp),%rax
mov    %rax,0x2af7(%rip)
jmp    15dc <main+0x3fc>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <show_help@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <show_help@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    15dc <main+0x3fc>
jmp    13e3 <main+0x203>
lea    0xb4c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2a9a(%rip),%rsi
lea    0xb4a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0xb4e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2a7c(%rip),%rsi
mov    0x2a7d(%rip),%rdx
lea    0xb3f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2a58(%rip),%rdi
mov    -0x34(%rbp),%esi
call   1050 <getttyfd@plt>
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jge    1677 <main+0x497>
mov    0x2985(%rip),%rax
mov    (%rax),%edi
mov    0x2a34(%rip),%rdx
mov    -0x34(%rbp),%ecx
lea    0xb15(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2a1a(%rip),%rdi
mov    0x2a1b(%rip),%rsi
call   1100 <getsockfd@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jge    16c5 <main+0x4e5>
mov    0x293b(%rip),%rax
mov    (%rax),%edi
mov    0x29f2(%rip),%rdx
mov    0x29f3(%rip),%rcx
lea    0xae7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x54(%rbp)
lea    -0x60(%rbp),%rsi
mov    $0x2,%edi
call   10f0 <multipipe@plt>
cmp    $0x0,%rax
je     1716 <main+0x536>
mov    0x28dc(%rip),%rax
mov    (%rax),%edi
lea    0xab7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
xor    %eax,%eax
add    $0x70,%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
mov    %edi,%r12d
lea    0xeb4(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     124f <main+0x5f>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <strlen@plt>
test   %rax,%rax
je     124f <main+0x5f>
add    $0x1,%rax
mov    %rax,%rdi
call   10b0 <malloc@plt>
test   %rax,%rax
je     14ef <main+0x2ff>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbp,0x2e49(%rip)
lea    0xe82(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1279 <main+0x89>
cmpb   $0x0,(%rax)
je     1279 <main+0x89>
lea    0xe7d(%rip),%rsi
mov    %rax,%rdi
mov    $0x4b00,%edx
call   10c0 <sscanf@plt>
lea    0xe6c(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     12c4 <main+0xd4>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <strlen@plt>
test   %rax,%rax
je     12c4 <main+0xd4>
add    $0x1,%rax
mov    %rax,%rdi
call   10b0 <malloc@plt>
test   %rax,%rax
je     14ef <main+0x2ff>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbp,0x2ddc(%rip)
lea    0xe31(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     130f <main+0x11f>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <strlen@plt>
test   %rax,%rax
je     130f <main+0x11f>
add    $0x1,%rax
mov    %rax,%rdi
call   10b0 <malloc@plt>
test   %rax,%rax
je     14ef <main+0x2ff>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbp,0x2d99(%rip)
mov    0x2cba(%rip),%rax
movl   $0x1,(%rax)
lea    0xde9(%rip),%r13
lea    0xcd6(%rip),%r15
jmp    1350 <main+0x160>
mov    0x2cc5(%rip),%rax
mov    (%rax),%rdi
lea    0xdac(%rip),%rsi
mov    $0x4b00,%edx
call   10c0 <sscanf@plt>
cmp    $0x1,%eax
jne    1514 <main+0x324>
mov    %r12d,%edi
mov    %r14,%rsi
mov    %r13,%rdx
call   10e0 <getopt@plt>
lea    -0x3f(%rax),%ecx
cmp    $0x29,%ecx
ja     142a <main+0x23a>
movslq (%r15,%rcx,4),%rax
add    %r15,%rax
jmp    *%rax
mov    0x2c7e(%rip),%rax
mov    (%rax),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%rdi
call   10b0 <malloc@plt>
test   %rax,%rax
je     14ef <main+0x2ff>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %rbx,0x2cec(%rip)
jmp    1350 <main+0x160>
mov    0x2c43(%rip),%rax
mov    (%rax),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%rdi
call   10b0 <malloc@plt>
test   %rax,%rax
je     14ef <main+0x2ff>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %rbx,0x2cc1(%rip)
jmp    1350 <main+0x160>
mov    0x2c05(%rip),%rax
mov    (%rax),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%rdi
call   10b0 <malloc@plt>
test   %rax,%rax
je     14ef <main+0x2ff>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %rbx,0x2c7b(%rip)
jmp    1350 <main+0x160>
cmp    $0xffffffff,%eax
jne    1350 <main+0x160>
lea    0xd9d(%rip),%rdi
call   1050 <puts@plt>
mov    0x2c52(%rip),%rsi
lea    0xce7(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xcee(%rip),%rdi
mov    $0x4b00,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2c32(%rip),%rsi
mov    0x2c33(%rip),%rdx
lea    0xcda(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2c0e(%rip),%rdi
mov    $0x4b00,%esi
call   1060 <getttyfd@plt>
test   %eax,%eax
js     153d <main+0x34d>
mov    %eax,%ebx
mov    0x2bfb(%rip),%rdi
mov    0x2bfc(%rip),%rsi
call   1110 <getsockfd@plt>
test   %eax,%eax
js     156a <main+0x37a>
mov    %ebx,(%rsp)
mov    %eax,0x4(%rsp)
mov    %eax,0x8(%rsp)
mov    %ebx,0xc(%rsp)
mov    %rsp,%rsi
mov    $0x2,%edi
call   1100 <multipipe@plt>
test   %rax,%rax
jne    1599 <main+0x3a9>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbdb(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    (%r14),%rdi
call   10a0 <show_help@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    0x2abd(%rip),%rax
mov    (%rax),%edi
lea    0xbf2(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%r14),%rdi
call   10a0 <show_help@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2a94(%rip),%rax
mov    (%rax),%edi
mov    0x2b4b(%rip),%rdx
lea    0xc14(%rip),%rsi
mov    $0x4b00,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2a67(%rip),%rax
mov    (%rax),%edi
mov    0x2b26(%rip),%rdx
mov    0x2b27(%rip),%rcx
lea    0xc00(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2a38(%rip),%rax
mov    (%rax),%edi
lea    0xc00(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@main.device = internal global i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0)
@.str = [13 x i8] c"/dev/ttyUSB0\00"
@main.host = internal global i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0)
@.str.1 = [5 x i8] c"r2d2\00"
@main.port = internal global i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0)
@.str.2 = [5 x i8] c"7771\00"
@.str.3 = [18 x i8] c"CANGATEWAY_DEVICE\00"
@.str.4 = [7 x i8] c"malloc\00"
@.str.5 = [17 x i8] c"CANGATEWAY_SPEED\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [16 x i8] c"CANGATEWAY_HOST\00"
@.str.8 = [16 x i8] c"CANGATEWAY_PORT\00"
@opterr = global i32 0
@.str.9 = [10 x i8] c"D:H:P:S:h\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.10 = [30 x i8] c"Bad argument for '-S' option\0A\00"
@.str.11 = [19 x i8] c"Gateway settings:\0A\00"
@.str.12 = [21 x i8] c"\09Serial device : %s\0A\00"
@.str.13 = [13 x i8] c"\09Speed : %d\0A\00"
@.str.14 = [18 x i8] c"\09Socket : %s:%s\0A\00"
@.str.15 = [32 x i8] c"error: getttyfd(%s, %d) failed\0A\00"
@.str.16 = [33 x i8] c"error: getsockfd(%s, %s) failed\0A\00"
@.str.17 = [46 x i8] c"error: an error occured during data transfer\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca [2 x [2 x i32]]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %10
store i32 19200, i32* %11
store i8* null, i8** %12
store i8* null, i8** %13
%15 = call i8* @getenv(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %37
18: ; preds = %2
%19 = load i8*, i8** %6
%20 = call i64 @strlen(i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %37
22: ; preds = %18
%23 = load i8*, i8** %6
%24 = call i64 @strlen(i8* %23)
%25 = add nsw i64 %24, 1
%26 = call i8* @malloc(i64 %25)
store i8* %26, i8** %10
%27 = load i8*, i8** %10
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %32
29: ; preds = %22
%30 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %22
%33 = load i8*, i8** %10
%34 = load i8*, i8** %6
%35 = call i32 @strcpy(i8* %33, i8* %34)
%36 = load i8*, i8** %10
store i8* %36, i8** @main.device
br label %37
37: ; preds = %32, %18, %2
%38 = call i8* @getenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
store i8* %38, i8** %6
%39 = load i8*, i8** %6
%40 = icmp ne i8* %39, null
br i1 %40, label %41, label %49
41: ; preds = %37
%42 = load i8*, i8** %6
%43 = call i64 @strlen(i8* %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %49
45: ; preds = %41
%46 = load i8*, i8** %6
%47 = load i32, i32* %11
%48 = call i32 @sscanf(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %45, %41, %37
%50 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
store i8* %50, i8** %6
%51 = load i8*, i8** %6
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %72
53: ; preds = %49
%54 = load i8*, i8** %6
%55 = call i64 @strlen(i8* %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %72
57: ; preds = %53
%58 = load i8*, i8** %6
%59 = call i64 @strlen(i8* %58)
%60 = add nsw i64 %59, 1
%61 = call i8* @malloc(i64 %60)
store i8* %61, i8** %12
%62 = load i8*, i8** %12
%63 = icmp eq i8* %62, null
br i1 %63, label %64, label %67
64: ; preds = %57
%65 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %57
%68 = load i8*, i8** %12
%69 = load i8*, i8** %6
%70 = call i32 @strcpy(i8* %68, i8* %69)
%71 = load i8*, i8** %12
store i8* %71, i8** @main.host
br label %72
72: ; preds = %67, %53, %49
%73 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
store i8* %73, i8** %6
%74 = load i8*, i8** %6
%75 = icmp ne i8* %74, null
br i1 %75, label %76, label %95
76: ; preds = %72
%77 = load i8*, i8** %6
%78 = call i64 @strlen(i8* %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %95
80: ; preds = %76
%81 = load i8*, i8** %6
%82 = call i64 @strlen(i8* %81)
%83 = add nsw i64 %82, 1
%84 = call i8* @malloc(i64 %83)
store i8* %84, i8** %13
%85 = load i8*, i8** %13
%86 = icmp eq i8* %85, null
br i1 %86, label %87, label %90
87: ; preds = %80
%88 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%89 = call i32 @exit(i32 1)
unreachable
90: ; preds = %80
%91 = load i8*, i8** %13
%92 = load i8*, i8** %6
%93 = call i32 @strcpy(i8* %91, i8* %92)
%94 = load i8*, i8** %13
store i8* %94, i8** @main.port
br label %95
95: ; preds = %90, %76, %72
store i32 1, i32* @opterr
br label %96
96: ; preds = %95, %177
%97 = load i32, i32* %4
%98 = load i8**, i8*** %5
%99 = call i32 @getopt(i32 %97, i8** %98, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
store i32 %99, i32* %7
%100 = load i32, i32* %7
%101 = icmp eq i32 %100, -1
br i1 %101, label %102, label %103
102: ; preds = %96
br label %178
103: ; preds = %96
%104 = load i32, i32* %7
switch i32 %104, label %176 [
i32 68, label %105
i32 83, label %120
i32 72, label %134
i32 80, label %149
i32 104, label %164
i32 63, label %170
]
105: ; preds = %103
%106 = load i8*, i8** @optarg
%107 = call i64 @strlen(i8* %106)
%108 = add nsw i64 %107, 1
%109 = call i8* @malloc(i64 %108)
store i8* %109, i8** %10
%110 = load i8*, i8** %10
%111 = icmp eq i8* %110, null
br i1 %111, label %112, label %115
112: ; preds = %105
%113 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%114 = call i32 @exit(i32 1)
unreachable
115: ; preds = %105
%116 = load i8*, i8** %10
%117 = load i8*, i8** @optarg
%118 = call i32 @strcpy(i8* %116, i8* %117)
%119 = load i8*, i8** %10
store i8* %119, i8** @main.device
br label %177
120: ; preds = %103
%121 = load i8*, i8** @optarg
%122 = load i32, i32* %11
%123 = call i32 @sscanf(i8* %121, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %122)
%124 = icmp ne i32 %123, 1
br i1 %124, label %125, label %133
125: ; preds = %120
%126 = load i32, i32* @stderr
%127 = call i32 (i32, i8*, ...) @fprintf(i32 %126, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
%128 = load i8**, i8*** %5
%129 = getelementptr inbounds i8*, i8** %128, i64 0
%130 = load i8*, i8** %129
%131 = call i32 @show_help(i8* %130)
%132 = call i32 @exit(i32 1)
unreachable
133: ; preds = %120
br label %177
134: ; preds = %103
%135 = load i8*, i8** @optarg
%136 = call i64 @strlen(i8* %135)
%137 = add nsw i64 %136, 1
%138 = call i8* @malloc(i64 %137)
store i8* %138, i8** %12
%139 = load i8*, i8** %12
%140 = icmp eq i8* %139, null
br i1 %140, label %141, label %144
141: ; preds = %134
%142 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%143 = call i32 @exit(i32 1)
unreachable
144: ; preds = %134
%145 = load i8*, i8** %12
%146 = load i8*, i8** @optarg
%147 = call i32 @strcpy(i8* %145, i8* %146)
%148 = load i8*, i8** %12
store i8* %148, i8** @main.host
br label %177
149: ; preds = %103
%150 = load i8*, i8** @optarg
%151 = call i64 @strlen(i8* %150)
%152 = add nsw i64 %151, 1
%153 = call i8* @malloc(i64 %152)
store i8* %153, i8** %13
%154 = load i8*, i8** %13
%155 = icmp eq i8* %154, null
br i1 %155, label %156, label %159
156: ; preds = %149
%157 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%158 = call i32 @exit(i32 1)
unreachable
159: ; preds = %149
%160 = load i8*, i8** %13
%161 = load i8*, i8** @optarg
%162 = call i32 @strcpy(i8* %160, i8* %161)
%163 = load i8*, i8** %13
store i8* %163, i8** @main.port
br label %177
164: ; preds = %103
%165 = load i8**, i8*** %5
%166 = getelementptr inbounds i8*, i8** %165, i64 0
%167 = load i8*, i8** %166
%168 = call i32 @show_help(i8* %167)
%169 = call i32 @exit(i32 0)
unreachable
170: ; preds = %103
%171 = load i8**, i8*** %5
%172 = getelementptr inbounds i8*, i8** %171, i64 0
%173 = load i8*, i8** %172
%174 = call i32 @show_help(i8* %173)
%175 = call i32 @exit(i32 1)
unreachable
176: ; preds = %103
br label %177
177: ; preds = %176, %159, %144, %133, %115
br label %96
178: ; preds = %102
%179 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
%180 = load i8*, i8** @main.device
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i8* %180)
%182 = load i32, i32* %11
%183 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %182)
%184 = load i8*, i8** @main.host
%185 = load i8*, i8** @main.port
%186 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i8* %184, i8* %185)
%187 = load i8*, i8** @main.device
%188 = load i32, i32* %11
%189 = call i32 @getttyfd(i8* %187, i32 %188)
store i32 %189, i32* %8
%190 = icmp slt i32 %189, 0
br i1 %190, label %191, label %197
191: ; preds = %178
%192 = load i32, i32* @stderr
%193 = load i8*, i8** @main.device
%194 = load i32, i32* %11
%195 = call i32 (i32, i8*, ...) @fprintf(i32 %192, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0), i8* %193, i32 %194)
%196 = call i32 @exit(i32 1)
unreachable
197: ; preds = %178
%198 = load i8*, i8** @main.host
%199 = load i8*, i8** @main.port
%200 = call i32 @getsockfd(i8* %198, i8* %199)
store i32 %200, i32* %9
%201 = icmp slt i32 %200, 0
br i1 %201, label %202, label %208
202: ; preds = %197
%203 = load i32, i32* @stderr
%204 = load i8*, i8** @main.host
%205 = load i8*, i8** @main.port
%206 = call i32 (i32, i8*, ...) @fprintf(i32 %203, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.16, i64 0, i64 0), i8* %204, i8* %205)
%207 = call i32 @exit(i32 1)
unreachable
208: ; preds = %197
%209 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %14, i64 0, i64 0
%210 = getelementptr inbounds [2 x i32], [2 x i32]* %209, i64 0, i64 0
%211 = load i32, i32* %8
store i32 %211, i32* %210
%212 = getelementptr inbounds i32, i32* %210, i64 1
%213 = load i32, i32* %9
store i32 %213, i32* %212
%214 = getelementptr inbounds [2 x i32], [2 x i32]* %209, i64 1
%215 = getelementptr inbounds [2 x i32], [2 x i32]* %214, i64 0, i64 0
%216 = load i32, i32* %9
store i32 %216, i32* %215
%217 = getelementptr inbounds i32, i32* %215, i64 1
%218 = load i32, i32* %8
store i32 %218, i32* %217
%219 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %14, i64 0, i64 0
%220 = bitcast [2 x i32]* %219 to i32**
%221 = call i64 @multipipe(i32 2, i32** %220)
%222 = icmp ne i64 %221, 0
br i1 %222, label %223, label %227
223: ; preds = %208
%224 = load i32, i32* @stderr
%225 = call i32 (i32, i8*, ...) @fprintf(i32 %224, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.17, i64 0, i64 0))
%226 = call i32 @exit(i32 1)
unreachable
227: ; preds = %208
ret i32 0
}

LLVM IR (-O2):
@main.device = internal unnamed_addr global i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
@.str = [13 x i8] c"/dev/ttyUSB0\00"
@main.host = internal unnamed_addr global i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
@.str.1 = [5 x i8] c"r2d2\00"
@main.port = internal unnamed_addr global i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
@.str.2 = [5 x i8] c"7771\00"
@.str.3 = [18 x i8] c"CANGATEWAY_DEVICE\00"
@.str.4 = [7 x i8] c"malloc\00"
@.str.5 = [17 x i8] c"CANGATEWAY_SPEED\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [16 x i8] c"CANGATEWAY_HOST\00"
@.str.8 = [16 x i8] c"CANGATEWAY_PORT\00"
@opterr = global i32 0
@.str.9 = [10 x i8] c"D:H:P:S:h\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.10 = [30 x i8] c"Bad argument for '-S' option\0A\00"
@.str.12 = [21 x i8] c"\09Serial device : %s\0A\00"
@.str.13 = [13 x i8] c"\09Speed : %d\0A\00"
@.str.14 = [18 x i8] c"\09Socket : %s:%s\0A\00"
@.str.15 = [32 x i8] c"error: getttyfd(%s, %d) failed\0A\00"
@.str.16 = [33 x i8] c"error: getsockfd(%s, %s) failed\0A\00"
@.str.17 = [46 x i8] c"error: an error occured during data transfer\0A\00"
@str = [18 x i8] c"Gateway settings:\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [2 x [2 x i32]]
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %18, label %6
6: ; preds = %2
%7 = tail call i64 @strlen(i8* %4)
%8 = icmp eq i64 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %6
%10 = add nsw i64 %7, 1
%11 = tail call i8* @malloc(i64 %10)
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %9
%17 = tail call i32 @strcpy(i8* %11, i8* %4)
store i8* %11, i8** @main.device
br label %18
18: ; preds = %16, %6, %2
%19 = tail call i8* @getenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%20 = icmp eq i8* %19, null
br i1 %20, label %26, label %21
21: ; preds = %18
%22 = load i8, i8* %19
%23 = icmp eq i8 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %21
%25 = tail call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 19200)
br label %26
26: ; preds = %24, %21, %18
%27 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%28 = icmp eq i8* %27, null
br i1 %28, label %41, label %29
29: ; preds = %26
%30 = tail call i64 @strlen(i8* %27)
%31 = icmp eq i64 %30, 0
br i1 %31, label %41, label %32
32: ; preds = %29
%33 = add nsw i64 %30, 1
%34 = tail call i8* @malloc(i64 %33)
%35 = icmp eq i8* %34, null
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%38 = tail call i32 @exit(i32 1)
unreachable
39: ; preds = %32
%40 = tail call i32 @strcpy(i8* %34, i8* %27)
store i8* %34, i8** @main.host
br label %41
41: ; preds = %39, %29, %26
%42 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%43 = icmp eq i8* %42, null
br i1 %43, label %56, label %44
44: ; preds = %41
%45 = tail call i64 @strlen(i8* %42)
%46 = icmp eq i64 %45, 0
br i1 %46, label %56, label %47
47: ; preds = %44
%48 = add nsw i64 %45, 1
%49 = tail call i8* @malloc(i64 %48)
%50 = icmp eq i8* %49, null
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%53 = tail call i32 @exit(i32 1)
unreachable
54: ; preds = %47
%55 = tail call i32 @strcpy(i8* %49, i8* %42)
store i8* %49, i8** @main.port
br label %56
56: ; preds = %54, %44, %41
store i32 1, i32* @opterr
br label %57
57: ; preds = %59, %56
%58 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
switch i32 %58, label %59 [
i32 -1, label %111
i32 68, label %60
i32 83, label %71
i32 72, label %81
i32 80, label %92
i32 104, label %103
i32 63, label %107
]
59: ; preds = %57, %71, %101, %90, %69
br label %57
60: ; preds = %57
%61 = load i8*, i8** @optarg
%62 = tail call i64 @strlen(i8* dereferenceable(1) %61)
%63 = add nsw i64 %62, 1
%64 = tail call i8* @malloc(i64 %63)
%65 = icmp eq i8* %64, null
br i1 %65, label %66, label %69
66: ; preds = %60
%67 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%68 = tail call i32 @exit(i32 1)
unreachable
69: ; preds = %60
%70 = tail call i32 @strcpy(i8* %64, i8* %61)
store i8* %64, i8** @main.device
br label %59
71: ; preds = %57
%72 = load i8*, i8** @optarg
%73 = tail call i32 @sscanf(i8* %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 19200)
%74 = icmp eq i32 %73, 1
br i1 %74, label %59, label %75
75: ; preds = %71
%76 = load i32, i32* @stderr
%77 = tail call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
%78 = load i8*, i8** %1
%79 = tail call i32 @show_help(i8* %78)
%80 = tail call i32 @exit(i32 1)
unreachable
81: ; preds = %57
%82 = load i8*, i8** @optarg
%83 = tail call i64 @strlen(i8* dereferenceable(1) %82)
%84 = add nsw i64 %83, 1
%85 = tail call i8* @malloc(i64 %84)
%86 = icmp eq i8* %85, null
br i1 %86, label %87, label %90
87: ; preds = %81
%88 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%89 = tail call i32 @exit(i32 1)
unreachable
90: ; preds = %81
%91 = tail call i32 @strcpy(i8* %85, i8* %82)
store i8* %85, i8** @main.host
br label %59
92: ; preds = %57
%93 = load i8*, i8** @optarg
%94 = tail call i64 @strlen(i8* dereferenceable(1) %93)
%95 = add nsw i64 %94, 1
%96 = tail call i8* @malloc(i64 %95)
%97 = icmp eq i8* %96, null
br i1 %97, label %98, label %101
98: ; preds = %92
%99 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%100 = tail call i32 @exit(i32 1)
unreachable
101: ; preds = %92
%102 = tail call i32 @strcpy(i8* %96, i8* %93)
store i8* %96, i8** @main.port
br label %59
103: ; preds = %57
%104 = load i8*, i8** %1
%105 = tail call i32 @show_help(i8* %104)
%106 = tail call i32 @exit(i32 0)
unreachable
107: ; preds = %57
%108 = load i8*, i8** %1
%109 = tail call i32 @show_help(i8* %108)
%110 = tail call i32 @exit(i32 1)
unreachable
111: ; preds = %57
%112 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%113 = load i8*, i8** @main.device
%114 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i8* %113)
%115 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 19200)
%116 = load i8*, i8** @main.host
%117 = load i8*, i8** @main.port
%118 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i8* %116, i8* %117)
%119 = load i8*, i8** @main.device
%120 = tail call i32 @getttyfd(i8* %119, i32 19200)
%121 = icmp slt i32 %120, 0
br i1 %121, label %122, label %127
122: ; preds = %111
%123 = load i32, i32* @stderr
%124 = load i8*, i8** @main.device
%125 = tail call i32 (i32, i8*, ...) @fprintf(i32 %123, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0), i8* %124, i32 19200)
%126 = tail call i32 @exit(i32 1)
unreachable
127: ; preds = %111
%128 = load i8*, i8** @main.host
%129 = load i8*, i8** @main.port
%130 = tail call i32 @getsockfd(i8* %128, i8* %129)
%131 = icmp slt i32 %130, 0
br i1 %131, label %132, label %138
132: ; preds = %127
%133 = load i32, i32* @stderr
%134 = load i8*, i8** @main.host
%135 = load i8*, i8** @main.port
%136 = tail call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.16, i64 0, i64 0), i8* %134, i8* %135)
%137 = tail call i32 @exit(i32 1)
unreachable
138: ; preds = %127
%139 = bitcast [2 x [2 x i32]]* %3 to i8*
%140 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0, i64 0
store i32 %120, i32* %140
%141 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0, i64 1
store i32 %130, i32* %141
%142 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1, i64 0
store i32 %130, i32* %142
%143 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1, i64 1
store i32 %120, i32* %143
%144 = bitcast [2 x [2 x i32]]* %3 to i32**
%145 = call i64 @multipipe(i32 2, i32** %144)
%146 = icmp eq i64 %145, 0
br i1 %146, label %151, label %147
147: ; preds = %138
%148 = load i32, i32* @stderr
%149 = call i32 (i32, i8*, ...) @fprintf(i32 %148, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.17, i64 0, i64 0))
%150 = call i32 @exit(i32 1)
unreachable
151: ; preds = %138
ret i32 0
}