#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc < 3) {
    fprintf(stderr, "Usage: ./configure sshkey RPi-code-directory\n");
    return 1;
  }
  FILE *fp;
  fp = fopen("settings/ssh.txt", "w");
  fprintf(fp, "%s", argv[1]);
  fclose(fp);
  fp = fopen("settings/director.txt", "w");
  fprintf(fp, "%s", argv[2]);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1174 <main+0x44>
mov    0x2e89(%rip),%rax
movslq (%rax),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ef <main+0xbf>
lea    0xeb3(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xea3(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe8f(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jg     1171 <main+0x31>
mov    0x2e8f(%rip),%rax
movslq (%rax),%rcx
lea    0xea5(%rip),%rdi
mov    $0x2d,%esi
mov    $0x1,%edx
call   1060 <fwrite@plt>
mov    $0x1,%eax
jmp    11c9 <main+0x89>
mov    %rsi,%r15
lea    0xeb3(%rip),%rdi
lea    0xebd(%rip),%r14
mov    %r14,%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    0x8(%r15),%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
lea    0xe99(%rip),%rdi
mov    %r14,%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    0x10(%r15),%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"Usage: ./configure sshkey RPi-code-directory\0A\00"
@.str.1 = [17 x i8] c"settings/ssh.txt\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [22 x i8] c"settings/director.txt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 3
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %31
14: ; preds = %2
%15 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %15, i32** %6
%16 = load i32*, i32** %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %19)
%21 = load i32*, i32** %6
%22 = call i32 @fclose(i32* %21)
%23 = call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %23, i32** %6
%24 = load i32*, i32** %6
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %27)
%29 = load i32*, i32** %6
%30 = call i32 @fclose(i32* %29)
store i32 0, i32* %3
br label %31
31: ; preds = %14, %9
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"Usage: ./configure sshkey RPi-code-directory\0A\00"
@.str.1 = [17 x i8] c"settings/ssh.txt\00"
@.str.2 = [2 x i8] c"w\00"
@.str.4 = [22 x i8] c"settings/director.txt\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i64 45, i64 1, i32* %7)
br label %20
9: ; preds = %2
%10 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @fputs(i8* %12, i32* %10)
%14 = tail call i32 @fclose(i32* %10)
%15 = tail call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @fputs(i8* %17, i32* %15)
%19 = tail call i32 @fclose(i32* %15)
br label %20
20: ; preds = %9, %4
%21 = phi i32 [ 1, %4 ], [ 0, %9 ]
ret i32 %21
}