#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 O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_WRONLY;
int /*<<< orphan*/ close(int);
void *dup(int);
int open(char *, int, ...);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ write(int, char *, int);
int main(void) {
  char s1[3], s2[3];
  int f1, f2;
  char s_f1, s_f2;
  f1 = open("duplog", O_CREAT | O_WRONLY, 0644);
  close(1);
  s_f2 = '0' + dup(f1);
  close(f1);
  write(1, "duplog's fd dupped into ", 24);
  write(1, &s_f2, 1);
  write(1, "\n", 1);
  f1 = open("foo", O_CREAT | O_WRONLY, 0644);
  s_f1 = '0' + f1;
  write(f1, "foobar", 6);
  write(1, "Write fd    ", 12);
  write(1, &s_f1, 1);
  write(1, "\n", 1);
  close(f1);
  f1 = open("foo", O_RDONLY);
  f2 = open("foo", O_RDONLY);
  s_f1 = '0' + f1;
  s_f2 = '0' + f2;
  read(f1, s1, 3);
  read(f2, s2, 3);
  write(1, "Open twice  ", 12);
  write(1, &s_f1, 1);
  write(1, " ", 1);
  write(1, &s_f2, 1);
  write(1, " ", 1);
  write(1, s1, 3);
  write(1, s2, 3);
  write(1, "\n", 1);
  close(f1);
  close(f2);
  f1 = open("foo", O_RDONLY);
  f2 = dup(f1);
  unlink("foo");
  s_f1 = '0' + f1;
  s_f2 = '0' + f2;
  read(f1, s1, 3);
  read(f2, s2, 3);
  write(1, "Dup instead ", 12);
  write(1, &s_f1, 1);
  write(1, " ", 1);
  write(1, &s_f2, 1);
  write(1, " ", 1);
  write(1, s1, 3);
  write(1, s2, 3);
  write(1, "\n", 1);
  close(f1);
  close(f2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
mov    0x2e49(%rip),%rax
or     (%rax),%esi
lea    0xe78(%rip),%rdi
mov    $0x1a4,%edx
mov    $0x0,%al
call   1080 <open@plt>
mov    %eax,-0x10(%rbp)
mov    $0x1,%edi
call   1060 <close@plt>
mov    -0x10(%rbp),%edi
call   1050 <dup@plt>
add    $0x30,%rax
mov    %al,-0x16(%rbp)
mov    -0x10(%rbp),%edi
call   1060 <close@plt>
mov    $0x1,%edi
lea    0xe43(%rip),%rsi
mov    $0x18,%edx
call   1040 <write@plt>
mov    $0x1,%edx
lea    -0x16(%rbp),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    $0x1,%edx
lea    0xe36(%rip),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%esi
mov    0x2dc7(%rip),%rax
or     (%rax),%esi
lea    0xe18(%rip),%rdi
mov    $0x1a4,%edx
mov    $0x0,%al
call   1080 <open@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x15(%rbp)
mov    -0x10(%rbp),%edi
lea    0xdfa(%rip),%rsi
mov    $0x6,%edx
call   1040 <write@plt>
mov    $0x1,%edi
lea    0xdeb(%rip),%rsi
mov    $0xc,%edx
call   1040 <write@plt>
mov    $0x1,%edx
lea    -0x15(%rbp),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    $0x1,%edx
lea    0xdb8(%rip),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    -0x10(%rbp),%edi
call   1060 <close@plt>
mov    0x2d62(%rip),%rax
mov    (%rax),%esi
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1080 <open@plt>
mov    %eax,-0x10(%rbp)
mov    0x2d48(%rip),%rax
mov    (%rax),%esi
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1080 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x15(%rbp)
mov    -0x14(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x16(%rbp)
mov    -0x10(%rbp),%edi
lea    -0x7(%rbp),%rsi
mov    $0x3,%edx
call   1070 <read@plt>
mov    -0x14(%rbp),%edi
lea    -0xa(%rbp),%rsi
mov    $0x3,%edx
call   1070 <read@plt>
mov    $0x1,%edi
lea    0xd4f(%rip),%rsi
mov    $0xc,%edx
call   1040 <write@plt>
mov    $0x1,%edx
lea    -0x15(%rbp),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    $0x1,%edx
lea    0xd27(%rip),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    $0x1,%edx
lea    -0x16(%rbp),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    $0x1,%edx
lea    0xd04(%rip),%rsi
mov    %edx,%edi
call   1040 <write@plt>
lea    -0x7(%rbp),%rsi
mov    $0x1,%edi
mov    $0x3,%edx
call   1040 <write@plt>
lea    -0xa(%rbp),%rsi
mov    $0x1,%edi
mov    $0x3,%edx
call   1040 <write@plt>
mov    $0x1,%edx
lea    0xcb3(%rip),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    -0x10(%rbp),%edi
call   1060 <close@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    0x2c55(%rip),%rax
mov    (%rax),%esi
lea    0xc8e(%rip),%rdi
mov    $0x0,%al
call   1080 <open@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <dup@plt>
mov    %eax,-0x14(%rbp)
lea    0xc72(%rip),%rdi
call   1030 <unlink@plt>
mov    -0x10(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x15(%rbp)
mov    -0x14(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x16(%rbp)
mov    -0x10(%rbp),%edi
lea    -0x7(%rbp),%rsi
mov    $0x3,%edx
call   1070 <read@plt>
mov    -0x14(%rbp),%edi
lea    -0xa(%rbp),%rsi
mov    $0x3,%edx
call   1070 <read@plt>
mov    $0x1,%edi
lea    0xc52(%rip),%rsi
mov    $0xc,%edx
call   1040 <write@plt>
mov    $0x1,%edx
lea    -0x15(%rbp),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    $0x1,%edx
lea    0xc1d(%rip),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    $0x1,%edx
lea    -0x16(%rbp),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    $0x1,%edx
lea    0xbfa(%rip),%rsi
mov    %edx,%edi
call   1040 <write@plt>
lea    -0x7(%rbp),%rsi
mov    $0x1,%edi
mov    $0x3,%edx
call   1040 <write@plt>
lea    -0xa(%rbp),%rsi
mov    $0x1,%edi
mov    $0x3,%edx
call   1040 <write@plt>
mov    $0x1,%edx
lea    0xba9(%rip),%rsi
mov    %edx,%edi
call   1040 <write@plt>
mov    -0x10(%rbp),%edi
call   1060 <close@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e86(%rip),%r14
mov    0x2e4f(%rip),%r15
mov    (%r15),%esi
or     (%r14),%esi
lea    0xe7a(%rip),%rdi
mov    $0x1a4,%edx
xor    %eax,%eax
call   1080 <open@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1060 <close@plt>
mov    %ebx,%edi
call   1050 <dup@plt>
add    $0x30,%al
mov    %al,(%rsp)
mov    %ebx,%edi
call   1060 <close@plt>
lea    0xe4f(%rip),%rsi
mov    $0x1,%edi
mov    $0x18,%edx
call   1040 <write@plt>
mov    %rsp,%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1040 <write@plt>
lea    0xe40(%rip),%rbp
mov    $0x1,%edi
mov    %rbp,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    (%r15),%esi
or     (%r14),%esi
lea    0xe23(%rip),%r13
mov    %r13,%rdi
mov    $0x1a4,%edx
xor    %eax,%eax
call   1080 <open@plt>
mov    %eax,%ebx
lea    0x30(%rbx),%eax
mov    %al,0x1(%rsp)
lea    0xe08(%rip),%rsi
mov    %ebx,%edi
mov    $0x6,%edx
call   1040 <write@plt>
lea    0xdfc(%rip),%rsi
mov    $0x1,%edi
mov    $0xc,%edx
call   1040 <write@plt>
lea    0x1(%rsp),%r14
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %rbp,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    %ebx,%edi
call   1060 <close@plt>
mov    0x2d69(%rip),%rbx
mov    (%rbx),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1080 <open@plt>
mov    %eax,%r15d
mov    (%rbx),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1080 <open@plt>
mov    %eax,%r12d
lea    0x30(%r15),%eax
mov    %al,0x1(%rsp)
lea    0x30(%r12),%eax
mov    %al,(%rsp)
lea    0x5(%rsp),%rbp
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x3,%edx
call   1070 <read@plt>
lea    0x2(%rsp),%rbx
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1070 <read@plt>
lea    0xd64(%rip),%rsi
mov    $0x1,%edi
mov    $0xc,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
lea    0xd3a(%rip),%r14
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %rsp,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %rbp,%rsi
mov    $0x3,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1040 <write@plt>
mov    $0x1,%edi
lea    0xcbc(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    %r15d,%edi
call   1060 <close@plt>
mov    %r12d,%edi
call   1060 <close@plt>
mov    0x2c5b(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1080 <open@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1050 <dup@plt>
mov    %rax,%rbx
mov    %r13,%rdi
call   1030 <unlink@plt>
lea    0x30(%rbp),%eax
mov    %al,0x1(%rsp)
mov    %ebx,%eax
add    $0x30,%al
mov    %al,(%rsp)
mov    %ebp,%edi
lea    0x5(%rsp),%r15
mov    %r15,%rsi
mov    $0x3,%edx
call   1070 <read@plt>
mov    %ebx,%edi
lea    0x2(%rsp),%r12
mov    %r12,%rsi
mov    $0x3,%edx
call   1070 <read@plt>
lea    0xc65(%rip),%rsi
mov    $0x1,%edi
mov    $0xc,%edx
call   1040 <write@plt>
mov    $0x1,%edi
lea    0x1(%rsp),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %rsp,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r15,%rsi
mov    $0x3,%edx
call   1040 <write@plt>
mov    $0x1,%edi
mov    %r12,%rsi
mov    $0x3,%edx
call   1040 <write@plt>
mov    $0x1,%edi
lea    0xbb5(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    %ebp,%edi
call   1060 <close@plt>
mov    %ebx,%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"duplog\00"
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@.str.1 = [25 x i8] c"duplog's fd dupped into \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c"foo\00"
@.str.4 = [7 x i8] c"foobar\00"
@.str.5 = [13 x i8] c"Write fd \00"
@O_RDONLY = global i32 0
@.str.6 = [13 x i8] c"Open twice \00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [13 x i8] c"Dup instead \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca [3 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
store i32 0, i32* %1
%8 = load i32, i32* @O_CREAT
%9 = load i32, i32* @O_WRONLY
%10 = or i32 %8, %9
%11 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %10, i32 420)
store i32 %11, i32* %4
%12 = call i32 @close(i32 1)
%13 = load i32, i32* %4
%14 = call i8* @dup(i32 %13)
%15 = getelementptr i8, i8* %14, i64 48
%16 = ptrtoint i8* %15 to i8
store i8 %16, i8* %7
%17 = load i32, i32* %4
%18 = call i32 @close(i32 %17)
%19 = call i32 @write(i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 24)
%20 = call i32 @write(i32 1, i8* %7, i32 1)
%21 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%22 = load i32, i32* @O_CREAT
%23 = load i32, i32* @O_WRONLY
%24 = or i32 %22, %23
%25 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %24, i32 420)
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = add nsw i32 48, %26
%28 = trunc i32 %27 to i8
store i8 %28, i8* %6
%29 = load i32, i32* %4
%30 = call i32 @write(i32 %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 6)
%31 = call i32 @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 12)
%32 = call i32 @write(i32 1, i8* %6, i32 1)
%33 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%34 = load i32, i32* %4
%35 = call i32 @close(i32 %34)
%36 = load i32, i32* @O_RDONLY
%37 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %36)
store i32 %37, i32* %4
%38 = load i32, i32* @O_RDONLY
%39 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %38)
store i32 %39, i32* %5
%40 = load i32, i32* %4
%41 = add nsw i32 48, %40
%42 = trunc i32 %41 to i8
store i8 %42, i8* %6
%43 = load i32, i32* %5
%44 = add nsw i32 48, %43
%45 = trunc i32 %44 to i8
store i8 %45, i8* %7
%46 = load i32, i32* %4
%47 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%48 = call i32 @read(i32 %46, i8* %47, i32 3)
%49 = load i32, i32* %5
%50 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%51 = call i32 @read(i32 %49, i8* %50, i32 3)
%52 = call i32 @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 12)
%53 = call i32 @write(i32 1, i8* %6, i32 1)
%54 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%55 = call i32 @write(i32 1, i8* %7, i32 1)
%56 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%57 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%58 = call i32 @write(i32 1, i8* %57, i32 3)
%59 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%60 = call i32 @write(i32 1, i8* %59, i32 3)
%61 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%62 = load i32, i32* %4
%63 = call i32 @close(i32 %62)
%64 = load i32, i32* %5
%65 = call i32 @close(i32 %64)
%66 = load i32, i32* @O_RDONLY
%67 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %66)
store i32 %67, i32* %4
%68 = load i32, i32* %4
%69 = call i8* @dup(i32 %68)
%70 = ptrtoint i8* %69 to i32
store i32 %70, i32* %5
%71 = call i32 @unlink(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%72 = load i32, i32* %4
%73 = add nsw i32 48, %72
%74 = trunc i32 %73 to i8
store i8 %74, i8* %6
%75 = load i32, i32* %5
%76 = add nsw i32 48, %75
%77 = trunc i32 %76 to i8
store i8 %77, i8* %7
%78 = load i32, i32* %4
%79 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%80 = call i32 @read(i32 %78, i8* %79, i32 3)
%81 = load i32, i32* %5
%82 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%83 = call i32 @read(i32 %81, i8* %82, i32 3)
%84 = call i32 @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 12)
%85 = call i32 @write(i32 1, i8* %6, i32 1)
%86 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%87 = call i32 @write(i32 1, i8* %7, i32 1)
%88 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%89 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%90 = call i32 @write(i32 1, i8* %89, i32 3)
%91 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%92 = call i32 @write(i32 1, i8* %91, i32 3)
%93 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%94 = load i32, i32* %4
%95 = call i32 @close(i32 %94)
%96 = load i32, i32* %5
%97 = call i32 @close(i32 %96)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"duplog\00"
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@.str.1 = [25 x i8] c"duplog's fd dupped into \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c"foo\00"
@.str.4 = [7 x i8] c"foobar\00"
@.str.5 = [13 x i8] c"Write fd \00"
@O_RDONLY = global i32 0
@.str.6 = [13 x i8] c"Open twice \00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [13 x i8] c"Dup instead \00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = alloca [3 x i8]
%3 = alloca i8
%4 = alloca i8
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @O_CREAT
%8 = load i32, i32* @O_WRONLY
%9 = or i32 %8, %7
%10 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %9, i32 420)
%11 = tail call i32 @close(i32 1)
%12 = tail call i8* @dup(i32 %10)
%13 = getelementptr i8, i8* %12, i64 48
%14 = ptrtoint i8* %13 to i64
%15 = trunc i64 %14 to i8
store i8 %15, i8* %4
%16 = tail call i32 @close(i32 %10)
%17 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 24)
%18 = call i32 @write(i32 1, i8* %4, i32 1)
%19 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%20 = load i32, i32* @O_CREAT
%21 = load i32, i32* @O_WRONLY
%22 = or i32 %21, %20
%23 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %22, i32 420)
%24 = trunc i32 %23 to i8
%25 = add i8 %24, 48
store i8 %25, i8* %3
%26 = tail call i32 @write(i32 %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 6)
%27 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 12)
%28 = call i32 @write(i32 1, i8* %3, i32 1)
%29 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%30 = tail call i32 @close(i32 %23)
%31 = load i32, i32* @O_RDONLY
%32 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = load i32, i32* @O_RDONLY
%34 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = trunc i32 %32 to i8
%36 = add i8 %35, 48
store i8 %36, i8* %3
%37 = trunc i32 %34 to i8
%38 = add i8 %37, 48
store i8 %38, i8* %4
%39 = call i32 @read(i32 %32, i8* %5, i32 3)
%40 = call i32 @read(i32 %34, i8* %6, i32 3)
%41 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 12)
%42 = call i32 @write(i32 1, i8* %3, i32 1)
%43 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%44 = call i32 @write(i32 1, i8* %4, i32 1)
%45 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%46 = call i32 @write(i32 1, i8* %5, i32 3)
%47 = call i32 @write(i32 1, i8* %6, i32 3)
%48 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%49 = tail call i32 @close(i32 %32)
%50 = tail call i32 @close(i32 %34)
%51 = load i32, i32* @O_RDONLY
%52 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %51)
%53 = tail call i8* @dup(i32 %52)
%54 = ptrtoint i8* %53 to i64
%55 = trunc i64 %54 to i32
%56 = tail call i32 @unlink(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%57 = trunc i32 %52 to i8
%58 = add i8 %57, 48
store i8 %58, i8* %3
%59 = trunc i64 %54 to i8
%60 = add i8 %59, 48
store i8 %60, i8* %4
%61 = call i32 @read(i32 %52, i8* %5, i32 3)
%62 = call i32 @read(i32 %55, i8* %6, i32 3)
%63 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 12)
%64 = call i32 @write(i32 1, i8* %3, i32 1)
%65 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%66 = call i32 @write(i32 1, i8* %4, i32 1)
%67 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%68 = call i32 @write(i32 1, i8* %5, i32 3)
%69 = call i32 @write(i32 1, i8* %6, i32 3)
%70 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%71 = tail call i32 @close(i32 %52)
%72 = tail call i32 @close(i32 %55)
ret i32 0
}