#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*/ O_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ memset(char *, char, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int fd, wr, rd, idx, valorEntrada, valorSalida;
  char comando[5];
  char file[80];
  char msg_buffer[512];
  char regreso[512];
  sprintf(file, "/dev/rpmsg_pru30");
  do {
    fd = open(file, O_RDWR);
  } while (fd < 0);
  memset(msg_buffer, '\0', 512);
  printf("Introduce comando: \n");
  printf("'FIN' para acabar \n");
  scanf("%s", comando);
  while (strcmp(comando, "FIN") != 0) {
    printf("Introduce valor (0 en caso de no necesitarlo): \n");
    scanf("%i", &valorEntrada);
    for (idx = 0; idx < strlen(comando); idx++)
      msg_buffer[0] ^= comando[idx];
    msg_buffer[1] = valorEntrada & 0x000000FF;
    msg_buffer[2] = (valorEntrada & 0x0000FF00) >> 0x08;
    msg_buffer[3] = (valorEntrada & 0x00FF0000) >> 0x10;
    msg_buffer[4] = valorEntrada >> 0x18;
    wr = write(fd, msg_buffer, 5);
    memset(msg_buffer, '\0', 512);
    memset(regreso, '\0', 512);
    rd = read(fd, msg_buffer, 4);
    strcpy(regreso, msg_buffer);
    if (rd < 4) {
      int cont;
      cont = rd;
      while (cont < 4) {
        rd = read(fd, msg_buffer, 4 - cont);
        strcat(regreso, msg_buffer);
        cont += rd;
      }
    }
    valorSalida = (regreso[0] | regreso[1] << 0x08 | regreso[2] << 0x10 |
                   regreso[3] << 0x18);
    printf("El valor de %s es: %i\n", comando, valorSalida);
    memset(msg_buffer, '\0', 512);
    printf("Introduce comando: \n");
    printf("'FIN' para acabar \n");
    scanf("%s", comando);
  }
  close(fd);
  printf("Cerrando... \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe1c(%rip),%rsi
call   10e0 <sprintf@plt>
lea    -0x80(%rbp),%rdi
mov    0x2df4(%rip),%rax
mov    (%rax),%esi
call   10c0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11e9 <main+0x29>
lea    -0x280(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1070 <memset@plt>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x2d(%rbp),%rsi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   10b0 <scanf@plt>
lea    -0x2d(%rbp),%rdi
lea    0xde9(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     1467 <main+0x2a7>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdfa(%rip),%rdi
lea    -0x24(%rbp),%rsi
mov    $0x0,%al
call   10b0 <scanf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x488(%rbp)
lea    -0x2d(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x488(%rbp),%eax
cmp    %ecx,%eax
jge    12d2 <main+0x112>
movslq -0x20(%rbp),%rax
movsbl -0x2d(%rbp,%rax,1),%ecx
movsbl -0x280(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x280(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    128a <main+0xca>
mov    -0x24(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x27f(%rbp)
mov    -0x24(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,-0x27e(%rbp)
mov    -0x24(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
mov    %al,-0x27d(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x18,%eax
mov    %al,-0x27c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x280(%rbp),%rsi
mov    $0x5,%edx
call   1040 <write@plt>
mov    %eax,-0x18(%rbp)
lea    -0x280(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1070 <memset@plt>
lea    -0x480(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1070 <memset@plt>
mov    -0x14(%rbp),%edi
lea    -0x280(%rbp),%rsi
mov    $0x4,%edx
call   1090 <read@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x480(%rbp),%rdi
lea    -0x280(%rbp),%rsi
call   1030 <strcpy@plt>
cmpl   $0x4,-0x1c(%rbp)
jge    13de <main+0x21e>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x484(%rbp)
cmpl   $0x4,-0x484(%rbp)
jge    13d9 <main+0x219>
mov    -0x14(%rbp),%edi
lea    -0x280(%rbp),%rsi
mov    $0x4,%edx
sub    -0x484(%rbp),%edx
call   1090 <read@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x480(%rbp),%rdi
lea    -0x280(%rbp),%rsi
call   10d0 <strcat@plt>
mov    -0x1c(%rbp),%eax
add    -0x484(%rbp),%eax
mov    %eax,-0x484(%rbp)
jmp    1388 <main+0x1c8>
jmp    13de <main+0x21e>
movsbl -0x480(%rbp),%eax
movsbl -0x47f(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movsbl -0x47e(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movsbl -0x47d(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x28(%rbp)
lea    -0x2d(%rbp),%rsi
mov    -0x28(%rbp),%edx
lea    0xc5b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x280(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1070 <memset@plt>
lea    0xbd6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xbdd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x2d(%rbp),%rsi
lea    0xbdf(%rip),%rdi
mov    $0x0,%al
call   10b0 <scanf@plt>
jmp    1249 <main+0x89>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
lea    0xc16(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x468,%rsp
movups 0xe28(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movb   $0x0,0x20(%rsp)
mov    0x2dff(%rip),%r14
lea    0x10(%rsp),%rbp
xchg   %ax,%ax
mov    (%r14),%esi
mov    %rbp,%rdi
call   10d0 <open@plt>
test   %eax,%eax
js     11f0 <main+0x30>
mov    %eax,%ebx
lea    0x260(%rsp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1080 <memset@plt>
lea    0xe53(%rip),%rdi
call   1040 <puts@plt>
lea    0xe5b(%rip),%rdi
call   1040 <puts@plt>
lea    0xddd(%rip),%rdi
lea    0x7(%rsp),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   10c0 <scanf@plt>
lea    0xdca(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     13fe <main+0x23e>
lea    0x7(%rsp),%r13
lea    0x260(%rsp),%r14
lea    0x60(%rsp),%rbp
jmp    1304 <main+0x144>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl 0x60(%rsp),%eax
movsbl 0x61(%rsp),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
movsbl 0x62(%rsp),%eax
shl    $0x10,%eax
movzbl 0x63(%rsp),%edx
shl    $0x18,%edx
or     %eax,%edx
or     %ecx,%edx
lea    0xd71(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1080 <memset@plt>
lea    0xda5(%rip),%rdi
call   1040 <puts@plt>
lea    0xdad(%rip),%rdi
call   1040 <puts@plt>
lea    0xd2f(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10c0 <scanf@plt>
mov    %r13,%rdi
lea    0xd1e(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     13fe <main+0x23e>
mov    %rbp,%r15
lea    0xd31(%rip),%rdi
call   1040 <puts@plt>
lea    0xcfe(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   10c0 <scanf@plt>
mov    %r13,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    135f <main+0x19f>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x7(%rsp,%rbp,1),%eax
xor    %al,0x260(%rsp)
add    $0x1,%rbp
mov    %r13,%rdi
call   1060 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     1340 <main+0x180>
mov    0xc(%rsp),%eax
mov    %eax,0x261(%rsp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x5,%edx
call   1050 <write@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1080 <memset@plt>
mov    %r15,%rbp
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1080 <memset@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   10a0 <read@plt>
mov    %eax,%r12d
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
cmp    $0x3,%r12d
jg     1280 <main+0xc0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x4,%edx
sub    %r12d,%edx
mov    %ebx,%edi
mov    %r14,%rsi
call   10a0 <read@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
mov    %r14,%rsi
call   10e0 <strcat@plt>
add    %r15d,%r12d
cmp    $0x4,%r12d
jl     13d0 <main+0x210>
jmp    1280 <main+0xc0>
mov    %ebx,%edi
call   1090 <close@plt>
lea    0xc26(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x468,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"/dev/rpmsg_pru30\00"
@O_RDWR = global i32 0
@.str.1 = [21 x i8] c"Introduce comando: \0A\00"
@.str.2 = [20 x i8] c"'FIN' para acabar \0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [4 x i8] c"FIN\00"
@.str.5 = [49 x i8] c"Introduce valor (0 en caso de no necesitarlo): \0A\00"
@.str.6 = [3 x i8] c"%i\00"
@.str.7 = [23 x i8] c"El valor de %s es: %i\0A\00"
@.str.8 = [14 x i8] c"Cerrando... \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [5 x i8]
%13 = alloca [80 x i8]
%14 = alloca [512 x i8]
%15 = alloca [512 x i8]
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%18 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %23, %2
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%21 = load i32, i32* @O_RDWR
%22 = call i32 @open(i8* %20, i32 %21)
store i32 %22, i32* %6
br label %23
23: ; preds = %19
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 0
br i1 %25, label %19, label %26
26: ; preds = %23
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%28 = call i32 @memset(i8* %27, i8 signext 0, i32 512)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%31 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 0
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %111, %26
%34 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 0
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %139
37: ; preds = %33
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
%39 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %10)
store i32 0, i32* %9
br label %40
40: ; preds = %56, %37
%41 = load i32, i32* %9
%42 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 0
%43 = call i32 @strlen(i8* %42)
%44 = icmp slt i32 %41, %43
br i1 %44, label %45, label %59
45: ; preds = %40
%46 = load i32, i32* %9
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = xor i32 %53, %50
%55 = trunc i32 %54 to i8
store i8 %55, i8* %51
br label %56
56: ; preds = %45
%57 = load i32, i32* %9
%58 = add nsw i32 %57, 1
store i32 %58, i32* %9
br label %40
59: ; preds = %40
%60 = load i32, i32* %10
%61 = and i32 %60, 255
%62 = trunc i32 %61 to i8
%63 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 1
store i8 %62, i8* %63
%64 = load i32, i32* %10
%65 = and i32 %64, 65280
%66 = ashr i32 %65, 8
%67 = trunc i32 %66 to i8
%68 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 2
store i8 %67, i8* %68
%69 = load i32, i32* %10
%70 = and i32 %69, 16711680
%71 = ashr i32 %70, 16
%72 = trunc i32 %71 to i8
%73 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 3
store i8 %72, i8* %73
%74 = load i32, i32* %10
%75 = ashr i32 %74, 24
%76 = trunc i32 %75 to i8
%77 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 4
store i8 %76, i8* %77
%78 = load i32, i32* %6
%79 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%80 = call i32 @write(i32 %78, i8* %79, i32 5)
store i32 %80, i32* %7
%81 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%82 = call i32 @memset(i8* %81, i8 signext 0, i32 512)
%83 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 0
%84 = call i32 @memset(i8* %83, i8 signext 0, i32 512)
%85 = load i32, i32* %6
%86 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%87 = call i32 @read(i32 %85, i8* %86, i32 4)
store i32 %87, i32* %8
%88 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 0
%89 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%90 = call i32 @strcpy(i8* %88, i8* %89)
%91 = load i32, i32* %8
%92 = icmp slt i32 %91, 4
br i1 %92, label %93, label %111
93: ; preds = %59
%94 = load i32, i32* %8
store i32 %94, i32* %16
br label %95
95: ; preds = %98, %93
%96 = load i32, i32* %16
%97 = icmp slt i32 %96, 4
br i1 %97, label %98, label %110
98: ; preds = %95
%99 = load i32, i32* %6
%100 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%101 = load i32, i32* %16
%102 = sub nsw i32 4, %101
%103 = call i32 @read(i32 %99, i8* %100, i32 %102)
store i32 %103, i32* %8
%104 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 0
%105 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%106 = call i32 @strcat(i8* %104, i8* %105)
%107 = load i32, i32* %8
%108 = load i32, i32* %16
%109 = add nsw i32 %108, %107
store i32 %109, i32* %16
br label %95
110: ; preds = %95
br label %111
111: ; preds = %110, %59
%112 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 0
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 1
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = shl i32 %117, 8
%119 = or i32 %114, %118
%120 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 2
%121 = load i8, i8* %120
%122 = sext i8 %121 to i32
%123 = shl i32 %122, 16
%124 = or i32 %119, %123
%125 = getelementptr inbounds [512 x i8], [512 x i8]* %15, i64 0, i64 3
%126 = load i8, i8* %125
%127 = sext i8 %126 to i32
%128 = shl i32 %127, 24
%129 = or i32 %124, %128
store i32 %129, i32* %11
%130 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 0
%131 = load i32, i32* %11
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %130, i32 %131)
%133 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%134 = call i32 @memset(i8* %133, i8 signext 0, i32 512)
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%137 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 0
%138 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %137)
br label %33
139: ; preds = %33
%140 = load i32, i32* %6
%141 = call i32 @close(i32 %140)
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"/dev/rpmsg_pru30\00"
@O_RDWR = global i32 0
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [4 x i8] c"FIN\00"
@.str.6 = [3 x i8] c"%i\00"
@.str.7 = [23 x i8] c"El valor de %s es: %i\0A\00"
@str.10 = [13 x i8] c"Cerrando... \00"
@str.11 = [48 x i8] c"Introduce valor (0 en caso de no necesitarlo): \00"
@str.12 = [20 x i8] c"Introduce comando: \00"
@str.13 = [19 x i8] c"'FIN' para acabar \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [5 x i8]
%5 = alloca [80 x i8]
%6 = alloca [512 x i8]
%7 = alloca [512 x i8]
%8 = bitcast i32* %3 to i8*
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
br label %13
13: ; preds = %13, %2
%14 = load i32, i32* @O_RDWR
%15 = call i32 @open(i8* %10, i32 %14)
%16 = icmp slt i32 %15, 0
br i1 %16, label %13, label %17
17: ; preds = %13
%18 = call i32 @memset(i8* %11, i8 signext 0, i32 512)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.12, i64 0, i64 0))
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%22 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %91, label %24
24: ; preds = %17
%25 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 1
%26 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 2
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 3
%28 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 4
%29 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 1
%30 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 2
%31 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 3
br label %32
32: ; preds = %24, %69
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.11, i64 0, i64 0))
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%35 = call i32 @strlen(i8* %9)
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %47
37: ; preds = %32, %37
%38 = phi i64 [ %43, %37 ], [ 0, %32 ]
%39 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = load i8, i8* %11
%42 = xor i8 %41, %40
store i8 %42, i8* %11
%43 = add nuw nsw i64 %38, 1
%44 = call i32 @strlen(i8* %9)
%45 = sext i32 %44 to i64
%46 = icmp slt i64 %43, %45
br i1 %46, label %37, label %47
47: ; preds = %37, %32
%48 = load i32, i32* %3
%49 = trunc i32 %48 to i8
store i8 %49, i8* %25
%50 = lshr i32 %48, 8
%51 = trunc i32 %50 to i8
store i8 %51, i8* %26
%52 = lshr i32 %48, 16
%53 = trunc i32 %52 to i8
store i8 %53, i8* %27
%54 = lshr i32 %48, 24
%55 = trunc i32 %54 to i8
store i8 %55, i8* %28
%56 = call i32 @write(i32 %15, i8* %11, i32 5)
%57 = call i32 @memset(i8* %11, i8 signext 0, i32 512)
%58 = call i32 @memset(i8* %12, i8 signext 0, i32 512)
%59 = call i32 @read(i32 %15, i8* %11, i32 4)
%60 = call i32 @strcpy(i8* %12, i8* %11)
%61 = icmp slt i32 %59, 4
br i1 %61, label %62, label %69
62: ; preds = %47, %62
%63 = phi i32 [ %67, %62 ], [ %59, %47 ]
%64 = sub nsw i32 4, %63
%65 = call i32 @read(i32 %15, i8* %11, i32 %64)
%66 = call i32 @strcat(i8* %12, i8* %11)
%67 = add nsw i32 %65, %63
%68 = icmp slt i32 %67, 4
br i1 %68, label %62, label %69
69: ; preds = %62, %47
%70 = load i8, i8* %12
%71 = sext i8 %70 to i32
%72 = load i8, i8* %29
%73 = sext i8 %72 to i32
%74 = shl nsw i32 %73, 8
%75 = or i32 %74, %71
%76 = load i8, i8* %30
%77 = sext i8 %76 to i32
%78 = shl nsw i32 %77, 16
%79 = or i32 %75, %78
%80 = load i8, i8* %31
%81 = zext i8 %80 to i32
%82 = shl nuw i32 %81, 24
%83 = or i32 %79, %82
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %9, i32 %83)
%85 = call i32 @memset(i8* %11, i8 signext 0, i32 512)
%86 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.12, i64 0, i64 0))
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
%88 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%89 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %32
91: ; preds = %69, %17
%92 = call i32 @close(i32 %15)
%93 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}