#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 atoi(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ isdigit(char);
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char *host = malloc(256);
  char *date = malloc(256);
  char *location = malloc(256);
  char *invited = malloc(256);
  char *time = malloc(256);
  char *hours = malloc(256);
  int i;
  if (host == NULL || date == NULL || location == NULL || invited == NULL) {
    printf("Out of memory\n");
    return 1;
  }
  printf("Vem står för inbjudan? ");
  fgets(host, 256, stdin);
  if (strlen(host) < 2) {
    printf("Invalid input\n");
    return 1;
  }
  printf("Vilket datum? ");
  fgets(date, 256, stdin);
  if (strlen(date) < 5 || !isdigit(date[0])) {
    printf("Invalid input\n");
    return 1;
  }
  printf("Vilket klockslag börjar festen? ");
  fgets(time, 256, stdin);
  for (i = 0; i < strlen(time) - 1; ++i) {
    if (!isdigit(time[i])) {
      printf("Invalid input\n");
      return 1;
    }
  }
  printf("Hur många timmar håller festen på? ");
  fgets(hours, 256, stdin);
  for (i = 0; i < strlen(hours) - 1; ++i) {
    if (!isdigit(hours[i])) {
      printf("Invalid input\n");
      return 1;
    }
  }
  printf("Var? ");
  fgets(location, 256, stdin);
  if (strlen(location) == 0) {
    printf("Invalid input\n");
    return 1;
  }
  printf("Vem ska bjudas? ");
  fgets(invited, 256, stdin);
  if (strlen(invited) < 2) {
    printf("Invalid input\n");
    return 1;
  }
  host[strlen(host) - 1] = '\0';
  date[strlen(date) - 1] = '\0';
  location[strlen(location) - 1] = '\0';
  invited[strlen(invited) - 1] = '\0';
  time[strlen(time) - 1] = '\0';
  hours[strlen(hours) - 1] = '\0';
  printf("\n------------------------\n");
  printf("Hej %s!\n\nDu är välkommen på fest den %s kl %s i %s.\n", invited,
         date, time, location);
  printf("Festen varar tills klockan %d.\n", (atoi(time) + atoi(hours)) % 24);
  printf("Hälsningar\n%s\n", host);
  free(host);
  host = NULL;
  free(date);
  date = NULL;
  free(location);
  location = NULL;
  free(invited);
  invited = NULL;
  free(time);
  time = NULL;
  free(hours);
  hours = NULL;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1202 <main+0x92>
cmpq   $0x0,-0x18(%rbp)
je     1202 <main+0x92>
cmpq   $0x0,-0x20(%rbp)
je     1202 <main+0x92>
cmpq   $0x0,-0x28(%rbp)
jne    121c <main+0xac>
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    163e <main+0x4ce>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    0x2db3(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1070 <fgets@plt>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jge    126d <main+0xfd>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    163e <main+0x4ce>
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2d62(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1070 <fgets@plt>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jl     12b9 <main+0x149>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%eax
jne    12d3 <main+0x163>
lea    0xd69(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    163e <main+0x4ce>
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    0x2cfc(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1070 <fgets@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1365 <main+0x1f5>
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%eax
jne    1352 <main+0x1e2>
lea    0xcea(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    163e <main+0x4ce>
jmp    1357 <main+0x1e7>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12ff <main+0x18f>
lea    0xcfd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    0x2c6a(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1070 <fgets@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13f7 <main+0x287>
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%eax
jne    13e4 <main+0x274>
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    163e <main+0x4ce>
jmp    13e9 <main+0x279>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1391 <main+0x221>
lea    0xc92(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    0x2bd8(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1070 <fgets@plt>
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    1448 <main+0x2d8>
lea    0xbf4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    163e <main+0x4ce>
lea    0xc47(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    0x2b87(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1070 <fgets@plt>
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jge    1499 <main+0x329>
lea    0xba3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    163e <main+0x4ce>
mov    -0x10(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x78(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x70(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x68(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x38(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
lea    0xb41(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xb3e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
add    %ecx,%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xb42(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xb50(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x30(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    $0x100,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    $0x100,%edi
call   1090 <malloc@plt>
mov    %rax,%r14
mov    $0x100,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
mov    $0x100,%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
mov    $0x100,%edi
call   1090 <malloc@plt>
mov    %rax,%r13
mov    $0x100,%edi
call   1090 <malloc@plt>
test   %rbx,%rbx
je     13b6 <main+0x236>
test   %r14,%r14
je     13b6 <main+0x236>
test   %r12,%r12
je     13b6 <main+0x236>
test   %rbp,%rbp
je     13b6 <main+0x236>
mov    %rax,0x20(%rsp)
lea    0xdf7(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2dd1(%rip),%r15
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1080 <fgets@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    $0x1,%eax
jle    13ad <main+0x22d>
lea    0xddb(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r15),%edx
mov    %r14,%rdi
mov    $0x100,%esi
call   1080 <fgets@plt>
mov    %r14,%rdi
call   1060 <strlen@plt>
cmp    $0x5,%eax
jl     13ad <main+0x22d>
movsbl (%r14),%edi
call   1040 <isdigit@plt>
test   %eax,%eax
je     13ad <main+0x22d>
mov    %rbp,0x8(%rsp)
lea    0xda5(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2d56(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
mov    $0x100,%esi
call   1080 <fgets@plt>
mov    %r13,%rdi
call   1060 <strlen@plt>
cmp    $0x2,%eax
mov    0x20(%rsp),%r15
jl     12e9 <main+0x169>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x0(%r13,%rbp,1),%edi
call   1040 <isdigit@plt>
test   %eax,%eax
je     13ad <main+0x22d>
add    $0x1,%rbp
mov    %r13,%rdi
call   1060 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%rbp
jl     12c0 <main+0x140>
lea    0xd5b(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2cea(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    $0x100,%esi
call   1080 <fgets@plt>
mov    %r15,%rdi
call   1060 <strlen@plt>
cmp    $0x2,%eax
jl     1344 <main+0x1c4>
xor    %ebp,%ebp
nopl   0x0(%rax)
movsbl (%r15,%rbp,1),%edi
call   1040 <isdigit@plt>
test   %eax,%eax
je     13ad <main+0x22d>
add    $0x1,%rbp
mov    %r15,%rdi
call   1060 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%rbp
jl     1320 <main+0x1a0>
lea    0xd27(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2c8f(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %r12,%rdi
mov    $0x100,%esi
call   1080 <fgets@plt>
mov    %r12,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
je     13ad <main+0x22d>
mov    %r12,0x18(%rsp)
lea    0xcf7(%rip),%rdi
xor    %r12d,%r12d
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%rbp),%edx
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x100,%esi
call   1080 <fgets@plt>
mov    %rbp,%rdi
call   1060 <strlen@plt>
cmp    $0x1,%eax
jg     13da <main+0x25a>
lea    0xd57(%rip),%rdi
jmp    13bd <main+0x23d>
lea    0xd5c(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %r14,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r14,1)
mov    0x18(%rsp),%rdi
mov    %rdi,%rbp
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbp,1)
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbp,1)
mov    %r13,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r13,1)
mov    %r15,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r15,1)
lea    0xca9(%rip),%rdi
call   1050 <puts@plt>
lea    0xc35(%rip),%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    %r13,%rcx
mov    0x18(%rsp),%rbp
mov    %rbp,%r8
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,%rdi
call   10a0 <atoi@plt>
mov    %eax,0x14(%rsp)
mov    %r15,%rdi
call   10a0 <atoi@plt>
add    0x14(%rsp),%eax
movslq %eax,%rsi
imul   $0x2aaaaaab,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x22,%rax
add    %ecx,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%esi
lea    0xc17(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xc29(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
jmp    13c8 <main+0x248>

LLVM IR (-O0):
@.str = [15 x i8] c"Out of memory\0A\00"
@.str.1 = [26 x i8] c"Vem st\C3\A5r f\C3\B6r inbjudan? \00"
@stdin = global i32 0
@.str.2 = [15 x i8] c"Invalid input\0A\00"
@.str.3 = [15 x i8] c"Vilket datum? \00"
@.str.4 = [34 x i8] c"Vilket klockslag b\C3\B6rjar festen? \00"
@.str.5 = [39 x i8] c"Hur m\C3\A5nga timmar h\C3\A5ller festen p\C3\A5? \00"
@.str.6 = [6 x i8] c"Var? \00"
@.str.7 = [17 x i8] c"Vem ska bjudas? \00"
@.str.8 = [27 x i8] c"\0A------------------------\0A\00"
@.str.9 = [56 x i8] c"Hej %s!\0A\0ADu \C3\A4r v\C3\A4lkommen p\C3\A5 fest den %s kl %s i %s.\0A\00"
@.str.10 = [32 x i8] c"Festen varar tills klockan %d.\0A\00"
@.str.11 = [16 x i8] c"H\C3\A4lsningar\0A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %1
%9 = call i8* @malloc(i32 256)
store i8* %9, i8** %2
%10 = call i8* @malloc(i32 256)
store i8* %10, i8** %3
%11 = call i8* @malloc(i32 256)
store i8* %11, i8** %4
%12 = call i8* @malloc(i32 256)
store i8* %12, i8** %5
%13 = call i8* @malloc(i32 256)
store i8* %13, i8** %6
%14 = call i8* @malloc(i32 256)
store i8* %14, i8** %7
%15 = load i8*, i8** %2
%16 = icmp eq i8* %15, null
br i1 %16, label %26, label %17
17: ; preds = %0
%18 = load i8*, i8** %3
%19 = icmp eq i8* %18, null
br i1 %19, label %26, label %20
20: ; preds = %17
%21 = load i8*, i8** %4
%22 = icmp eq i8* %21, null
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i8*, i8** %5
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %28
26: ; preds = %23, %20, %17, %0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %188
28: ; preds = %23
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%30 = load i8*, i8** %2
%31 = load i32, i32* @stdin
%32 = call i32 @fgets(i8* %30, i32 256, i32 %31)
%33 = load i8*, i8** %2
%34 = call i32 @strlen(i8* %33)
%35 = icmp slt i32 %34, 2
br i1 %35, label %36, label %38
36: ; preds = %28
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %188
38: ; preds = %28
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%40 = load i8*, i8** %3
%41 = load i32, i32* @stdin
%42 = call i32 @fgets(i8* %40, i32 256, i32 %41)
%43 = load i8*, i8** %3
%44 = call i32 @strlen(i8* %43)
%45 = icmp slt i32 %44, 5
br i1 %45, label %52, label %46
46: ; preds = %38
%47 = load i8*, i8** %3
%48 = getelementptr inbounds i8, i8* %47, i64 0
%49 = load i8, i8* %48
%50 = call i32 @isdigit(i8 signext %49)
%51 = icmp ne i32 %50, 0
br i1 %51, label %54, label %52
52: ; preds = %46, %38
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %188
54: ; preds = %46
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%56 = load i8*, i8** %6
%57 = load i32, i32* @stdin
%58 = call i32 @fgets(i8* %56, i32 256, i32 %57)
store i32 0, i32* %8
br label %59
59: ; preds = %76, %54
%60 = load i32, i32* %8
%61 = load i8*, i8** %6
%62 = call i32 @strlen(i8* %61)
%63 = sub nsw i32 %62, 1
%64 = icmp slt i32 %60, %63
br i1 %64, label %65, label %79
65: ; preds = %59
%66 = load i8*, i8** %6
%67 = load i32, i32* %8
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %66, i64 %68
%70 = load i8, i8* %69
%71 = call i32 @isdigit(i8 signext %70)
%72 = icmp ne i32 %71, 0
br i1 %72, label %75, label %73
73: ; preds = %65
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %188
75: ; preds = %65
br label %76
76: ; preds = %75
%77 = load i32, i32* %8
%78 = add nsw i32 %77, 1
store i32 %78, i32* %8
br label %59
79: ; preds = %59
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%81 = load i8*, i8** %7
%82 = load i32, i32* @stdin
%83 = call i32 @fgets(i8* %81, i32 256, i32 %82)
store i32 0, i32* %8
br label %84
84: ; preds = %101, %79
%85 = load i32, i32* %8
%86 = load i8*, i8** %7
%87 = call i32 @strlen(i8* %86)
%88 = sub nsw i32 %87, 1
%89 = icmp slt i32 %85, %88
br i1 %89, label %90, label %104
90: ; preds = %84
%91 = load i8*, i8** %7
%92 = load i32, i32* %8
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %91, i64 %93
%95 = load i8, i8* %94
%96 = call i32 @isdigit(i8 signext %95)
%97 = icmp ne i32 %96, 0
br i1 %97, label %100, label %98
98: ; preds = %90
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %188
100: ; preds = %90
br label %101
101: ; preds = %100
%102 = load i32, i32* %8
%103 = add nsw i32 %102, 1
store i32 %103, i32* %8
br label %84
104: ; preds = %84
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%106 = load i8*, i8** %4
%107 = load i32, i32* @stdin
%108 = call i32 @fgets(i8* %106, i32 256, i32 %107)
%109 = load i8*, i8** %4
%110 = call i32 @strlen(i8* %109)
%111 = icmp eq i32 %110, 0
br i1 %111, label %112, label %114
112: ; preds = %104
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %188
114: ; preds = %104
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%116 = load i8*, i8** %5
%117 = load i32, i32* @stdin
%118 = call i32 @fgets(i8* %116, i32 256, i32 %117)
%119 = load i8*, i8** %5
%120 = call i32 @strlen(i8* %119)
%121 = icmp slt i32 %120, 2
br i1 %121, label %122, label %124
122: ; preds = %114
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %188
124: ; preds = %114
%125 = load i8*, i8** %2
%126 = load i8*, i8** %2
%127 = call i32 @strlen(i8* %126)
%128 = sub nsw i32 %127, 1
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i8, i8* %125, i64 %129
store i8 0, i8* %130
%131 = load i8*, i8** %3
%132 = load i8*, i8** %3
%133 = call i32 @strlen(i8* %132)
%134 = sub nsw i32 %133, 1
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8, i8* %131, i64 %135
store i8 0, i8* %136
%137 = load i8*, i8** %4
%138 = load i8*, i8** %4
%139 = call i32 @strlen(i8* %138)
%140 = sub nsw i32 %139, 1
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8, i8* %137, i64 %141
store i8 0, i8* %142
%143 = load i8*, i8** %5
%144 = load i8*, i8** %5
%145 = call i32 @strlen(i8* %144)
%146 = sub nsw i32 %145, 1
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds i8, i8* %143, i64 %147
store i8 0, i8* %148
%149 = load i8*, i8** %6
%150 = load i8*, i8** %6
%151 = call i32 @strlen(i8* %150)
%152 = sub nsw i32 %151, 1
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds i8, i8* %149, i64 %153
store i8 0, i8* %154
%155 = load i8*, i8** %7
%156 = load i8*, i8** %7
%157 = call i32 @strlen(i8* %156)
%158 = sub nsw i32 %157, 1
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds i8, i8* %155, i64 %159
store i8 0, i8* %160
%161 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%162 = load i8*, i8** %5
%163 = load i8*, i8** %3
%164 = load i8*, i8** %6
%165 = load i8*, i8** %4
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.9, i64 0, i64 0), i8* %162, i8* %163, i8* %164, i8* %165)
%167 = load i8*, i8** %6
%168 = call i32 @atoi(i8* %167)
%169 = load i8*, i8** %7
%170 = call i32 @atoi(i8* %169)
%171 = add nsw i32 %168, %170
%172 = srem i32 %171, 24
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i32 %172)
%174 = load i8*, i8** %2
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8* %174)
%176 = load i8*, i8** %2
%177 = call i32 @free(i8* %176)
store i8* null, i8** %2
%178 = load i8*, i8** %3
%179 = call i32 @free(i8* %178)
store i8* null, i8** %3
%180 = load i8*, i8** %4
%181 = call i32 @free(i8* %180)
store i8* null, i8** %4
%182 = load i8*, i8** %5
%183 = call i32 @free(i8* %182)
store i8* null, i8** %5
%184 = load i8*, i8** %6
%185 = call i32 @free(i8* %184)
store i8* null, i8** %6
%186 = load i8*, i8** %7
%187 = call i32 @free(i8* %186)
store i8* null, i8** %7
store i32 0, i32* %1
br label %188
188: ; preds = %124, %122, %112, %98, %73, %52, %36, %26
%189 = load i32, i32* %1
ret i32 %189
}

LLVM IR (-O2):
@.str.1 = [26 x i8] c"Vem st\C3\A5r f\C3\B6r inbjudan? \00"
@stdin = global i32 0
@.str.3 = [15 x i8] c"Vilket datum? \00"
@.str.4 = [34 x i8] c"Vilket klockslag b\C3\B6rjar festen? \00"
@.str.5 = [39 x i8] c"Hur m\C3\A5nga timmar h\C3\A5ller festen p\C3\A5? \00"
@.str.6 = [6 x i8] c"Var? \00"
@.str.7 = [17 x i8] c"Vem ska bjudas? \00"
@.str.9 = [56 x i8] c"Hej %s!\0A\0ADu \C3\A4r v\C3\A4lkommen p\C3\A5 fest den %s kl %s i %s.\0A\00"
@.str.10 = [32 x i8] c"Festen varar tills klockan %d.\0A\00"
@.str.11 = [16 x i8] c"H\C3\A4lsningar\0A%s\0A\00"
@str.12 = [26 x i8] c"\0A------------------------\00"
@str.17 = [14 x i8] c"Invalid input\00"
@str.18 = [14 x i8] c"Out of memory\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%2 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%3 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%4 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%5 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%6 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%7 = icmp eq i8* %1, null
%8 = icmp eq i8* %2, null
%9 = or i1 %7, %8
%10 = icmp eq i8* %3, null
%11 = or i1 %9, %10
%12 = icmp eq i8* %4, null
%13 = or i1 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.18, i64 0, i64 0))
br label %131
16: ; preds = %0
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* @stdin
%19 = tail call i32 @fgets(i8* %1, i32 256, i32 %18)
%20 = tail call i32 @strlen(i8* %1)
%21 = icmp slt i32 %20, 2
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.17, i64 0, i64 0))
br label %131
24: ; preds = %16
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%26 = load i32, i32* @stdin
%27 = tail call i32 @fgets(i8* %2, i32 256, i32 %26)
%28 = tail call i32 @strlen(i8* %2)
%29 = icmp slt i32 %28, 5
br i1 %29, label %34, label %30
30: ; preds = %24
%31 = load i8, i8* %2
%32 = tail call i32 @isdigit(i8 signext %31)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30, %24
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.17, i64 0, i64 0))
br label %131
36: ; preds = %30
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%38 = load i32, i32* @stdin
%39 = tail call i32 @fgets(i8* %5, i32 256, i32 %38)
%40 = tail call i32 @strlen(i8* %5)
%41 = icmp sgt i32 %40, 1
br i1 %41, label %47, label %56
42: ; preds = %47
%43 = tail call i32 @strlen(i8* %5)
%44 = add nsw i32 %43, -1
%45 = sext i32 %44 to i64
%46 = icmp slt i64 %53, %45
br i1 %46, label %47, label %56
47: ; preds = %36, %42
%48 = phi i64 [ %53, %42 ], [ 0, %36 ]
%49 = getelementptr inbounds i8, i8* %5, i64 %48
%50 = load i8, i8* %49
%51 = tail call i32 @isdigit(i8 signext %50)
%52 = icmp eq i32 %51, 0
%53 = add nuw nsw i64 %48, 1
br i1 %52, label %54, label %42
54: ; preds = %47
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.17, i64 0, i64 0))
br label %131
56: ; preds = %42, %36
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%58 = load i32, i32* @stdin
%59 = tail call i32 @fgets(i8* %6, i32 256, i32 %58)
%60 = tail call i32 @strlen(i8* %6)
%61 = icmp sgt i32 %60, 1
br i1 %61, label %67, label %76
62: ; preds = %67
%63 = tail call i32 @strlen(i8* %6)
%64 = add nsw i32 %63, -1
%65 = sext i32 %64 to i64
%66 = icmp slt i64 %73, %65
br i1 %66, label %67, label %76
67: ; preds = %56, %62
%68 = phi i64 [ %73, %62 ], [ 0, %56 ]
%69 = getelementptr inbounds i8, i8* %6, i64 %68
%70 = load i8, i8* %69
%71 = tail call i32 @isdigit(i8 signext %70)
%72 = icmp eq i32 %71, 0
%73 = add nuw nsw i64 %68, 1
br i1 %72, label %74, label %62
74: ; preds = %67
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.17, i64 0, i64 0))
br label %131
76: ; preds = %62, %56
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%78 = load i32, i32* @stdin
%79 = tail call i32 @fgets(i8* %3, i32 256, i32 %78)
%80 = tail call i32 @strlen(i8* %3)
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %76
%83 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.17, i64 0, i64 0))
br label %131
84: ; preds = %76
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%86 = load i32, i32* @stdin
%87 = tail call i32 @fgets(i8* %4, i32 256, i32 %86)
%88 = tail call i32 @strlen(i8* %4)
%89 = icmp slt i32 %88, 2
br i1 %89, label %90, label %92
90: ; preds = %84
%91 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.17, i64 0, i64 0))
br label %131
92: ; preds = %84
%93 = tail call i32 @strlen(i8* %1)
%94 = add nsw i32 %93, -1
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i8, i8* %1, i64 %95
store i8 0, i8* %96
%97 = tail call i32 @strlen(i8* %2)
%98 = add nsw i32 %97, -1
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %2, i64 %99
store i8 0, i8* %100
%101 = tail call i32 @strlen(i8* %3)
%102 = add nsw i32 %101, -1
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8, i8* %3, i64 %103
store i8 0, i8* %104
%105 = tail call i32 @strlen(i8* %4)
%106 = add nsw i32 %105, -1
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %4, i64 %107
store i8 0, i8* %108
%109 = tail call i32 @strlen(i8* %5)
%110 = add nsw i32 %109, -1
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8, i8* %5, i64 %111
store i8 0, i8* %112
%113 = tail call i32 @strlen(i8* %6)
%114 = add nsw i32 %113, -1
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i8, i8* %6, i64 %115
store i8 0, i8* %116
%117 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.12, i64 0, i64 0))
%118 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.9, i64 0, i64 0), i8* %4, i8* %2, i8* %5, i8* %3)
%119 = tail call i32 @atoi(i8* %5)
%120 = tail call i32 @atoi(i8* %6)
%121 = add nsw i32 %120, %119
%122 = srem i32 %121, 24
%123 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i32 %122)
%124 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8* %1)
%125 = tail call i32 @free(i8* %1)
%126 = tail call i32 @free(i8* %2)
%127 = tail call i32 @free(i8* %3)
%128 = tail call i32 @free(i8* %4)
%129 = tail call i32 @free(i8* %5)
%130 = tail call i32 @free(i8* %6)
br label %131
131: ; preds = %92, %90, %82, %74, %54, %34, %22, %14
%132 = phi i32 [ 1, %14 ], [ 1, %22 ], [ 1, %34 ], [ 1, %54 ], [ 1, %74 ], [ 1, %82 ], [ 1, %90 ], [ 0, %92 ]
ret i32 %132
}