; ModuleID = 'LFortran'
source_filename = "LFortran"
target datalayout = "..."

%string_descriptor = type <{ i8*, i64 }>

define i32 @__module_string_54_mod_double_(i32* %x) {
.entry:
  %ret = alloca i32, align 4
  %0 = load i32, i32* %x, align 4
  %1 = mul i32 %0, 2
  store i32 %1, i32* %ret, align 4
  br label %return

return:                                           ; preds = %.entry
  br label %FINALIZE_SYMTABLE_double_

FINALIZE_SYMTABLE_double_:                        ; preds = %return
  %2 = load i32, i32* %ret, align 4
  ret i32 %2
}

define void @__module_string_54_mod_foo_sub(i32* %x, %string_descriptor* %char) {
.entry:
  br label %return

return:                                           ; preds = %.entry
  br label %FINALIZE_SYMTABLE_foo_sub

FINALIZE_SYMTABLE_foo_sub:                        ; preds = %return
  ret void
}

define i32 @main(i32 %0, i8** %1) {
.entry:
  %2 = call i8* @_lfortran_get_default_allocator()
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %char = alloca %string_descriptor, align 8
  store %string_descriptor zeroinitializer, %string_descriptor* %char, align 1
  %3 = getelementptr %string_descriptor, %string_descriptor* %char, i32 0, i32 1
  store i64 10, i64* %3, align 8
  %4 = getelementptr %string_descriptor, %string_descriptor* %char, i32 0, i32 0
  %5 = call i8* @_lfortran_get_default_allocator()
  %6 = call i8* @_lfortran_malloc_alloc(i8* %5, i64 10)
  store i8* %6, i8** %4, align 8
  %x = alloca i32, align 4
  store i32 10, i32* %x, align 4
  call void @__module_string_54_mod_foo_sub(i32* %x, %string_descriptor* %char)
  br label %return

return:                                           ; preds = %.entry
  br label %FINALIZE_SYMTABLE_string_54

FINALIZE_SYMTABLE_string_54:                      ; preds = %return
  br label %Finalize_Variable_char

Finalize_Variable_char:                           ; preds = %FINALIZE_SYMTABLE_string_54
  %7 = getelementptr %string_descriptor, %string_descriptor* %char, i32 0, i32 0
  %8 = load i8*, i8** %7, align 8
  call void @_lfortran_free_alloc(i8* %2, i8* %8)
  call void @_lfortran_internal_alloc_finalize()
  ret i32 0
}

declare void @_lpython_call_initial_functions(i32, i8**)

declare i8* @_lfortran_malloc_alloc(i8*, i64)

declare i8* @_lfortran_get_default_allocator()

declare void @_lfortran_free_alloc(i8*, i8*)

declare void @_lfortran_internal_alloc_finalize()
