#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  FILE *f;
  char buffer[100] = "";
  char outfile[100];
  if (argc <= 1) {
    return 1;
  }
  sprintf(outfile, "%s\\getjava.out", argv[1]);
  f = fopen(outfile, "wt");
  printf("Please enter the directory where java.exe is installed: ");
  fgets(buffer, 100, stdin);
  fputs(buffer, f);
  fclose(f);
  return 0;
}


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)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
cmpl   $0x1,-0x8(%rbp)
jg     11af <main+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    1221 <main+0xb1>
lea    -0xf0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe3b(%rip),%rsi
call   1090 <sprintf@plt>
lea    -0xf0(%rbp),%rdi
lea    0xe37(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe2a(%rip),%rdi
call   1040 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    0x2df0(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1070 <fgets@plt>
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <fputs@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
mov    $0x1,%eax
cmp    $0x2,%edi
jl     1200 <main+0xa0>
mov    0x8(%rsi),%rdx
lea    0xe59(%rip),%rsi
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <sprintf@plt>
lea    0xe54(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xe45(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x64,%esi
call   1060 <fgets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%s\\getjava.out\00"
@.str.1 = [3 x i8] c"wt\00"
@.str.2 = [57 x i8] c"Please enter the directory where java.exe is installed: \00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [100 x i8]* %7 to i8*
%10 = load i32, i32* %4
%11 = icmp sle i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %30
13: ; preds = %2
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %6
%21 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%23 = load i32, i32* @stdin
%24 = call i32 @fgets(i8* %22, i32 100, i32 %23)
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%26 = load i32*, i32** %6
%27 = call i32 @fputs(i8* %25, i32* %26)
%28 = load i32*, i32** %6
%29 = call i32 @fclose(i32* %28)
store i32 0, i32* %3
br label %30
30: ; preds = %13, %12
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s\\getjava.out\00"
@.str.1 = [3 x i8] c"wt\00"
@.str.2 = [57 x i8] c"Please enter the directory where java.exe is installed: \00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 2
br i1 %7, label %18, label %8
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %5, i32 100, i32 %14)
%16 = call i32 @fputs(i8* %5, i32* %12)
%17 = call i32 @fclose(i32* %12)
br label %18
18: ; preds = %2, %8
%19 = phi i32 [ 0, %8 ], [ 1, %2 ]
ret i32 %19
}