#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 */
struct mg_connection {
  int dummy;
};
typedef int /*<<< orphan*/ n2;
typedef int /*<<< orphan*/ n1;

/* Variables and functions */
int /*<<< orphan*/ mg_get_var(struct mg_connection *, char *, char *, int);
int /*<<< orphan*/ mg_printf_data(struct mg_connection *, char *, scalar_t__);
scalar_t__ strtod(char *, int /*<<< orphan*/ *);
void handle_restful_call(struct mg_connection *conn) {
  char n1[100], n2[100];
  mg_get_var(conn, "n1", n1, sizeof(n1));
  mg_get_var(conn, "n2", n2, sizeof(n2));
  mg_printf_data(conn, "{ \"result\": %lf }",
                 strtod(n1, NULL) + strtod(n2, NULL));
}


x86 assembly (clang, -O0):
<handle_restful_call>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    0xeb2(%rip),%rsi
mov    $0x64,%ecx
call   1040 <mg_get_var@plt>
mov    -0x8(%rbp),%rdi
lea    -0xe0(%rbp),%rdx
lea    0xe99(%rip),%rsi
mov    $0x64,%ecx
call   1040 <mg_get_var@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0xe8(%rbp)
lea    -0x70(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    %rax,-0xf0(%rbp)
lea    -0xe0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    -0xf0(%rbp),%rdx
mov    -0xe8(%rbp),%rdi
add    %rax,%rdx
lea    0xe4b(%rip),%rsi
call   1050 <mg_printf_data@plt>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_restful_call>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %rdi,%r12
lea    0xeb8(%rip),%rsi
lea    0x70(%rsp),%r14
mov    %r14,%rdx
mov    $0x64,%ecx
call   1040 <mg_get_var@plt>
lea    0xea2(%rip),%rsi
mov    %rsp,%r15
mov    %r12,%rdi
mov    %r15,%rdx
mov    $0x64,%ecx
call   1040 <mg_get_var@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
mov    %rax,%rbx
mov    %r15,%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
add    %rax,%rbx
lea    0xe71(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
call   1050 <mg_printf_data@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.mg_connection = type { i32 }
@.str = [3 x i8] c"n1\00"
@.str.1 = [3 x i8] c"n2\00"
@.str.2 = [18 x i8] c"{ \22result\22: %lf }\00"
define void @handle_restful_call(%struct.mg_connection* %0) {
%2 = alloca %struct.mg_connection*
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
store %struct.mg_connection* %0, %struct.mg_connection** %2
%5 = load %struct.mg_connection*, %struct.mg_connection** %2
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = call i32 @mg_get_var(%struct.mg_connection* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6, i32 100)
%8 = load %struct.mg_connection*, %struct.mg_connection** %2
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%10 = call i32 @mg_get_var(%struct.mg_connection* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 100)
%11 = load %struct.mg_connection*, %struct.mg_connection** %2
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%13 = call i64 @strtod(i8* %12, i32* null)
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%15 = call i64 @strtod(i8* %14, i32* null)
%16 = add nsw i64 %13, %15
%17 = call i32 @mg_printf_data(%struct.mg_connection* %11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 %16)
ret void
}

LLVM IR (-O2):
%struct.mg_connection = type { i32 }
@.str = [3 x i8] c"n1\00"
@.str.1 = [3 x i8] c"n2\00"
@.str.2 = [18 x i8] c"{ \22result\22: %lf }\00"
define void @handle_restful_call(%struct.mg_connection* %0) {
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = call i32 @mg_get_var(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4, i32 100)
%7 = call i32 @mg_get_var(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 100)
%8 = call i64 @strtod(i8* nocapture %4, i32* null)
%9 = call i64 @strtod(i8* nocapture %5, i32* null)
%10 = add nsw i64 %9, %8
%11 = call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 %10)
ret void
}