#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
scalar_t__ strstr(char *, char *);
void interaction_msg_box(char *arg1) {
  0;
  char *call = "powershell.exe ";
  char *pwsh =
      "Add-Type -AssemblyName System.Windows.Forms; Add-Type -AssemblyName "
      "System.Drawing;$window = New-Object "
      "System.Windows.Forms.Form;$window.Width = 500;$window.Height = "
      "150;$Label = New-Object System.Windows.Forms.Label;$Label.Location = "
      "New-Object System.Drawing.Size(10,10);$Label.Text = 'Rechne aus: "
      "5+5';$Label.AutoSize = $True;$window.Controls.Add($Label);$windowButton "
      "= New-Object System.Windows.Forms.Button;$windowButton.Location = "
      "New-Object System.Drawing.Size(10,60);$windowButton.Size = New-Object "
      "System.Drawing.Size(50,30);$windowButton.Text = "
      "'OK';$windowButton.Enabled = $false;$windowTextBox = New-Object "
      "System.Windows.Forms.TextBox;$windowTextBox.Location = New-Object "
      "System.Drawing.Size(10,30);$windowTextBox.Size = New-Object "
      "System.Drawing.Size(350,350);$windowTextBox.add_TextChanged({$"
      "windowButton.Enabled = "
      "$windowTextBox.Text});$window.Controls.Add($windowTextBox);$"
      "windowButton.Add_Click({$calc = [int]$windowTextBox.Text;if($calc -eq "
      "10) {Write-Host '0';}else {Write-Host "
      "'-1';}$window.Dispose();});$window.Controls.Add($windowButton);[void]$"
      "window.ShowDialog();";
  char *command = (char *)malloc(strlen(pwsh) + strlen(call) + 1);
  FILE *fp;
  char buf[128];
  char retval[10];
  strcpy(command, call);
  strcat(command, pwsh);
  if ((fp = popen(command, "r")) == NULL) {
    0;
    exit(0);
  }
  while (fgets(buf, 128, fp) != NULL) {
    strcat(retval, buf);
  }
  if (strstr(retval, "0")) {
    0;
  } else {
    exit(0);
  }
}


x86 assembly (clang, -O0):
<interaction_msg_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe6a(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xe6f(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0xc8(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0xc8(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x20(%rbp),%rdi
lea    0x1259(%rip),%rsi
call   1070 <popen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1214 <interaction_msg_box+0x94>
xor    %edi,%edi
call   1090 <exit@plt>
jmp    1219 <interaction_msg_box+0x99>
lea    -0xb0(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x80,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1250 <interaction_msg_box+0xd0>
lea    -0xba(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
call   1080 <strcat@plt>
jmp    1219 <interaction_msg_box+0x99>
lea    -0xba(%rbp),%rdi
lea    0x11f7(%rip),%rsi
call   10a0 <strstr@plt>
cmp    $0x0,%rax
je     1272 <interaction_msg_box+0xf2>
jmp    1279 <interaction_msg_box+0xf9>
xor    %edi,%edi
call   1090 <exit@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interaction_msg_box>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    $0x452,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe70(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
lea    0xe71(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
lea    0x12a5(%rip),%rsi
mov    %rbx,%rdi
call   1060 <popen@plt>
test   %rax,%rax
je     1223 <interaction_msg_box+0xb3>
mov    %rax,%r15
lea    0x10(%rsp),%rdi
mov    $0x80,%esi
mov    %rax,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1200 <interaction_msg_box+0x90>
lea    0x6(%rsp),%r14
lea    0x10(%rsp),%rbx
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcat@plt>
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    11e0 <interaction_msg_box+0x70>
lea    0x124e(%rip),%rsi
lea    0x6(%rsp),%rdi
call   1090 <strstr@plt>
test   %rax,%rax
je     1223 <interaction_msg_box+0xb3>
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"powershell.exe \00"
@.str.1 = [1091 x i8] c"Add-Type -AssemblyName System.Windows.Forms; Add-Type -AssemblyName System.Drawing;$window = New-Object System.Windows.Forms.Form;$window.Width = 500;$window.Height = 150;$Label = New-Object System.Windows.Forms.Label;$Label.Location = New-Object System.Drawing.Size(10,10);$Label.Text = 'Rechne aus: 5+5';$Label.AutoSize = $True;$window.Controls.Add($Label);$windowButton = New-Object System.Windows.Forms.Button;$windowButton.Location = New-Object System.Drawing.Size(10,60);$windowButton.Size = New-Object System.Drawing.Size(50,30);$windowButton.Text = 'OK';$windowButton.Enabled = $false;$windowTextBox = New-Object System.Windows.Forms.TextBox;$windowTextBox.Location = New-Object System.Drawing.Size(10,30);$windowTextBox.Size = New-Object System.Drawing.Size(350,350);$windowTextBox.add_TextChanged({$windowButton.Enabled = $windowTextBox.Text});$window.Controls.Add($windowTextBox);$windowButton.Add_Click({$calc = [int]$windowTextBox.Text;if($calc -eq 10) {Write-Host '0';}else {Write-Host '-1';}$window.Dispose();});$window.Controls.Add($windowButton);[void]$window.ShowDialog();\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [2 x i8] c"0\00"
define void @interaction_msg_box(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca [128 x i8]
%8 = alloca [10 x i8]
store i8* %0, i8** %2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([1091 x i8], [1091 x i8]* @.str.1, i64 0, i64 0), i8** %4
%9 = load i8*, i8** %4
%10 = call i64 @strlen(i8* %9)
%11 = load i8*, i8** %3
%12 = call i64 @strlen(i8* %11)
%13 = add nsw i64 %10, %12
%14 = add nsw i64 %13, 1
%15 = call i64 @malloc(i64 %14)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = load i8*, i8** %3
%19 = call i32 @strcpy(i8* %17, i8* %18)
%20 = load i8*, i8** %5
%21 = load i8*, i8** %4
%22 = call i32 @strcat(i8* %20, i8* %21)
%23 = load i8*, i8** %5
%24 = call i32* @popen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %24, i32** %6
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %1
%27 = call i32 @exit(i32 0)
unreachable
28: ; preds = %1
br label %29
29: ; preds = %34, %28
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%31 = load i32*, i32** %6
%32 = call i32* @fgets(i8* %30, i32 128, i32* %31)
%33 = icmp ne i32* %32, null
br i1 %33, label %34, label %38
34: ; preds = %29
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%37 = call i32 @strcat(i8* %35, i8* %36)
br label %29
38: ; preds = %29
%39 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%40 = call i64 @strstr(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %38
br label %45
43: ; preds = %38
%44 = call i32 @exit(i32 0)
unreachable
45: ; preds = %42
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"powershell.exe \00"
@.str.1 = [1091 x i8] c"Add-Type -AssemblyName System.Windows.Forms; Add-Type -AssemblyName System.Drawing;$window = New-Object System.Windows.Forms.Form;$window.Width = 500;$window.Height = 150;$Label = New-Object System.Windows.Forms.Label;$Label.Location = New-Object System.Drawing.Size(10,10);$Label.Text = 'Rechne aus: 5+5';$Label.AutoSize = $True;$window.Controls.Add($Label);$windowButton = New-Object System.Windows.Forms.Button;$windowButton.Location = New-Object System.Drawing.Size(10,60);$windowButton.Size = New-Object System.Drawing.Size(50,30);$windowButton.Text = 'OK';$windowButton.Enabled = $false;$windowTextBox = New-Object System.Windows.Forms.TextBox;$windowTextBox.Location = New-Object System.Drawing.Size(10,30);$windowTextBox.Size = New-Object System.Drawing.Size(350,350);$windowTextBox.add_TextChanged({$windowButton.Enabled = $windowTextBox.Text});$window.Controls.Add($windowTextBox);$windowButton.Add_Click({$calc = [int]$windowTextBox.Text;if($calc -eq 10) {Write-Host '0';}else {Write-Host '-1';}$window.Dispose();});$window.Controls.Add($windowButton);[void]$window.ShowDialog();\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [2 x i8] c"0\00"
define void @interaction_msg_box(i8* nocapture readnone %0) {
%2 = alloca [128 x i8]
%3 = alloca [10 x i8]
%4 = tail call i64 @malloc(i64 1106)
%5 = inttoptr i64 %4 to i8*
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%8 = tail call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @strcat(i8* %5, i8* getelementptr inbounds ([1091 x i8], [1091 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32* @popen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %15, label %12
12: ; preds = %1
%13 = call i32* @fgets(i8* %6, i32 128, i32* %10)
%14 = icmp eq i32* %13, null
br i1 %14, label %21, label %17
15: ; preds = %1
%16 = tail call i32 @exit(i32 0)
unreachable
17: ; preds = %12, %17
%18 = call i32 @strcat(i8* %7, i8* %6)
%19 = call i32* @fgets(i8* %6, i32 128, i32* %10)
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %17
21: ; preds = %17, %12
%22 = call i64 @strstr(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %21
ret void
}