#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 /*<<< orphan*/ gmshInitialize(int, char **, int, int *);
int /*<<< orphan*/ gmshModelAdd(char *, int *);
int /*<<< orphan*/ gmshModelGeoAddCurveLoop(int *, int, int, int *);
int gmshModelGeoAddLine(int, int, int, int *);
int /*<<< orphan*/ gmshModelGeoAddPlaneSurface(int *, int, int, int *);
int /*<<< orphan*/ gmshModelGeoAddPoint(int, int, int /*<<< orphan*/, double,
                                        int, int *);
int /*<<< orphan*/ gmshModelGeoSynchronize(int *);
int /*<<< orphan*/ gmshModelMeshGenerate(int, int *);
int /*<<< orphan*/ gmshWrite(char *, int *);
int main(int argc, char **argv) {
  int ierr;
  gmshInitialize(argc, argv, 1, &ierr);
  gmshModelAdd("square", &ierr);
  gmshModelGeoAddPoint(0, 0, 0, 0.1, 1, &ierr);
  gmshModelGeoAddPoint(1, 0, 0, 0.1, 2, &ierr);
  gmshModelGeoAddPoint(1, 1, 0, 0.1, 3, &ierr);
  gmshModelGeoAddPoint(0, 1, 0, 0.1, 4, &ierr);
  gmshModelGeoAddLine(1, 2, 1, &ierr);
  gmshModelGeoAddLine(2, 3, 2, &ierr);
  gmshModelGeoAddLine(3, 4, 3, &ierr);
  int line4 = gmshModelGeoAddLine(4, 1, -1, &ierr);
  int ll[] = {1, 2, 3, line4};
  gmshModelGeoAddCurveLoop(ll, 4, 1, &ierr);
  int s[] = {1};
  gmshModelGeoAddPlaneSurface(ll, 1, 6, &ierr);
  gmshModelGeoSynchronize(&ierr);
  gmshModelMeshGenerate(2, &ierr);
  gmshWrite("square.msh", &ierr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
lea    -0x14(%rbp),%rcx
call   10b0 <gmshInitialize@plt>
lea    0xe46(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   10a0 <gmshModelAdd@plt>
xor    %edx,%edx
movsd  0xe2b(%rip),%xmm0
mov    $0x1,%ecx
lea    -0x14(%rbp),%r8
mov    %edx,%edi
mov    %edx,%esi
call   1050 <gmshModelGeoAddPoint@plt>
mov    $0x1,%edi
xor    %edx,%edx
movsd  0xe0a(%rip),%xmm0
mov    $0x2,%ecx
lea    -0x14(%rbp),%r8
mov    %edx,%esi
call   1050 <gmshModelGeoAddPoint@plt>
mov    $0x1,%esi
xor    %edx,%edx
movsd  0xdeb(%rip),%xmm0
mov    $0x3,%ecx
lea    -0x14(%rbp),%r8
mov    %esi,%edi
call   1050 <gmshModelGeoAddPoint@plt>
xor    %edx,%edx
mov    $0x1,%esi
movsd  0xdcc(%rip),%xmm0
mov    $0x4,%ecx
lea    -0x14(%rbp),%r8
mov    %edx,%edi
call   1050 <gmshModelGeoAddPoint@plt>
mov    $0x1,%edx
mov    $0x2,%esi
lea    -0x14(%rbp),%rcx
mov    %edx,%edi
call   1060 <gmshModelGeoAddLine@plt>
mov    $0x2,%edx
mov    $0x3,%esi
lea    -0x14(%rbp),%rcx
mov    %edx,%edi
call   1060 <gmshModelGeoAddLine@plt>
mov    $0x3,%edx
mov    $0x4,%esi
lea    -0x14(%rbp),%rcx
mov    %edx,%edi
call   1060 <gmshModelGeoAddLine@plt>
mov    $0x4,%edi
mov    $0x1,%esi
mov    $0xffffffff,%edx
lea    -0x14(%rbp),%rcx
call   1060 <gmshModelGeoAddLine@plt>
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x30(%rbp)
movl   $0x2,-0x2c(%rbp)
movl   $0x3,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
lea    -0x14(%rbp),%rcx
call   1030 <gmshModelGeoAddCurveLoop@plt>
mov    0xd46(%rip),%eax
mov    %eax,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x1,%esi
mov    $0x6,%edx
lea    -0x14(%rbp),%rcx
call   1090 <gmshModelGeoAddPlaneSurface@plt>
lea    -0x14(%rbp),%rdi
call   1070 <gmshModelGeoSynchronize@plt>
mov    $0x2,%edi
lea    -0x14(%rbp),%rsi
call   1080 <gmshModelMeshGenerate@plt>
lea    0xd01(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <gmshWrite@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0x14(%rsp),%rbx
mov    $0x1,%edx
mov    %rbx,%rcx
call   10b0 <gmshInitialize@plt>
lea    0xe58(%rip),%rdi
mov    %rbx,%rsi
call   10a0 <gmshModelAdd@plt>
movsd  0xe40(%rip),%xmm0
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    %rbx,%r8
call   1050 <gmshModelGeoAddPoint@plt>
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
movsd  0xe1c(%rip),%xmm0
mov    $0x2,%ecx
mov    %rbx,%r8
call   1050 <gmshModelGeoAddPoint@plt>
mov    $0x1,%edi
mov    $0x1,%esi
xor    %edx,%edx
movsd  0xdfb(%rip),%xmm0
mov    $0x3,%ecx
mov    %rbx,%r8
call   1050 <gmshModelGeoAddPoint@plt>
xor    %edi,%edi
mov    $0x1,%esi
xor    %edx,%edx
movsd  0xddd(%rip),%xmm0
mov    $0x4,%ecx
mov    %rbx,%r8
call   1050 <gmshModelGeoAddPoint@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <gmshModelGeoAddLine@plt>
mov    $0x2,%edi
mov    $0x3,%esi
mov    $0x2,%edx
mov    %rbx,%rcx
call   1060 <gmshModelGeoAddLine@plt>
mov    $0x3,%edi
mov    $0x4,%esi
mov    $0x3,%edx
mov    %rbx,%rcx
call   1060 <gmshModelGeoAddLine@plt>
mov    $0x4,%edi
mov    $0x1,%esi
mov    $0xffffffff,%edx
mov    %rbx,%rcx
call   1060 <gmshModelGeoAddLine@plt>
movabs $0x200000001,%rcx
mov    %rcx,(%rsp)
movl   $0x3,0x8(%rsp)
mov    %eax,0xc(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <gmshModelGeoAddCurveLoop@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x6,%edx
mov    %rbx,%rcx
call   1090 <gmshModelGeoAddPlaneSurface@plt>
mov    %rbx,%rdi
call   1070 <gmshModelGeoSynchronize@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
call   1080 <gmshModelMeshGenerate@plt>
lea    0xd20(%rip),%rdi
mov    %rbx,%rsi
call   1040 <gmshWrite@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"square\00"
@__const.main.s = [1 x i32] [i32 1]
@.str.1 = [11 x i8] c"square.msh\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 [4 x i32]
%9 = alloca [1 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @gmshInitialize(i32 %10, i8** %11, i32 1, i32* %6)
%13 = call i32 @gmshModelAdd(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %6)
%14 = call i32 @gmshModelGeoAddPoint(i32 0, i32 0, i32 0, double 1.000000e-01, i32 1, i32* %6)
%15 = call i32 @gmshModelGeoAddPoint(i32 1, i32 0, i32 0, double 1.000000e-01, i32 2, i32* %6)
%16 = call i32 @gmshModelGeoAddPoint(i32 1, i32 1, i32 0, double 1.000000e-01, i32 3, i32* %6)
%17 = call i32 @gmshModelGeoAddPoint(i32 0, i32 1, i32 0, double 1.000000e-01, i32 4, i32* %6)
%18 = call i32 @gmshModelGeoAddLine(i32 1, i32 2, i32 1, i32* %6)
%19 = call i32 @gmshModelGeoAddLine(i32 2, i32 3, i32 2, i32* %6)
%20 = call i32 @gmshModelGeoAddLine(i32 3, i32 4, i32 3, i32* %6)
%21 = call i32 @gmshModelGeoAddLine(i32 4, i32 1, i32 -1, i32* %6)
store i32 %21, i32* %7
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
store i32 1, i32* %22
%23 = getelementptr inbounds i32, i32* %22, i64 1
store i32 2, i32* %23
%24 = getelementptr inbounds i32, i32* %23, i64 1
store i32 3, i32* %24
%25 = getelementptr inbounds i32, i32* %24, i64 1
%26 = load i32, i32* %7
store i32 %26, i32* %25
%27 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
%28 = call i32 @gmshModelGeoAddCurveLoop(i32* %27, i32 4, i32 1, i32* %6)
%29 = bitcast [1 x i32]* %9 to i8*
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
%31 = call i32 @gmshModelGeoAddPlaneSurface(i32* %30, i32 1, i32 6, i32* %6)
%32 = call i32 @gmshModelGeoSynchronize(i32* %6)
%33 = call i32 @gmshModelMeshGenerate(i32 2, i32* %6)
%34 = call i32 @gmshWrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"square\00"
@.str.1 = [11 x i8] c"square.msh\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [4 x i32]
%5 = bitcast i32* %3 to i8*
%6 = call i32 @gmshInitialize(i32 %0, i8** %1, i32 1, i32* %3)
%7 = call i32 @gmshModelAdd(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = call i32 @gmshModelGeoAddPoint(i32 0, i32 0, i32 0, double 1.000000e-01, i32 1, i32* %3)
%9 = call i32 @gmshModelGeoAddPoint(i32 1, i32 0, i32 0, double 1.000000e-01, i32 2, i32* %3)
%10 = call i32 @gmshModelGeoAddPoint(i32 1, i32 1, i32 0, double 1.000000e-01, i32 3, i32* %3)
%11 = call i32 @gmshModelGeoAddPoint(i32 0, i32 1, i32 0, double 1.000000e-01, i32 4, i32* %3)
%12 = call i32 @gmshModelGeoAddLine(i32 1, i32 2, i32 1, i32* %3)
%13 = call i32 @gmshModelGeoAddLine(i32 2, i32 3, i32 2, i32* %3)
%14 = call i32 @gmshModelGeoAddLine(i32 3, i32 4, i32 3, i32* %3)
%15 = call i32 @gmshModelGeoAddLine(i32 4, i32 1, i32 -1, i32* %3)
%16 = bitcast [4 x i32]* %4 to i8*
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
store i32 1, i32* %17
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 1
store i32 2, i32* %18
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 2
store i32 3, i32* %19
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 3
store i32 %15, i32* %20
%21 = call i32 @gmshModelGeoAddCurveLoop(i32* %17, i32 4, i32 1, i32* %3)
%22 = call i32 @gmshModelGeoAddPlaneSurface(i32* %17, i32 1, i32 6, i32* %3)
%23 = call i32 @gmshModelGeoSynchronize(i32* %3)
%24 = call i32 @gmshModelMeshGenerate(i32 2, i32* %3)
%25 = call i32 @gmshWrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %3)
ret i32 0
}