#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 GCD(int, int);
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  int i, j;
  char s[15];
  char *t;
  t = malloc(15);
  strcpy(s, "Hello");
  strcpy(t, "World");
  printf("%s %s\n", s, t);
  double pi = 3.1415926536;
  printf("Hello, World!\n");
  printf("Enter i and j:");
  scanf("%d%d", &i, &j);
  printf("Here are i, j, and GCD(i,j): %5d %5d %5d\n", i, j, GCD(i, j));
  int k;
  for (k = 0; k < argc; k++) {
    printf("%s ", argv[k]);
  }
  printf("\n");
  printf("pi = %7.3f\n", pi);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xf,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
lea    -0x27(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x30(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x27(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  0xe4e(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5f(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1070 <GCD@plt>
mov    -0x44(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    %eax,%ecx
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    124f <main+0xff>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    121b <main+0xcb>
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xe03(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r12
mov    %edi,%r14d
mov    $0xf,%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
lea    0xe72(%rip),%rsi
lea    0x11(%rsp),%r15
mov    %r15,%rdi
call   1040 <strcpy@plt>
lea    0xe64(%rip),%rsi
mov    %rbp,%rdi
call   1040 <strcpy@plt>
lea    0xe5b(%rip),%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe9c(%rip),%rdi
call   1050 <puts@plt>
lea    0xe42(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe43(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1080 <scanf@plt>
mov    0xc(%rsp),%ebp
mov    0x8(%rsp),%r15d
mov    %ebp,%edi
mov    %r15d,%esi
call   1090 <GCD@plt>
lea    0xe1f(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
test   %r14d,%r14d
jle    1247 <main+0xd7>
mov    %r14d,%ebx
lea    0xe2c(%rip),%r14
xor    %ebp,%ebp
nop
mov    (%r12,%rbp,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1230 <main+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe05(%rip),%rdi
movsd  0xda0(%rip),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [6 x i8] c"World\00"
@.str.2 = [7 x i8] c"%s %s\0A\00"
@.str.3 = [15 x i8] c"Hello, World!\0A\00"
@.str.4 = [15 x i8] c"Enter i and j:\00"
@.str.5 = [5 x i8] c"%d%d\00"
@.str.6 = [42 x i8] c"Here are i, j, and GCD(i,j): %5d %5d %5d\0A\00"
@.str.7 = [4 x i8] c"%s \00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [12 x i8] c"pi = %7.3f\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 [15 x i8]
%9 = alloca i8*
%10 = alloca double
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i8* @malloc(i32 15)
store i8* %12, i8** %9
%13 = getelementptr inbounds [15 x i8], [15 x i8]* %8, i64 0, i64 0
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %9
%16 = call i32 @strcpy(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [15 x i8], [15 x i8]* %8, i64 0, i64 0
%18 = load i8*, i8** %9
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %17, i8* %18)
store double 0x400921FB544486E0, double* %10
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32* %6, i32* %7)
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = call i32 @GCD(i32 %25, i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 %23, i32 %24, i32 %27)
store i32 0, i32* %11
br label %29
29: ; preds = %40, %2
%30 = load i32, i32* %11
%31 = load i32, i32* %4
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %43
33: ; preds = %29
%34 = load i8**, i8*** %5
%35 = load i32, i32* %11
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %33
%41 = load i32, i32* %11
%42 = add nsw i32 %41, 1
store i32 %42, i32* %11
br label %29
43: ; preds = %29
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%45 = load double, double* %10
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), double %45)
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [6 x i8] c"World\00"
@.str.2 = [7 x i8] c"%s %s\0A\00"
@.str.4 = [15 x i8] c"Enter i and j:\00"
@.str.5 = [5 x i8] c"%d%d\00"
@.str.6 = [42 x i8] c"Here are i, j, and GCD(i,j): %5d %5d %5d\0A\00"
@.str.7 = [4 x i8] c"%s \00"
@.str.9 = [12 x i8] c"pi = %7.3f\0A\00"
@str = [14 x i8] c"Hello, World!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [15 x i8]
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%9 = tail call dereferenceable_or_null(15) i8* @malloc(i32 15)
%10 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %8, i8* %9)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32* %3, i32* %4)
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = call i32 @GCD(i32 %16, i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 %16, i32 %17, i32 %18)
%20 = icmp sgt i32 %0, 0
br i1 %20, label %21, label %30
21: ; preds = %2
%22 = zext i32 %0 to i64
br label %23
23: ; preds = %21, %23
%24 = phi i64 [ 0, %21 ], [ %28, %23 ]
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %26)
%28 = add nuw nsw i64 %24, 1
%29 = icmp eq i64 %28, %22
br i1 %29, label %30, label %23
30: ; preds = %23, %2
%31 = call i32 @putchar(i32 10)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), double 0x400921FB544486E0)
ret i32 0
}